Open balglave opened 7 months ago
To have all the automated stuff working (simulation, checking, etc) you should currently (to be relaxed) follow the introduction vignette fairly closely. I.e. re-code the data/parameter fetching by replacing
Y <- data$Y
b <- parms$b
L <- parms$L
E <- parms$E
Lambda <- parms$Lambda
delta <- parms$delta
by
getAll(data, parms, warn=FALSE)
Y <- OBS(Y)
By making this change it should almost work, except you hit an edge case here because RTMB simply redirects mvnorm simulation to MASS::mvrnorm
which doesn't allow matrix mu ~(to be fixed in RTMB)~ (EDIT: The RTMB documentation states that mu must be a vector, so an error should be thrown):
nll = nll - sum(RTMB::dmvnorm(Y, mu, E, TRUE))
Simple fix is to be replace by
nll = nll - sum(RTMB::dmvnorm(Y - mu, 0, E, TRUE))
BTW, the consistency check should point you to the fact that your model is over-parameterized...
@kaskr It worked thanks !
Do you have any suggestions on how I could avoid over-parameterization?
I want to code a probabilistic PCA in RTMB and when I run the function
checkconsistency
it looks that I have huge biases. Here is the code. If anyone can explain me what is happending, I'd be interested.