BookmarkSubscribeRSS Feed
paulstat
Calcite | Level 5

Good afternoon SAS users. I am trying to implement Fitzmaurice's hybrid model for covariance structure which is unfortunately not incorporated in PROC MIXED. It is a combination [simple addition] of CS and AR(1). So as a first step, I tried to fit these two basic models in PROC NLMIXED, but currently cannot get it to work. The Hessian is not positive definite and there are interdependencies between the parameters. Code for AR1 can be found below. I can't see anything wrong, but the output shows no standard errors for SD11 and rho although the program says it converged? Any help/ advice is most welcome. Many thanks!

*NLMIXED code for AR1;
proc nlmixed data=logUPCR_select qpoints=5 maxiter=20 maxtime=180 itdetails;
/*parameters with starting values*/
parms b0=0.3069 b1=-0.08805 b2=-0.3836 b3=-0.4900 b4=-0.4734 sigma=0.09
SD11=0.7717
rho=0.7871
;
VAR11=SD11**2;

rho21=rho**1;
rho31=rho**2;rho32=rho**1;
rho41=rho**3;rho42=rho**2;rho43=rho**1;
rho51=rho**4;rho52=rho**3;rho53=rho**2;rho54=rho**1;

bounds SD11 sigma >=0;
bounds 0<=rho<=1;

/* Linear predictor using dummy variable as in PROC MIXED */
/* 5 random effects specified to be able to model all of the covariance matrix*/
mu = b0*D0+b1*D1+b2*D2+b3*D3+b4*d4+u1+u2+u3+u4+u5;
y=logaval;

/*model*/
model y~normal(mu,sigma);
random u1 u2 u3 u4 u5~normal([0,0,0,0,0],
[VAR11,
VAR11*rho21, VAR11,
VAR11*rho31, VAR11*rho32, VAR11,
VAR11*rho41, VAR11*rho42, VAR11*rho43, VAR11,
VAR11*rho51, VAR11*rho52, VAR11*rho53, VAR11*rho54, VAR11])
subject=usubjid;
run;

 

3 REPLIES 3
jiltao
SAS Super FREQ

Your PROC NLMIXED model --

mu = b0*D0+b1*D1+b2*D2+b3*D3+b4*d4+u1+u2+u3+u4+u5;

has 5 random effects (u1 to u5) for a random intercept -- that is not appropriate. One is enough.

It is very uncommon to model the random effect variance structures using CS and/or AR(1). I suspect you wanted to model the residual variance-covariance structures (rather than the random effects variance-covariance structures) with CS and/or AR(1)? If that is the case, then PROC NLMIXED cannot help you. This procedure assumes independent error structure.

I am not sure how the "combination  of CS and AR(1)" looks. But one general covariance structure in PROC MIXED is type=lin(q). It specifies the general linear covariance structure with q parameters. This structure consists of a linear combination of known matrices that are input with the LDATA= option. It would accommodate some custom covariance structures as long as it is a linear combination. But with AR(1), it might not work.

Thanks,

Jill

 

paulstat
Calcite | Level 5

Many thanks, Jill. It is possible to have more than one random effect in NLMIXED as per the online documentation where you can use these to specify the variance-covariance matrix of the random effects, as I have tried to do. The online documentation gives examples for 2 or 3 random effects. But for the AR1 model as I specified, it does not work. Although it converges, the program sets standard errors for the random effect to zero and the "solution" it comes up with it not appropriate (the Hessian matrix is not positive definite), hence cannot be used. I do not know why this is happening. I tried other models and every time I put something off-diagonal other than zero (like trying to fit CS), the Hessian is not positive definite.   

As you say there is the possibility in MIXED to specify your own covariance matrix as long as it is linear. AR(1) is not (it is exponential), hence unfortunately I cannot use this option. 

Fitzmaurice's hybrid model which I am trying to fit is a [simple] combination [sum] of CS and AR(1) but fitting it with SAs is turning out to be challenging.   

jiltao
SAS Super FREQ

PROC NLMIXED can definitely fit more than one random effect, just not as how it is done in your model. For example, you could have one random intercept and one random slope --

mu = b0*D0+b1*D1+b2*D2+b3*D3+b4*d4+u1+u2*D1; (just to illustrate the syntax, not saying you should use this model)

not 5 random intercepts as in your model -- and that might be the reason why the results do not work for you -- the model is not specified appropriately.

I am not aware of a way to fit the AR(1)+CS covariance model in SAS/STAT procedures, unfortunately. The closest I can think of is to use the type=sp(lin) in the REPEATED statement in PROC MIXED with the LOCAL option.

Thanks,

Jill

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

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
  • 3 replies
  • 197 views
  • 0 likes
  • 2 in conversation