<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Simulation in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Simulation/m-p/294768#M2982</link>
    <description>&lt;P&gt;You are displaying the Monte Carlo&amp;nbsp;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.)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's how to determine what is happening:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Run the simulation with&amp;nbsp;one set of ICs and save the parameter estimates to&amp;nbsp;MLE_EST1. Then run the simulation again with the other ICs and save the estimates to MLE_EST1.&amp;nbsp;&lt;/LI&gt;
&lt;LI&gt;Plot the parameter estimates for the two runs against each other in a scatter plot.&amp;nbsp;&lt;/LI&gt;
&lt;LI&gt;For most of samples, the two estimates should fall on or near the line y=x.&amp;nbsp; For a few, you will probably see that the estimates are far from each other.&lt;/LI&gt;
&lt;LI&gt;If you label each&amp;nbsp;marker with the simulation number, that will enable you to find out which samples are leading to different estimates.&lt;/LI&gt;
&lt;LI&gt;You can then investigate the MLE function for those samples.&lt;/LI&gt;
&lt;/OL&gt;</description>
    <pubDate>Mon, 29 Aug 2016 11:45:51 GMT</pubDate>
    <dc:creator>Rick_SAS</dc:creator>
    <dc:date>2016-08-29T11:45:51Z</dc:date>
    <item>
      <title>Simulation</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Simulation/m-p/294663#M2974</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;Attached is the code I'm using to find MLEs.&lt;/P&gt;&lt;P&gt;I'm trying to find the bias and standard deviation for given parameters.&lt;/P&gt;&lt;P&gt;my problem is: whenever I changed the initial values for the parameters, I get a different answer (output).&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, if I change the initial values ( lambda30, lambda40)&amp;nbsp;from 0.1,0.1 to 0.4,0.4 , respectively, I will get different answers.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Could you figure out why?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Can you make a refinement for the code?&lt;/P&gt;&lt;P&gt;Sincere thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 29 Aug 2016 19:01:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Simulation/m-p/294663#M2974</guid>
      <dc:creator>Medo_Aldeni</dc:creator>
      <dc:date>2016-08-29T19:01:43Z</dc:date>
    </item>
    <item>
      <title>Re: Simulation</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Simulation/m-p/294671#M2975</link>
      <description>&lt;P&gt;If you haven't already read these articles, please look at&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;A href="http://blogs.sas.com/content/iml/2011/10/12/maximum-likelihood-estimation-in-sasiml.html" target="_self"&gt;MLE Estimation in SAS/IML&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A href="http://blogs.sas.com/content/iml/2016/05/11/tips-before-optimization.html" target="_self"&gt;Ten tips before you run an optimization&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;I don't seem to be able to reproduce what you are seeing. I set nr=1 and optn={1 2}.&amp;nbsp; I ran the program twice, once with initial conditions (1, 1, 0.1, 0.1) and again with (1, 1, 0.4, 0.4).&lt;/P&gt;
&lt;P&gt;I got the exact same optimum both times.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Perhaps you could post a screenshot of what you are seeing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 28 Aug 2016 23:54:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Simulation/m-p/294671#M2975</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2016-08-28T23:54:01Z</dc:date>
    </item>
    <item>
      <title>Re: Simulation</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Simulation/m-p/294672#M2976</link>
      <description>&lt;P&gt;Thank you professor.&lt;/P&gt;&lt;P&gt;Please see the attachment.&lt;/P&gt;</description>
      <pubDate>Mon, 29 Aug 2016 01:17:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Simulation/m-p/294672#M2976</guid>
      <dc:creator>Medo_Aldeni</dc:creator>
      <dc:date>2016-08-29T01:17:18Z</dc:date>
    </item>
    <item>
      <title>Re: Simulation</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Simulation/m-p/294680#M2977</link>
      <description>&lt;PRE&gt;
That is because the following code change the result:

"
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;
"






