04-13-2017 02:45 PM
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!
04-13-2017 03:02 PM
An error message that says "insufficient memory" can be caused by a number of issues, and even though you suspect your code is incorrect, that's not high on my list of possible causes.
THe usual cause is that you have so much data and you are trying to perform such complex tasks on this data, that your computer doesn't have enough memory to perform the task. If that's the case, you either need to get more memory, or reduce the amount of data, or simplify the task.
04-17-2017 01:23 PM
Thanks for the reply. This is indeed a complex model but I do believe that the data supports the model because I am trying to replicate results from a paper that used the same model on the same data (albeit using a different statistical program).
I can run the model considering each dependent variable on its own but when I consider them jointly and try to estimate the covariances between the random effects of each dependent variable (e.g. covariance between random effect for quantitative parameter a with the random effect for verbal parameter a), that is where things start to go wrong.
My advisor and I think that the problem lies in the programming statements embedded in the code. Do you think that you could take a look and see if anything is wrong?