Date: Tue, 6 May 2008 16:38:14 -0400
Reply-To: Wensui Liu <liuwensui@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Wensui Liu <liuwensui@GMAIL.COM>
Subject: Re: Scoring nlmixed
Content-Type: text/plain; charset=ISO-8859-1
it is so simple but I just couldn't get it.
thank you so much, Dale!
On Tue, May 6, 2008 at 3:48 PM, Dale McLerran <firstname.lastname@example.org> wrote:
> --- "Dr. Eli Y. Kling" <Eli.Kling@GMAIL.COM> 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
> data combined;
> set fit_data(in=a)
> by id;
> score = b;
> proc nlmixed data=combined;
> eta = ...;
> mu = <f(eta)>;
> if score=1 then
> ll = 0;
> ll = ...;
> model y ~ general(ll) subject=id;
> random ...
> predict mu out=predicted(where=(score=1));
> 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
ChoicePoint Precision Marketing
Email : email@example.com
Blog : statcompute.spaces.live.com