```Date: Tue, 12 Feb 2008 20:04:53 -0800 Reply-To: Dale McLerran Sender: "SAS(r) Discussion" From: Dale McLerran Subject: Re: More NLMIXED In-Reply-To: <200802122125.m1CHAdpr012355@mailgw.cc.uga.edu> Content-Type: text/plain; charset=iso-8859-1 --- IKF wrote: > Hello, > > I think that maybe what I want will be a random intercept and a > random > slope in my nlmixed. I found a post which suggests this, but I can't > get > it to work - my understanding of matrices is nill! > > This is what I have...I figure something in here needs to be > specified > more clearly...Please help...Babyagedays is my time variable, so I'm > not > even sure if I should be doing this...Thanks... > > > proc nlmixed data=pneumo1; > parms b0=-2.5 b1=0 b2=0 b3=0 s0=0 s1=0; > teta = b0 + b1*babyagedays + b2*babyagedays1 + b3*babyagedays2 + g0 > + > g1*babyagedays; > p = exp(teta) / (1 + exp(teta)); > model culture ~ binary(p); > random g0 g1 ~ normal([0,0], > [exp(2*log_s0), > rho*exp(log_s0+log_s1), > exp(2*log_s1)]) subject=pin; > run; > IGF, This is close to how one would code NLMIXED for a binary response with random slope and intercept. There is one piece which you are missing. The term RHO represents a correlation. Of course, a correlation needs to be restricted to have a value over the interval (-1,1). Your code places no constraints on RHO. That is, your code would allow RHO on (-inf,inf). In order to restrict RHO to (-1,1), we can use an inverse Fisher Z transformation. Given a parameter Z on (-inf,inf) and RHO constructed as RHO = (exp(2*Z) - 1) / (exp(2*Z) + 1); then RHO will be restricted to (-1,1). Complete code for your model would then be proc nlmixed data=pneumo1; parms b0=-2.5 b1=0 b2=0 b3=0 s0=0 s1=0 z=0; teta = b0 + b1*babyagedays + b2*babyagedays1 + b3*babyagedays2 + g0 + g1*babyagedays; p = exp(teta) / (1 + exp(teta)); rho = (exp(2*Z) - 1) / (exp(2*Z) + 1); model culture ~ binary(p); random g0 g1 ~ normal([0,0], [exp(2*log_s0), rho*exp(log_s0+log_s1), exp(2*log_s1)]) subject=pin; 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 ```

Back to: Top of message | Previous page | Main SAS-L page