turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- Analytics
- /
- Stat Procs
- /
- PROC MCMC Invalid Log Likelihood

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

2 weeks ago

Hi all,

I'm performing a quite complex mixed effects model using PROC MCMC. I've successfully obtained model parameter estimates using PROC NLMIXED so I believe that this model will converge using Bayesian estimation. To set up the problem and get you up to speed without going into too much detail, I am basically analyzing longitudinal data with 3 components: quantitative, verbal, and working memory. When analyzing the quantitative and verbal tasks, I obtain estimates. However, when I add the working memory task, things start to go awry. When I submit my code, I obtain this message:

ERROR: Observation 29 yields an invalid log-likelihood value.

I understand that one of my observations is leading to something that cannot be calculated and thus the error message. I was wondering if you had any advice to tackle this issue. Thank you!

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

2 weeks ago

Since this is the log likelihood, the most likely explanation is that a data value or parameter is not positive. When you evaluate the LL, you have to sum terms that include the LOG function.

Most likely you have a non-positive value somewhere. Post the NLMIXED code and we can check. Another possibility is that you forgot to use the BOUNDS statement to restrict the domain of parameters. For example,

BOUNDS 0 < Sigma, 0 < p < 1;

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

2 weeks ago

Hi Rick,

Thanks for the reply. I'm using PROC MCMC for the model and I've already computed it using NLMIXED. As far as I'm aware, there is no BOUNDS statement in MCMC? Anyway, here is the PROC MCMC code I used that led to the error message:

```
*Bayesian estimation of multivariate structured latent curve model, with working memory battery*;
proc mcmc data = learning nmc = 100000 thin = 5 nbi = 10000 seed = 122291;
array theta[7] aQ bQ rQ aV bV rV WM; *fixed effect parameters*;
array lambda[4] lambda1 lambda2 lambda3 lambda4;
array z[7] z0Q z1Q z2Q z0V z1V z2V zWM; *random effects*;
array mu0[7] (8.5956 16.3643 0.6384 6.8029 21.2037 0.6794 7.0823);
array mu_lambda[4] (12.2135 11.9258 11.0414 11.7069);
array sigma_lambda[4,4] (.847 0 0 0
0 .829 0 0
0 0 .770 0
0 0 0 .811);
array zero[7] (0,0,0,0,0,0,0); *zero matrix*;
array sigma0[7,7] (4.32 7.27 -.076 0 0 0 -.404
7.27 34.93 .483 0 0 0 -.283
-.076 .483 .153 0 0 0 .078
0 0 0 1.74 3.66 -.117 -.232
0 0 0 3.66 93.50 -.161 .887
0 0 0 -.117 -.161 .233 .080
-.404 -.283 .078 -.232 .887 .080 1);
array s2z[7,7]; *variance in random effects*;
array s[7,7] (0.02 0 0 0 0 0 0
0 0.02 0 0 0 0 0
0 0 0.02 0 0 0 0
0 0 0 0.02 0 0 0
0 0 0 0 0.02 0 0
0 0 0 0 0 0.02 0
0 0 0 0 0 0 20);
parms theta {8.5956 16.3643 0.6384 6.8029 21.2037 0.6794 7.0823}
s2z s2Q 0.9309 s2V 1.6984 s2WM1 221.00 s2WM2 230.86 s2WM3 251.50 s2WM4 189.36
lambda {12.2135 11.9258 11.0414 11.7069};
prior theta ~ mvn(mu0, sigma0);
prior lambda ~ mvn(mu_lambda, sigma_lambda);
prior s2z ~ iwish(7,s);
prior s2Q ~ igamma(shape = 0.01, scale = 0.01);
prior s2V ~ igamma(shape = 0.01, scale = 0.01);
prior s2WM1 ~ igamma(shape = 0.01, scale = 0.01);
prior s2WM2 ~ igamma(shape = 0.01, scale = 0.01);
prior s2WM3 ~ igamma(shape = 0.01, scale = 0.01);
prior s2WM4 ~ igamma(shape = 0.01, scale = 0.01);
random z ~ mvn(zero, s2z) subject = SUBID;
n0Q = aQ + z0Q; n1Q = bQ + z1Q; n2Q = z2Q; *fixed plus random for quantitative*;
n0V = aV + z0V; n1V = bV + z1V; n2V = z2V; *fixed plus random for verbal*;
n0WM = WM + zWM; *fixed plus random for WM*;
basis1 = 1-exp(-rQ*(Time-1)); basis2 = exp(-rQ*(Time-1)); basis3 = (aQ-bQ)*(Time-1)*exp(-rQ*(Time-1));
basis4 = 1-exp(-rV*(Time-1)); basis5 = exp(-rV*(Time-1)); basis6 = (aV-bV)*(Time-1)*exp(-rV*(Time-1));
basis7 = lambda1; basis8 = lambda2; basis9 = lambda3; basis10 = lambda4;
predv = D1*(n0Q*basis1 + n1Q*basis2 + n2Q*basis3) + D2*(n0V*basis4 + n1V*basis5 + n2V*basis6) + D4*(n0WM*basis7)
+ D5*(n0WM*basis8) + D6*(n0WM*basis9) + D7*(n0WM*basis10);
s2e = D1*s2Q + D2*s2V + D4*s2WM1 + D5*s2WM2 + D6*s2WM3 + D7*s2WM4;
model Response ~ normal(predv, var = s2e);
run;
```

As I stated before, I believe the problem lies in the working memory (anything involving WM and/or lambda in the code) because when I analyze just the quantitative and verbal scores, everything is fine. When I add the working memory part, the error appears.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

2 weeks ago

Do you see anything suspicious when you run

```
proc print data=learning(obs=29 firstobs=29);
run;
```

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

2 weeks ago

Yes! There is a missing value that I didn't notice. Thank you so much for your help.