&lt;/PRE&gt;</description>
      <pubDate>Mon, 29 Aug 2016 02:15:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Simulation/m-p/294680#M2977</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-08-29T02:15:15Z</dc:date>
    </item>
    <item>
      <title>Re: Simulation</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Simulation/m-p/294683#M2978</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;SPAN&gt;Xia Keshan,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I don't think so the reason is what you have mensioned, since I defined a nother&amp;nbsp;function (lf2(x)) and I GOT THE SAME RESULTS.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I think the reason is the function itself.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Aug 2016 02:29:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Simulation/m-p/294683#M2978</guid>
      <dc:creator>Medo_Aldeni</dc:creator>
      <dc:date>2016-08-29T02:29:40Z</dc:date>
    </item>
    <item>
      <title>Re: Simulation</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Simulation/m-p/294685#M2979</link>
      <description>&lt;PRE&gt;
No. Once you change optn={1 0}; -&amp;gt; optn={1 2};  which means you can the result of call nlptr() .
After running the code with different initial value , I got the result, in other words, there must be 
some code from you to change the final result.

gamma0=1; c0=1; lambda30=0.1; lambda40=0.1;
OUTPUT:
MLE-simulation
Optimization Results
Parameter Estimates
N	Parameter	Estimate	Gradient
Objective
Function
1	X1	1.865201	0.000001331
2	X2	2.079614	0.000016103
3	X3	1.054787	0.000024134
4	X4	0.790518	0.000010652
Value of Objective Function = -313.0280387



gamma0=1; c0=1; lambda30=0.4; lambda40=0.4;
OUTPUT:
MLE-simulation
Optimization Results
Parameter Estimates
N	Parameter	Estimate	Gradient
Objective
Function
1	X1	1.865201	0.000009320
2	X2	2.079609	-0.000002477
3	X3	1.054794	-0.000003713
4	X4	0.790524	0.000008522
Value of Objective Function = -313.0280387
 
&lt;/PRE&gt;</description>
      <pubDate>Mon, 29 Aug 2016 02:50:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Simulation/m-p/294685#M2979</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-08-29T02:50:03Z</dc:date>
    </item>
    <item>
      <title>Re: Simulation</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Simulation/m-p/294687#M2980</link>
      <description>&lt;P&gt;Do you know how to fix the code in order to get correct standard dev and bias. Your help would be appreciated.&lt;/P&gt;&lt;PRE&gt;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;
"&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Aug 2016 03:23:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Simulation/m-p/294687#M2980</guid>
      <dc:creator>Medo_Aldeni</dc:creator>
      <dc:date>2016-08-29T03:23:18Z</dc:date>
    </item>
    <item>
      <title>Re: Simulation</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Simulation/m-p/294715#M2981</link>
      <description>&lt;PRE&gt;
No. I have no time to go through all these. You have to check it on your own.
I am sure  matrix  estmat[ ]  is right.

&lt;/PRE&gt;</description>
      <pubDate>Mon, 29 Aug 2016 07:46:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Simulation/m-p/294715#M2981</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-08-29T07:46:23Z</dc:date>
    </item>
    <item>
      <title>Re: Simulation</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Simulation/m-p/294768#M2982</link>
      <description>&lt;P&gt;You are displaying the Monte Carlo&amp;nbsp;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.)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's how to determine what is happening:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Run the simulation with&amp;nbsp;one set of ICs and save the parameter estimates to&amp;nbsp;MLE_EST1. Then run the simulation again with the other ICs and save the estimates to MLE_EST1.&amp;nbsp;&lt;/LI&gt;
&lt;LI&gt;Plot the parameter estimates for the two runs against each other in a scatter plot.&amp;nbsp;&lt;/LI&gt;
&lt;LI&gt;For most of samples, the two estimates should fall on or near the line y=x.&amp;nbsp; For a few, you will probably see that the estimates are far from each other.&lt;/LI&gt;
&lt;LI&gt;If you label each&amp;nbsp;marker with the simulation number, that will enable you to find out which samples are leading to different estimates.&lt;/LI&gt;
&lt;LI&gt;You can then investigate the MLE function for those samples.&lt;/LI&gt;
&lt;/OL&gt;</description>
      <pubDate>Mon, 29 Aug 2016 11:45:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Simulation/m-p/294768#M2982</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2016-08-29T11:45:51Z</dc:date>
    </item>
  </channel>
</rss>

