Date: Tue, 14 Dec 2010 09:49:04 -0800
Reply-To: "Jordan, Lewis" <Lewis.Jordan@WEYERHAEUSER.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Jordan, Lewis" <Lewis.Jordan@WEYERHAEUSER.COM>
Subject: PROC NLMIXED - Capture Minimum Value of random effects...
In-Reply-To: <16FD64291482A34F995D2AF14A5C932C09DA8129@MAIL002.prod.ds.russell.com>
Content-Type: text/plain; charset="us-ascii"
I'm wanting to "capture" the minimum value of the random effects in a PROC NLMIXED call. I'm then going to use this minimum value to modify a likelihood function I'm working with.
However, I can not seem to "capture" the minimum random effect. Unfortunately, there is no listing in the PROC NLMIXED help referencing keywords. This is what I've come up with so far, but the values are not equivalent. I've attached a simple example with my attempts to find the minimum value of the random effect: min(bi).
Any help would be appreciated.
Lewis
*Simulate some data;
data sim;
call streaminit(281938);
do subject=1 to 50;
*random effects;
ai=rand('NORMAL',0,2);
do i=1 to 5;
*Response;
y= 5 + ai + rand('NORMAL',0,4);
output;
end;
end;
run;
*Put NLMIXED call in a macro to see "keywords"/"code listing";
options mprint symbolgen mlogic;
%macro test();
proc nlmixed data=sim lognote;
parms mu = 5 s2e = 16 s2b = 4;
*Set min_bi to some large #;
mean = Mu + bi;
model y~normal(mean,s2e);
retain min_bi 1.0E10;
*Capture minimum value of the random effects;
if bi<min_bi then min_bi=bi;
random bi~normal(0,s2b) subject=subject out=randoms;
predict mean out=preds;
id bi min_bi;
run;
*Proc means to see what the "minimum" value of bi really was,
and what the value of "min_bi" was captured as...;
proc means data=preds min;
var bi min_bi;
run;
%mend test;
%test;