```Date: Mon, 23 Sep 2002 11:22:03 -0700 Reply-To: Dale McLerran Sender: "SAS(r) Discussion" From: Dale McLerran Subject: Re: NLMIXED vs GENMOD Comments: To: Silvano Cesar da Costa In-Reply-To: Content-Type: text/plain; charset=us-ascii Silvano, Yes, I believe that it is possible to construct a model in which the errors have a type=AR(1) covariance structure. However, there are some difficulties associated with fitting an AR(1) covariance structure, and it becomes considerably more work. Let's examine a gaussian error problem. For the i-th subject, suppose that we have yi1 = Xi1*beta + ei1 yi2 = Xi2*beta + ei2 yi3 = Xi3*beta + ei3 ei1 ( 0 | V V*r V*r^2 | ) ei2 ~ N( 0 , | V*r V V*r | ) ei3 ( 0 | V*r^2 v*r V | ) Now, NLMIXED only allows a residual variance structure of the form V*I where I is the identity matrix. But, suppose that we rewrite the model as yi1 = Xi1*beta + bi1 + ei1 yi2 = Xi2*beta + bi2 + ei2 yi3 = Xi3*beta + bi3 + ei3 where bi1, bi2, bi3 are random intercept terms and the ei1, ei2, ei3 are random disturbance terms. It is immediately clear that the random intercept terms and the random disturbance terms are measuring essentially identical structures, although when a different set of restrictions are added to the covariances of the random intercepts and disturbances, then the bi's and ei's are not identical. Now, suppose that we were to restrict the ei's to have variance=0. Then, we would have the model yi1 = Xi1*beta + bi1 yi2 = Xi2*beta + bi2 yi3 = Xi3*beta + bi3 Essentially, we can replace random disturbance terms with random intercept terms. We do have control over the covariance structure of random intercept terms. We can specify an AR(1) structure for the covariance of the bi's. So, how would one go about fitting an AR(1) structure for a strictly gaussian problem. Suppose that we have the variable TIME in our dataset, and that there are at most three observation periods for any subject. Furthermore, let time take on the values 1, 2, or 3. One might try proc nlmixed data=mydata; array bi {3}; eta = beta0 + beta1*x1 + bi{time}; model y ~ Normal(eta,0); random bi1 bi2 bi3 ~ normal([0,0,0], [V, V*r, V*(r**2), V, V*r, V]) subject=ID; run; Now, there could be problems with this code if sigma=0 is employed as a divisor in the normal density. It would seem to me that the variance should be the residual variance (=0) plus the random intercept variance (V), but I don't know exactly how this is parameterized, so don't be surprised if the above code fails. However, one could always construct his/her own likelihood and use the general log-likelihood construction for fitting the model. Thus, one could write proc nlmixed data=mydata; array bi {3}; eta = beta0 + beta1*x1 + bi{time}; density = pdf('Normal', y, eta, sqrt(V)); loglike = log(density); model y ~ general(loglike); random bi1 bi2 bi3 ~ normal([0,0,0], [V, V*r, V*(r**2), V, V*r, V]) subject=ID; run; Of course, the straightforward way of fitting a type=AR(1) covariance structure for a gaussian errors problem is to use PROC MIXED. But by laying out an NLMIXED solution, perhaps it will lead you to an understanding of how you might construct a model with bi covariance structure AR(1) for other error distributions. Perhaps, also, it will assist you in understanding that the GEE model, which operates on the error correlation structure directly, is different from the random effects model. With the exception of a gaussian error structure, when you fit a generalized linear mixed model the variance is a function of eta. Now, suppose that we had just an intercept only model which was fit for a binary response. We have etai1 = mu + bi1 etai2 = mu + bi2 etai3 = mu + bi3 pi1 = exp(etai1) / (1 + exp(etai1)) pi2 = exp(etai2) / (1 + exp(etai2)) pi3 = exp(etai3) / (1 + exp(etai3)) V(Yi1) = pi1 * (1 - pi1) V(Yi2) = pi2 * (1 - pi2) V(Yi3) = pi3 * (1 - pi3) When fitting a GEE using GENMOD, the terms V(Yij) have correlation modeled according to the AR(1) structure. In the nonlinear mixed model, it is the terms bij which have covariance modeled as AR(1). Now, even if you model the covariance of the bi's so that they exhibit AR(1) structure, the variance of the response will not have AR(1) structure. Actually, this same is true for type=CS. The AR(1) or CS structure is imposed on different parts of the model. This is just one way in which GEE and nonlinear mixed models are fundamentally different. Dale --- Silvano Cesar da Costa wrote: > Dear Professor Dale, > > Your explications were wonderfull. Thanks a lot. > > The question/answer 3 was: > > > 3) If I have longitudinal data I use Genmod with Repeated option to > > fit it. How can I to do this with Nlmixed???? > > > A type=CS analysis can be obtained by adding a random intercept > term > > to eta in the nlmixed code. > > But, suppose that I want a Type=AR(1) analysis. Can I to do this with > NLMIXED???? > > Thanks, > > Silvano. ===== --------------------------------------- Dale McLerran Fred Hutchinson Cancer Research Center mailto: dmclerra@fhcrc.org Ph: (206) 667-2926 Fax: (206) 667-5977 --------------------------------------- __________________________________________________ Do you Yahoo!? New DSL Internet Access from SBC & Yahoo! http://sbc.yahoo.com ```

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