Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Options

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Posted 04-27-2010 11:50 AM
(914 views)

I am trying to maximize a likelihood for independent founders using OPTMODEL (I have already written the code to perform a simple grid search but want something quicker). I have a dataset QTp with only one variable (also called QTp). Is the following code valid?

proc optmodel;

set S;

number t{S};

var q GE 0 init 0.5;

var muaa init 0;

var muab init 0;

var mubb init 0;

var sigma>=0.000001 init 0.05;

max logl= sum{i in S} LOG(1/(SQRT(2*3.14)*sigma))+

sum{i in S} LOG(((1-q)**2)*(EXP(-((t*-muaa)**2)/(2*((sigma)**2)))+ (2*q*(1-q))*EXP(-((t**-muab)**2)/(2*((sigma)**2)))+*

((q)**2)*EXP(-((t*-mubb)**2)/(2*((sigma)**2))));*

read data QTp into S=[_n_] t=QTp;

solve with nlpc / tech=cgr printfreq=1 maxiter=5000;

print q sigma muaa muab mubb;

quit;

Message was edited by: jpunch

I also want q LE 1 but can't put it in the text window. Thanks.

Message was edited by: jpunch Message was edited by: jpunch

proc optmodel;

set S;

number t{S};

var q GE 0 init 0.5;

var muaa init 0;

var muab init 0;

var mubb init 0;

var sigma>=0.000001 init 0.05;

max logl= sum{i in S} LOG(1/(SQRT(2*3.14)*sigma))+

sum{i in S} LOG(((1-q)**2)*(EXP(-((t

((q)**2)*EXP(-((t

read data QTp into S=[_n_] t=QTp;

solve with nlpc / tech=cgr printfreq=1 maxiter=5000;

print q sigma muaa muab mubb;

quit;

Message was edited by: jpunch

I also want q LE 1 but can't put it in the text window. Thanks.

Message was edited by: jpunch Message was edited by: jpunch

1 REPLY 1

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

There were several parentheses that were missing.

If you try the following code you should not get any syntax errors:

proc optmodel;

set S;

number t{S};

var q >= 0 <= 1 init 0.5;

var muaa init 0;

var muab init 0;

var mubb init 0;

var sigma>=0.000001 init 0.05;

max log= sum{i in S}

LOG(1/(SQRT(2*3.14)*sigma)

)

+

sum{i in S}

LOG(

((1-q)**2)*

(EXP(

-((t*-muaa)**2)/(2*((sigma)**2)))*

+

(2*q*(1-q))*EXP(

-((t*-muab)**2)/(2*((sigma)**2))*

)

+

((q)**2)*EXP(

-((t*-mubb)**2)/(2*((sigma)**2))*

)

)

);

read data QTp into S=[_n_] t=QTp;

solve with nlpc / tech=cgr printfreq=1 maxiter=5000;

print q sigma muaa muab mubb;

quit;

If you try the following code you should not get any syntax errors:

proc optmodel;

set S;

number t{S};

var q >= 0 <= 1 init 0.5;

var muaa init 0;

var muab init 0;

var mubb init 0;

var sigma>=0.000001 init 0.05;

max log= sum{i in S}

LOG(1/(SQRT(2*3.14)*sigma)

)

+

sum{i in S}

LOG(

((1-q)**2)*

(EXP(

-((t

+

(2*q*(1-q))*EXP(

-((t

)

+

((q)**2)*EXP(

-((t

)

)

);

read data QTp into S=[_n_] t=QTp;

solve with nlpc / tech=cgr printfreq=1 maxiter=5000;

print q sigma muaa muab mubb;

quit;

Are you ready for the spotlight? We're accepting content ideas for **SAS Innovate 2025** to be held May 6-9 in Orlando, FL. The call is **open **until September 25. Read more here about **why** you should contribute and **what is in it** for you!

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.