BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
jan_t_lagen
Calcite | Level 5

Hi!

 

I've found a model that I want to recreate for my masters thesis but the procedure is very imprecise. Essentially what I want is to find the implied probability (p) that is needed for a model to produce a certain outcome (A). In other words i want to send in some p

 

p = a*x + b*y where a and b are known.

 

So the optimization would roughly be: 

 

1. Chose x and y

2. Calculate p and insert into the model

3. Compare result with desired outcome A

 

The authors just state that they use a grid search (something which i'm not familiar with) to achieve this and nothing more.

 

My main question is: is it possible to optimize a model like this when I'm treating the model itself as a "black box". Since the model is fairly complicated i think that if it is not possible I would try to "manually" produce code that tries a number of combinations of x and y and find the best fitted pair... although i'd prefer if there was a more elegant and simple way to achieve this. 

 

I'm using SAS/IML.

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

Yes, you can do this. Optimization methods don't care how the objective function is computed, and IML will compute numerical derivatives for you for any Newton-type optimizations.

 

Two issues that you might encounter:

1. In your example, p is the probability that depends on a and b. You will need to set constraints on a and b so that 0< p <1.

2. You don't seem to have any randomness (for example, a regression model with "noise"), but if the objective function is stochastic then the optimization algorithm will get close to the optimal value but then will "bounce around" because of the random terms.solution.)

 

Some articles for you to read:

Maximum likelihood estimation in SAS/IML

Optimizing a function that evaluates an integral

Optimizing a function of an integral

View solution in original post

4 REPLIES 4
Ksharp
Super User
You want P be maximize or minimize or a constant value. All these could be done vi
Rick_SAS
SAS Super FREQ

Yes, you can do this. Optimization methods don't care how the objective function is computed, and IML will compute numerical derivatives for you for any Newton-type optimizations.

 

Two issues that you might encounter:

1. In your example, p is the probability that depends on a and b. You will need to set constraints on a and b so that 0< p <1.

2. You don't seem to have any randomness (for example, a regression model with "noise"), but if the objective function is stochastic then the optimization algorithm will get close to the optimal value but then will "bounce around" because of the random terms.solution.)

 

Some articles for you to read:

Maximum likelihood estimation in SAS/IML

Optimizing a function that evaluates an integral

Optimizing a function of an integral

jan_t_lagen
Calcite | Level 5

Quick follow up question: is there a way to specify the number of iterations using "nlpnra"? I couldn't find any examples of it on the SAS forums.

 

It's not of great importance for me to get a perfect optimization so i would like to so how good it gets after a few step. further as there are some randomness in my objective function i fear this might make it hard to find a "perfect optimal solution"

Rick_SAS
SAS Super FREQ

Yes. By default, NLPNRA iterates as many as 200 times, but you can set the first element of the termination criteria vector to a smaller value, such as 25. (tc[1]=25)

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.

From The DO Loop
Want more? Visit our blog for more articles like these.
Discussion stats
  • 4 replies
  • 875 views
  • 0 likes
  • 3 in conversation