diff --git a/DESCRIPTION b/DESCRIPTION index 5cb1eada..e434d924 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: blavaan Title: Bayesian Latent Variable Analysis -Version: 0.5-3 +Version: 0.5-3.1229 Authors@R: c(person(given = "Edgar", family = "Merkle", role = c("aut", "cre"), email = "merklee@missouri.edu", diff --git a/NEWS.md b/NEWS.md index 76a7f208..2b01fe38 100644 --- a/NEWS.md +++ b/NEWS.md @@ -13,6 +13,9 @@ * Bugs from 0.5-2 are fixed. +## Bugs/glitches discovered after the release: +* Some models with exogenous covariates, fixed.x=TRUE, and missing data fail to converge and yield implausible parameter values (reported by DeAnne Hunter). + # Version 0.5-2 ## New features diff --git a/inst/stan/stanmarg.stan b/inst/stan/stanmarg.stan index aa723def..5b79cab5 100644 --- a/inst/stan/stanmarg.stan +++ b/inst/stan/stanmarg.stan @@ -1538,8 +1538,10 @@ model { // N.B.: things declared in the model block do not get saved in the outp // sufficient stats target += multi_normal_suff(YXbarstar[mm, 1:Nobs[mm]], Sstar[mm, 1:Nobs[mm], 1:Nobs[mm]], Mu[grpidx, obsidx[1:Nobs[mm]]], Sigmainv[mm, 1:(Nobs[mm] + 1), 1:(Nobs[mm] + 1)], r2 - r1 + 1); - if (Nx[mm] > 0) { - target += -multi_normal_suff(YXbarstar[mm, xdatidx[1:Nx[mm]]], Sstar[mm, xdatidx[1:Nx[mm]], xdatidx[1:Nx[mm]]], Mu[grpidx, xidx[1:Nx[mm]]], sig_inv_update(Sigmainv[grpidx], xidx, Nx[mm], p + q, logdetSigma_grp[grpidx]), r2 - r1 + 1); + if (Nx[mm] > 0 && !missing) { + target += -multi_normal_suff(YXbarstar[mm, xdatidx[1:Nx[mm]]], Sstar[mm, xdatidx[1:Nx[mm]], xdatidx[1:Nx[mm]]], Mu[grpidx, xidx[1:Nx[mm]]], sig_inv_update(Sigmainv[mm], xidx, Nx[mm], p + q, logdetSigma_grp[grpidx]), r2 - r1 + 1); + } else if (Nx[mm] > 0) { + target += -multi_normal_lpdf(YXstar[r1:r2,xdatidx[1:Nx[mm]]] | Mu[grpidx, xidx[1:Nx[mm]]], Sigma[grpidx, xidx[1:Nx[mm]], xidx[1:Nx[mm]]]); } } }