BookmarkSubscribeRSS Feed
diametra
Calcite | Level 5

Hi all,

 

I would like to expand on a topic that was discussed in this thread.

 

Here is the mixed-effects repeated measures model that I'm working with:

 

proc mixed data = analysis;

class SubjectID Treatment Visit;

model AVAL = Treatment Visit Treatment*Visit / s;

repeated / subject = SubjectID type = AR(1);

run;

 

There are 2 treatment groups and 4 visits (Baseline, Month 1, Month 3, and Month 6). My goal is to estimate the Percentage Change between Month 6 and Baseline for each treatment group. In this thread, PROC NLMIXED was suggested as a method to estimate for the Percentage Change. I followed the example from the thread to build the following model:

 

proc nlmixed data = analysis;

parms b0=2 b1=0.5 b2=1.2 b3=1.2 b4=1.2 b5=1.2 b6=1.2 b7=1.2 sb=2 se=1;

mu = b0 + b1*(Treatment="Active") + b2*(Visit="Month 1") + b3*(Visit="Month 3") + b4*(Visit="Month 6")

+ b5*(Treatment="Active")*(Visit="Month 1") + b6*(Treatment="Active")*(Visit="Month 3") + b7*(Treatment="Active")*(Visit="Month 6") + u;

model AVAL ~ normal(mu, se);

random u ~ normal(0, sb) subject=SubjectID;

estimate 'Percentage Difference between Month 6 and Baseline for Active' ((b4 + b7)/(b0 + b1))*100;

run;

 

My question is: How would I specify the AR(1) covariance structure as I did in PROC MIXED using PROC NLMIXED?

 

Any help or suggestions would be greatly appreciated!

 

Best,

Diana

4 REPLIES 4
diametra
Calcite | Level 5

Additional info:

 

I've reviewed the example in this paper: https://www.lexjansen.com/wuss/2013/47_Paper.pdf

 

It described the setup for the First-Order Autoregressive covariance structure (page 3), but the example that they have is a lot more complicated than my model. I don't know how to translate this into my use case (which is a linear model). Additionally, the data in the example from the paper is in a wide (cases by variables) format, which further confuses me.

jiltao
SAS Super FREQ

1. AR(1) is often used in the REPEATED statement in PROC MIXED.

There is no REPEATED statement in PROC NLMIXED. The RANDOM statement in PROC NLMIXED is like fitting a random coefficients model, and AR(1) is almost never used to model the covariance between random intercept and slopes.

2. If for a reason beyond my understanding, you have to specify an AR(1) structure in PROC NLMIXED, then

you would need to have at least 3 random effects (u0, u1, and u2) in order for AR(1) to make sense. For example,

random u0 u1 u2 ~ normal([0, 0, 0],[s2, s2*rho, s2, s2*rho**2, s2*rho, s2]) subject=subject;

where s2 and rho are your model parameters.

 

Hope this helps,

Jill 

lcw68
Calcite | Level 5

Hi, if I have a correlated longitudinal model with one continuous outcome and one ordinal outcome (using probit normal to define category), say y1it = Xalphai + b1i + e_{1it}, y2it (latent normal) = Xbetai + b2i+e_{2it}, (b1i,b2i) are bivariate normal distribution, and (e_{1it},e_{2it})are random error that also have bivariate normal distribution (correlated). (the variance parameter is  (sigcon, rhoe*sigcon*sigord, sigord)). How should I specify the "rhoe" here? I attach my SAS code here.

 

PROC NLMIXED data=auto2 qpoints=10 tech = NMSIMP corr ecorr;
PARMS beta0=6 beta1=-3 beta2=0 alpha0=25
alpha1=-10 alpha2=-1 sigcon = 2 sigor = 3 rhob=0.3 i1 = 2 i2=2 rhoe = 0.4;
bounds i1 > 0, i2 > 0;
if variable="continuous" then do;
pi=constant("pi");
m1=alpha0+alpha1*trt+alpha2*time+z1;
LL1=((-0.5)*log(2*pi*sigcon*sigcon)-((value1-m1)**2)/
(2*sigcon*sigcon));
END;
if variable="ordinal" then do;
eta = beta0+beta1*trt+beta2*time+z2;
if (value1=1) then p = probnorm(-eta/sigor);
else if (value1=2) then
p = probnorm((i1-eta)/sigor) - probnorm(-eta/sigor);
else if (value1=3) then
p = probnorm((i1+i2-eta)/sigor) - probnorm((i1-eta)/sigor);
else p = 1 - probnorm((i1+i2-eta)/sigor);
if (p > 1e-8) then LL2 = log(p);
else LL2 = -1e20;
END;
LL=LL1+LL2;
MODEL value1 ~ GENERAL(LL);
RANDOM z1 z2 ~ NORMAL([0,0],[1,rhob,1]) SUBJECT=id;
estimate "sigma2" sigor*sigor;
ods output ParameterEstimates=pars;
ods output FitStatistics=aic;
RUN;

 

My question is where should I specify rhoe here? I thought it should be similar like type = "un"...

sbxkoenk
SAS Super FREQ

Hello,

 

Previous reply by @lcw68 can be neglected.

@lcw68 has rightfully opened a new post (new topic) in this board with his / her question.

 

See:

How to incorporate correlation between random error (epsilon) in proc nlmixed joint MMRM model?
https://communities.sas.com/t5/Statistical-Procedures/How-to-incorporate-correlation-between-random-...

 

Koen

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 1215 views
  • 6 likes
  • 4 in conversation