<?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 Random effect estimates (Proc nlmixed) in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/Random-effect-estimates-Proc-nlmixed/m-p/789155#M38686</link>
    <description>&lt;P&gt;Dear all&lt;/P&gt;&lt;P&gt;I&amp;nbsp;&lt;SPAN&gt;am trying to run a proc nlmixed program. I&lt;/SPAN&gt; have to estimate random effects to&amp;nbsp;assess goodness of fit.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. How can I estimate&amp;nbsp;random effects for each individual in proc nlmixed?&lt;/P&gt;&lt;P&gt;2. Is it possible to use empirical bayes approach&lt;SPAN style="font-family: inherit;"&gt;&amp;nbsp;for this purpose in sas?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 09 Jan 2022 18:31:37 GMT</pubDate>
    <dc:creator>Yeganeh</dc:creator>
    <dc:date>2022-01-09T18:31:37Z</dc:date>
    <item>
      <title>Random effect estimates (Proc nlmixed)</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Random-effect-estimates-Proc-nlmixed/m-p/789155#M38686</link>
      <description>&lt;P&gt;Dear all&lt;/P&gt;&lt;P&gt;I&amp;nbsp;&lt;SPAN&gt;am trying to run a proc nlmixed program. I&lt;/SPAN&gt; have to estimate random effects to&amp;nbsp;assess goodness of fit.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. How can I estimate&amp;nbsp;random effects for each individual in proc nlmixed?&lt;/P&gt;&lt;P&gt;2. Is it possible to use empirical bayes approach&lt;SPAN style="font-family: inherit;"&gt;&amp;nbsp;for this purpose in sas?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 09 Jan 2022 18:31:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Random-effect-estimates-Proc-nlmixed/m-p/789155#M38686</guid>
      <dc:creator>Yeganeh</dc:creator>
      <dc:date>2022-01-09T18:31:37Z</dc:date>
    </item>
    <item>
      <title>Re: Random effect estimates (Proc nlmixed)</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Random-effect-estimates-Proc-nlmixed/m-p/789168#M38687</link>
      <description>&lt;P&gt;I assume you have repeated measurements?&lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/v_013/statug/statug_nlmixed_gettingstarted01.htm" target="_self"&gt; The Getting Started example in the doc&lt;/A&gt; shows how to estimate random effects for a bunch of trees, where each tree has seven measurements. The basic syntax is&amp;nbsp;&lt;/P&gt;
&lt;P&gt;RANDOM x&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;~&lt;/SPAN&gt; &lt;FONT color="#000000"&gt;&lt;SPAN class="token function keyword"&gt;normal&lt;/SPAN&gt;&lt;/FONT&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;0&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;s2&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN&gt; SUBJECT&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;SubjectID&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000000"&gt;&lt;SPAN class="token punctuation"&gt;where x is the&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;random effect, which is assumed to be normally distributed with variance s2. The parameter s2 is included in the PARMS statement and is estimated from the data.&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#000000"&gt;&lt;SPAN class="token punctuation"&gt;&amp;gt;&amp;nbsp;2. Is it possible to use empirical bayes approach&amp;nbsp;for this purpose in sas?&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#000000"&gt;&lt;SPAN class="token punctuation"&gt;Can you explain what you are trying to accomplish? It would be helpful to see some code, some data, or both.&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 09 Jan 2022 20:04:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Random-effect-estimates-Proc-nlmixed/m-p/789168#M38687</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2022-01-09T20:04:37Z</dc:date>
    </item>
    <item>
      <title>Re: Random effect estimates (Proc nlmixed)</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Random-effect-estimates-Proc-nlmixed/m-p/789171#M38688</link>
      <description>&lt;P&gt;I have&amp;nbsp;&lt;SPAN&gt;repeated measurements of count data and want to show&amp;nbsp;violation of homogeneous random effects in sex or other known collected factors in the data.&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;I have no code for it&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 09 Jan 2022 20:56:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Random-effect-estimates-Proc-nlmixed/m-p/789171#M38688</guid>
      <dc:creator>Yeganeh</dc:creator>
      <dc:date>2022-01-09T20:56:48Z</dc:date>
    </item>
    <item>
      <title>Re: Random effect estimates (Proc nlmixed)</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Random-effect-estimates-Proc-nlmixed/m-p/789180#M38689</link>
      <description>&lt;P&gt;If you post some sample data and the model you are trying to fit, we might be able to help you construct the PROC NLMIXED code.&amp;nbsp;I might be misunderstanding your statement, but sex is usually treated as a fixed effect.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jan 2022 00:44:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Random-effect-estimates-Proc-nlmixed/m-p/789180#M38689</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2022-01-10T00:44:53Z</dc:date>
    </item>
    <item>
      <title>Re: Random effect estimates (Proc nlmixed)</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Random-effect-estimates-Proc-nlmixed/m-p/789184#M38690</link>
      <description>&lt;P&gt;Proc nlmixed &amp;nbsp;maxiter=10000;&lt;/P&gt;
