Date: Tue, 6 May 2008 15:29:09 -0500
Reply-To: Tom White <tw2@MAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Tom White <tw2@MAIL.COM>
Subject: Re: Scoring nlmixed
Content-Type: text/plain; charset="iso-8859-1"
Hello, I'd like to see a similar example where one uses GLIMMIX instead
of NLMIX. Thank you. T
----- Original Message -----
From: "Dale McLerran"
To: SAS-L@LISTSERV.UGA.EDU
Subject: Re: Scoring nlmixed
Date: Tue, 6 May 2008 12:48:38 -0700
--- "Dr. Eli Y. Kling" wrote:
> Hi Guys,
>
> For reasons I will not boar you here, I prefer scoring my
predictions
> by adding the data to be socred to the training data with the
target
> field 'missing'. This works like a charm for the good old
procedures
> like Reg, GLM, and Logistic. (I know, I Know, you have the score
> procedure and the score command).
>
> I have been converting some code using proc logistic to use proc
> NLMIXED; which by the way is a cool bit of statistics and a
powerfull
> sas tool. my problem is that (to my knoledge) it does not support
> scoring in any mannor apart for the training data. I realize that
> scoring here is much more tricky as random effects are involved.
>
> For now I export the coeficiants for the fixed effects and do the
> scoring in a data step. But I am not sure what to do with the
random
> effect. Any Ideas? Any code out there to do a generic scoring for
> NLMIXED on a fresh dataset?
>
>
> P.S. I used to be very active on the old SAS-L when I lived in
Vienna
> and Denmark. Now I am in England and I am back on the sas game. A
> special Hi to anybody who still remembers me.
>
> With regard,
>
> Eli Y. Kling
>
The following approach should work as long as the data to be scored
are from the same subjects as the data used to fit the model.
Combine both fitting and scoring data into a single data set and
construct an indicator variable of the data to be scored. Then
write NLMIXED code in which you construct your likelihood function.
If the data are from the set to be scored, then set the log-
likelihood contribution to zero. That way, you will only use the
fitting data in the estimation process. You can then write a
PREDICT statement which outputs estimated response values. If you
put a WHERE clause on the output data set that restricts the data
to those which need to be scored, then you will get results only
for the data to be scored which were not used to fit the model.
To be a little more concrete, you would have something like the
following:
data combined;
set fit_data(in=a)
score_data(in=b);
by id;
score = b;
run;
proc nlmixed data=combined;
eta = ...;
mu = ;
if score=1 then
ll = 0;
else
ll = ...;
model y ~ general(ll) subject=id;
random ...
predict mu out=predicted(where=(score=1));
run;
HTH,
Dale
---------------------------------------
Dale McLerran
Fred Hutchinson Cancer Research Center
mailto: dmclerra@NO_SPAMfhcrc.org
Ph: (206) 667-2926
Fax: (206) 667-5977
---------------------------------------
____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now.
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
--
See Exclusive Video: 10th Annual Young Hollywood Awards
http://www.hollywoodlife.net/younghollywoodawards2008/