Hi all, I'm analyzing a longitudinal dataset that examines a quantitative and verbal task across 12 time points. I first fit a nonlinear mixed model to each task separately. However, my goal is to fit a multivariate model that estimates the covariances of the random effects between the tasks. The dataset looks like this for 1 subject (and part of subject 2): The SUBID variable identifies the participant. The Response variable the dependent variable that consists of literally stacking the QRTS and VRTS variables. The TimeQ and TimeV variables denote the time points for the quantitative and verbal tasks, respectively. The Type variable denotes whether or not the task is quantitative or verbal. Here is the code I used to fit the multivariate model: *multivariate structured latent curve model combining the quant and verbal scores using PROC NLMIXED*;
proc nlmixed data = combined method = gauss 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 = -.7s2Q 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*(TimeQ-1)); basis1Q = exp(-rQ*(TimeQ-1)); basis2Q = (aQ-bQ)*(TimeQ-1)*exp(-rQ*(TimeQ-1));
*basis functions for quantitative*;
n0V = aV + z0V; n1V = bV + z1V; n2V = z2V; *fixed plus random for verbal*;
basis0V = 1-exp(-rV*(TimeV-1)); basis1V = exp(-rV*(TimeV-1)); basis2V = (aV-bV)*(TimeV-1)*exp(-rV*(TimeV-1));
*basis functions for verbal*;
if Type = "Q" then predv = n0Q*basis0Q + n1Q*basis1Q + n2Q*basis2Q;
else if Type = "V" then predv = n0V*basis0V + n1V*basis1V + n2V*basis2V;
llQ = (-1/2)*(log(2*pi) + (((QRTS - predv)**2)/s2Q) + log(s2Q));
llV = (-1/2)*(log(2*pi) + (((VRTS - predv)**2)/s2V) + log(s2V));
if Type = "Q" then ll = llQ; else if Type = "V" then ll = 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;
run; When I run this code, I get an error message saying that SAS stopped processing because of insufficient memory. I'm guessing that this happened because my code was incorrect. Any suggestions or help is greatly appreciated. Thanks!
... View more