hessian2 | R Documentation |
Extract the hessian from a latent variable model, with small sample correction
hessian2(object, indiv, cluster, as.lava, ...)
## S3 method for class 'lvmfit'
hessian2(
object,
indiv = FALSE,
cluster = NULL,
as.lava = TRUE,
ssc = lava.options()$ssc,
...
)
## S3 method for class 'lvmfit2'
hessian2(object, indiv = FALSE, cluster = NULL, as.lava = TRUE, ...)
object |
a |
indiv |
[logical] If |
cluster |
[integer vector] the grouping variable relative to which the observations are iid. |
as.lava |
[logical] if |
... |
additional argument passed to |
ssc |
[character] method used to correct the small sample bias of the variance coefficients: no correction ( |
When argument object is a lvmfit
object, the method first calls estimate2
and then extract the hessian.
An array containing the second derivative of the likelihood relative to each sample (dim 3) and each pair of model coefficients (dim 1,2).
estimate2
to obtain lvmfit2
objects.
#### simulate data ####
n <- 5e1
p <- 3
X.name <- paste0("X",1:p)
link.lvm <- paste0("Y~",X.name)
formula.lvm <- as.formula(paste0("Y~",paste0(X.name,collapse="+")))
m <- lvm(formula.lvm)
distribution(m,~Id) <- Sequence.lvm(0)
set.seed(10)
d <- lava::sim(m,n)
#### latent variable models ####
e.lvm <- estimate(lvm(formula.lvm),data=d)
hessian2(e.lvm)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.