BookmarkSubscribeRSS Feed
Fluorite | Level 6

Hi all,


I'm using PROC NLMIXED to generate a multivariate mixed-effects model. The data is rather complex and is in a "stacked" format like this:




the SUBID variable identifies the subject and the Response variable consists of the QRTS (quantitative task) and VRTS (verbal task) variables literally stacked on top of each other. The TimeV and TimeQ variables denote the Time for each task.


I am not only interested in the fixed/random effects for the quantitative and verbal tasks separately, but I am most interested in the joint covariances between the random effects for the tasks.


I am posting this in this board because I think that my problem is in the programming statements in my syntax, and not in the statistics. Here is the code I used to try to fit the model:


*multivariate structured latent curve model combining the quant and verbal scores using PROC NLMIXED*;
proc nlmixed data = combined method = gauss noad gconv = 0;

	parms aV = 7 bV = 7 rV = -.7 s2V var_aV cov_aVbV var_bV
		  cov_aVrV cov_bVrV var_rV
		  aQ = 8 bQ = 8 rQ = -.7 s2Q var_aQ cov_aQbQ var_bQ
		  cov_aQrQ cov_bQrQ var_rQ
		  cov_aVaQ cov_aVbQ cov_aVrQ cov_bVaQ cov_bVbQ 
		  cov_bVrQ cov_rVaQ cov_rVbQ cov_rVrQ = .1; 
		  *aQ = a parameter for quant*; *bQ = b parameter for quant*; *rQ = r parameter for quant*;
		  *aV = v parameter for verbal*; *bV = b parameter for verbal*; *rV = r parameter for verbal*;;

	pi = arcos(-1);

	n0Q = aQ + z0Q; n1Q = bQ + z1Q; n2Q = z2Q; *fixed plus random for quantitative*;
	basis0Q = 1-exp(-rQ*(Time-1)); basis1Q = exp(-rQ*(Time-1)); basis2Q = (aQ-bQ)*(Time-1)*exp(-rQ*(Time-1));
	basis3Q = 0; basis4Q = 0; basis5Q = 0;
	*basis functions for quantitative*;

	n0V = aV + z0V; n1V = bV + z1V; n2V = z2V; *fixed plus random for verbal*;
	basis0V = 1-exp(-rV*(Time-1)); basis1V = exp(-rV*(Time-1)); basis2V = (aV-bV)*(Time-1)*exp(-rV*(Time-1));
	basis3V = 0; basis4V = 0; basis5V = 0;
	*basis functions for verbal*;

	if Type = "Q" then do;
	predvQ = n0Q*basis0Q + n1Q*basis1Q + n2Q*basis2Q;
	llQ = (-1/2)*(log(2*pi) + (((QRTS - predvQ)**2)/s2Q) + log(s2Q)); end;

	else if Type = "V" then do; predvV = n0V*basis0V + n1V*basis1V + n2V*basis2V;
	llV = (-1/2)*(log(2*pi) + (((VRTS - predvV)**2)/s2V) + log(s2V)); end;

	ll = llQ + llV;

	model Response ~ general(ll);

	random z0Q z1Q z2Q z0V z1V z2V ~ normal([0,0,0,0,0,0], 
	[var_aQ, cov_aQbQ, var_bQ, cov_aQrQ, cov_bQrQ, var_rQ, 
	cov_aVaQ, cov_aVbQ, cov_aVrQ, cov_bVaQ, cov_bVbQ, cov_bVrQ,
	cov_rVaQ, cov_rVbQ, cov_rVrQ,
	var_aV, cov_aVbV, var_bV, cov_aVrV, cov_bVrV, var_rV]) subject = SUBID;


Any and all help is appreciated. Thanks.


This has nothing to do with the SAS/IML language. I suggest you move the post to the Statistical Procedures Community. (Or I can move it if you can't.)

Fluorite | Level 6

Hi Rick,


Apologies for posting this in the IML board. I thought it appropriate because I was having problems with the way I was inducing the matrices in PROC NLMIXED.


I had posted this in the statistical procedures board earlier and I wanted to see if the problem was with the programming statements. Do you think you could comb through the code I posted and see if there's a problem with the programming? On the stat procedures board, they said the problem was that the model was too complex for the data but I do not think that is the problem.


I have nothing to contribute. I am not an expert on complex mixed models.

Fluorite | Level 6

Okay, thank you for your time anyway.




The early bird rate has been extended! Register by March 18 for just $695 - $100 off the standard rate.


Check out the agenda and get ready for a jam-packed event featuring workshops, super demos, breakout sessions, roundtables, inspiring keynotes and incredible networking events. 


Register now!

Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.

From The DO Loop
Want more? Visit our blog for more articles like these.
Discussion stats
  • 4 replies
  • 2 in conversation