&lt;P&gt;Parms b0=1 , b1=0 , b2=0 , b3=0 , a0= 1, g0=1 , V_u1=1;&lt;/P&gt;
&lt;P&gt;Aialpha=a0;&lt;/P&gt;
&lt;P&gt;Gigamma=g0;&lt;/P&gt;
&lt;P&gt;Bibeta= b0 + b1*x1 + b2 *x2 + b3*time;&lt;/P&gt;
&lt;P&gt;Lambda=exp(b0 + b1*x1 + b2* x2 + b3*time + u1);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;P1= exp(Aialpha) / (1+ exp(Aialpha) + exp (Gigamma));&lt;/P&gt;
&lt;P&gt;P2= exp(Gigamma) / (1+ exp(Gigamma) + exp (Aialpha));&lt;/P&gt;
&lt;P&gt;P3=1-p1-p2;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If y=0 then ll = log (p1 + p3*exp(-lambda));&lt;/P&gt;
&lt;P&gt;If y=1 then ll= log (p2 + p3*(1)*exp(-lambda)* lambda);&lt;/P&gt;
&lt;P&gt;If y&amp;gt;1 then ll= log(p3) – lambda + y*log(lambda) – lgamma (y+1);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Model y ~ general (ll);&lt;/P&gt;
&lt;P&gt;Random u1 ~ normal (0, [v_u1]) subject=id;&lt;/P&gt;
&lt;P&gt;Run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I need to estimate u1 for&amp;nbsp;&lt;SPAN&gt;each individual. then to&amp;nbsp;assess goodness of fit, I want to draw qq plot&amp;nbsp;of the random effects in the Poisson and inflated parts of the model by gender group.&amp;nbsp;In a well-fitted model, the distribution of estimated random effects (in each model part) should lie along the line y=x. I couldn't find a code for this problem, Could you help me construct a code for it, please?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thank you&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jan 2022 08:23:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Random-effect-estimates-Proc-nlmixed/m-p/789184#M38690</guid>
      <dc:creator>Yeganeh</dc:creator>
      <dc:date>2022-01-11T08:23:17Z</dc:date>
    </item>
    <item>
      <title>Re: Random effect estimates (Proc nlmixed)</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Random-effect-estimates-Proc-nlmixed/m-p/789276#M38696</link>
      <description>&lt;P&gt;I do not think it is possible to estimate separate variance for each subject.&lt;/P&gt;
&lt;P&gt;If you want to estimate different variance for each gender (valued 0/1), you might do something like the following --&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Proc nlmixed &amp;nbsp;maxiter=10000;&lt;/P&gt;
&lt;P&gt;Parms b0=1 , b1=0 , b2=0 , b3=0 , a0= 1, g0=1 , &lt;FONT color="#000000"&gt;V_u0=1&lt;/FONT&gt;, V_u1=1;&lt;/P&gt;
&lt;P&gt;Aialpha=a0;&lt;/P&gt;
&lt;P&gt;Gigamma=g0;&lt;/P&gt;
&lt;P&gt;Bibeta= b0 + b1*x1 + b2 *x2 + b3*time;&lt;/P&gt;
&lt;P&gt;Lambda=exp(b0 + b1*x1 + b2* x2 + b3*time + +u0+u1*gender);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;P1= exp(Aialpha) / (1+ exp(Aialpha) + exp (Gigamma));&lt;/P&gt;
&lt;P&gt;P2= exp(Gigamma) / (1+ exp(Gigamma) + exp (Aialpha));&lt;/P&gt;
&lt;P&gt;P3=1-p1-p2;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If y=0 then ll = log (p1 + p3*exp(-lambda));&lt;/P&gt;
&lt;P&gt;If y=1 then ll= log (p2 + p3*(1)*exp(-lambda)* lambda);&lt;/P&gt;
&lt;P&gt;If y&amp;gt;1 then ll= log(p3) – lambda + y*log(lambda) – lgamma (y+1);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Model y ~ general (ll);&lt;/P&gt;
&lt;P&gt;Random u0 u1 ~ normal ([0,0], [v_u0, 0, v_u1]) subject=id;&lt;/P&gt;
&lt;P&gt;Run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The random effects estimates are by definition the empirical Bayes estimates. You can use the OUT= option in the RANDOM statement to get these estimates in the OUT= data set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps,&lt;/P&gt;
&lt;P&gt;Jill&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jan 2022 15:52:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Random-effect-estimates-Proc-nlmixed/m-p/789276#M38696</guid>
      <dc:creator>jiltao</dc:creator>
      <dc:date>2022-01-10T15:52:49Z</dc:date>
    </item>
    <item>
      <title>Re: Random effect estimates (Proc nlmixed)</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Random-effect-estimates-Proc-nlmixed/m-p/789283#M38697</link>
      <description>&lt;P&gt;Thank you for posting your code. On the RANDOM statement, you can use the OUT= option to output the estimates of the random effects for each subject. The code will look like&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Random u1 ~ normal (0, v_u1) subject=id &lt;STRONG&gt;OUT=RandomOut&lt;/STRONG&gt;;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Your code doesn't include any information about gender, but it sounds like you want to create two QQ plots, one for males and one for females. You will need to merge the RandomOut data set (which contains the estimates for each ID) and data that says which IDs are male and which are females. Then create the QQ plot for each.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Suppose WANT is the name of the data set that merges the RandomOut estimates and the genders. Then you get the QQ plots from PROC UNIVARIATE by running:&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=Want; by Sex; run;

proc univariate data=Want(where=(Effect='u1'));
by Sex;
var Estimate;     /* the estimate for u1 for each subject */
qqplot Estimate;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;That will create a data set that contains the estimates. You can then&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jan 2022 16:04:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Random-effect-estimates-Proc-nlmixed/m-p/789283#M38697</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2022-01-10T16:04:40Z</dc:date>
    </item>
    <item>
      <title>Re: Random effect estimates (Proc nlmixed)</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Random-effect-estimates-Proc-nlmixed/m-p/789360#M38704</link>
      <description>&lt;P&gt;Thanks &lt;SPAN&gt;Jill&amp;nbsp;&lt;/SPAN&gt;for the detailed reply.&lt;/P&gt;&lt;P&gt;Thank you for the all answers.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jan 2022 20:52:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Random-effect-estimates-Proc-nlmixed/m-p/789360#M38704</guid>
      <dc:creator>Yeganeh</dc:creator>
      <dc:date>2022-01-10T20:52:40Z</dc:date>
    </item>
  </channel>
</rss>

