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 08-28-2016 05:28 PM
(1467 views)

Hello,

Attached is the code I'm using to find MLEs.

I'm trying to find the bias and standard deviation for given parameters.

my problem is: whenever I changed the initial values for the parameters, I get a different answer (output).

For example, if I change the initial values ( lambda30, lambda40) from 0.1,0.1 to 0.4,0.4 , respectively, I will get different answers.

Could you figure out why?

Can you make a refinement for the code?

Sincere thanks!

8 REPLIES 8

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

If you haven't already read these articles, please look at

I don't seem to be able to reproduce what you are seeing. I set nr=1 and optn={1 2}. I ran the program twice, once with initial conditions (1, 1, 0.1, 0.1) and again with (1, 1, 0.4, 0.4).

I got the exact same optimum both times.

Perhaps you could post a screenshot of what you are seeing.

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

Thank you professor.

Please see the attachment.

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

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

Hello Xia Keshan,

I don't think so the reason is what you have mensioned, since I defined a nother function (lf2(x)) and I GOT THE SAME RESULTS.

I think the reason is the function itself.

Thanks!

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

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

Do you know how to fix the code in order to get correct standard dev and bias. Your help would be appreciated.

parest=estmat[:,]; gamma_mle=parest[1]; c_mle=parest[2]; lm3_mle=parest[3]; lm4_mle=parest[4]; gamma_bias=gammav-gamma_mle; c_bias=cv-c_mle; lm3_bias=lambda3v-lm3_mle; lm4_bias=lambda4v-lm4_mle; onev=j(nrow(estmat),1,1); devv=(estmat-onev*parest)#(estmat-onev*parest); varr=devv[+,]/(nrow(estmat)-1); stdev=sqrt(varr); gamma_sd=stdev[1]; c_sd=stdev[2]; lm3_sd=stdev[3]; lm4_sd=stdev[4]; res1[nc,]=lambda4v||cv||gammav||lambda3v||gamma_bias||gamma_sd||lm3_bias||lm3_sd||c_bias||c_sd||lm4_bias||lm4_sd; "

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

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

You are displaying the Monte Carlo means of the parameter estimates. Means are, of course, not robust statistics, so this could be caused by a small number of random samples for which one initial conditions (ICs) converges and the other does not (or converges to a different local maximum.)

Here's how to determine what is happening:

- Run the simulation with one set of ICs and save the parameter estimates to MLE_EST1. Then run the simulation again with the other ICs and save the estimates to MLE_EST1.
- Plot the parameter estimates for the two runs against each other in a scatter plot.
- For most of samples, the two estimates should fall on or near the line y=x. For a few, you will probably see that the estimates are far from each other.
- If you label each marker with the simulation number, that will enable you to find out which samples are leading to different estimates.
- You can then investigate the MLE function for those samples.

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

**If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. **

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.