moments2 | R Documentation |
Compute conditional mean, conditional variance, their first and second derivative regarding model parameters, as well as various derivatives of the log-likelihood.
moments2(
object,
param,
data,
weights,
Omega,
Psi,
initialize,
usefit,
update.dmoment,
update.d2moment,
score,
information,
hessian,
vcov,
dVcov,
dVcov.robust,
residuals,
leverage,
derivative
)
## S3 method for class 'lvm'
moments2(
object,
param = NULL,
data = NULL,
weights = NULL,
Omega = NULL,
Psi = NULL,
initialize = TRUE,
usefit = TRUE,
update.dmoment = TRUE,
update.d2moment = TRUE,
score = TRUE,
information = TRUE,
hessian = TRUE,
vcov = TRUE,
dVcov = TRUE,
dVcov.robust = TRUE,
residuals = TRUE,
leverage = TRUE,
derivative = "analytic"
)
## S3 method for class 'lvmfit'
moments2(
object,
param = NULL,
data = NULL,
weights = NULL,
Omega = NULL,
Psi = NULL,
initialize = TRUE,
usefit = TRUE,
update.dmoment = TRUE,
update.d2moment = TRUE,
score = TRUE,
information = TRUE,
hessian = TRUE,
vcov = TRUE,
dVcov = TRUE,
dVcov.robust = TRUE,
residuals = TRUE,
leverage = TRUE,
derivative = "analytic"
)
object |
a latent variable model. |
param |
[numeric vector] value of the model parameters if different from the estimated ones. |
data |
[data.frame] dataset if different from the one used to fit the model. |
Psi |
[matrix] Average first order bias in the residual variance. Only necessary for computing adjusted residuals. |
initialize |
[logical] Pre-compute quantities dependent on the data but not on the parameters values. |
usefit |
[logical] Compute key quantities based on the parameter values. |
update.dmoment |
[logical] should the first derivative of the moments be computed/updated? |
update.d2moment |
[logical] should the second derivative of the the moments be computed/updated? |
score |
[logical] should the score be output? |
information |
[logical] should the expected information be output? |
hessian |
[logical] should the hessian be output? |
vcov |
[logical] should the variance-covariance matrix based on the expected information be output? |
dVcov |
[logical] should the derivative of the variance-covariance matrix be output? |
dVcov.robust |
[logical] should the derivative of the robust variance-covariance matrix be output? |
... |
[internal] only used by the generic method or by the <- methods. |
For lvmfit objects, there are two levels of pre-computation:
a basic one that do no involve the model coefficient (conditionalMoment.lvm
).
an advanced one that require the model coefficients (conditionalMoment.lvmfit
).
m <- lvm(Y1~eta,Y2~eta,Y3~eta)
latent(m) <- ~eta
d <- lava::sim(m,1e2)
e <- estimate(m, d)
## basic pre-computation
res1 <- moments2(e, data = d, initialize = TRUE, usefit = FALSE,
score = TRUE, information = TRUE, hessian = TRUE, vcov = TRUE,
dVcov = TRUE, dVcov.robust = TRUE, residuals = TRUE, leverage = FALSE,
derivative = "analytic")
res1$skeleton$param$Sigma
## full pre-computation
res2 <- moments2(e, param = coef(e), data = d, initialize = TRUE, usefit = TRUE,
score = TRUE, information = TRUE, hessian = TRUE, vcov = TRUE,
dVcov = TRUE, dVcov.robust = TRUE, residuals = TRUE, leverage = FALSE,
derivative = "analytic")
res2$moment$Omega
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.