Date: Wed, 25 Jun 2008 23:07:08 -0700
Reply-To: stringplayer_2@yahoo.com
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Dale McLerran <stringplayer_2@YAHOO.COM>
Subject: Re: nlmixed for random coefficient model
In-Reply-To: <6e32250a-416c-4515-8e1a-ec107a77a764@26g2000hsk.googlegroups.com>
Content-Type: text/plain; charset=us-ascii
--- On Wed, 6/25/08, inbox@MYSATURDAYSELF.COM <inbox@MYSATURDAYSELF.COM> wrote:
> From: inbox@MYSATURDAYSELF.COM <inbox@MYSATURDAYSELF.COM>
> Subject: nlmixed for random coefficient model
> To: SAS-L@LISTSERV.UGA.EDU
> Date: Wednesday, June 25, 2008, 8:51 PM
>
> Hi all, I am using nlmixed for random coefficient model, it's a linear
> regression model y=alpha+beta*x+theta, so I suppose all i should do
> is add a line with
>
> random theta~normal(0,sigma**2) subject=id
>
> is this right? Thanks
Well, we don't see all of your code. I presume that you have a couple
of statements something like
eta = alpha + beta*x + theta;
y ~ normal(eta, sigma_error**2);
If you have such code, then adding your RANDOM statement as specified
above should be all that you would need. Note, though, that I prefer
to parameterize the models such that the square root of the variance
must be positive. There is no such constraint with the
parameterization on either the RANDOM or MODEL statements shown
above. However, it is easy to revise the code such that the square
root of the variance is positive. The code below is how I would
write my statements:
proc nlmixed data=mydata;
eta = alpha + beta*x + theta;
model y ~ normal(eta, exp(2*log_sigma_err));
random theta ~ normal(0, exp(2*log_sigma_theta)) subject=id;
run;
Now, even if log_sigma_err or log_sigma_theta is negative, the square
root of the variance is positive.
But why are you using NLMIXED for this model instead of the MIXED
procedure? The MIXED procedure is really preferable for a situation
where you have a Gaussian response.
Dale
---------------------------------------
Dale McLerran
Fred Hutchinson Cancer Research Center
mailto: dmclerra@NO_SPAMfhcrc.org
Ph: (206) 667-2926
Fax: (206) 667-5977
---------------------------------------