Learn R Programming

lavaSearch2 (version 1.0.0)

prepareScore2: Prepare the Computation of score2

Description

Compute partial derivatives regarding to the mean and the variance, and compute the design matrices.

Usage

prepareScore2(object, ...)

# S3 method for gls prepareScore2(object, X, param, attr.param, second.order, n.cluster, n.endogenous, name.endogenous, index.obs, ...)

# S3 method for lme prepareScore2(object, X, param, attr.param, second.order, n.cluster, n.endogenous, name.endogenous, index.obs, ...)

prepareScore2(x, ...) <- value

# S3 method for lvmfit prepareScore2(x, ...) <- value

# S3 method for lvm prepareScore2(object, data, second.order, name.endogenous = NULL, name.latent = NULL, ...)

# S3 method for lvmfit prepareScore2(object, data = NULL, p = NULL, usefit = TRUE, name.endogenous = NULL, name.latent = NULL, second.order = FALSE, ...)

prepareScore2(x, ...) <- value

# S3 method for lvmfit prepareScore2(x, ...) <- value

Arguments

object

a latent variable model.

...

[internal] Only used by the generic method.

X

the design matrix.

param

the fitted parameters.

attr.param

the type of each parameter (e.g. mean or variance parameter).

second.order

should the terms relative to the third derivative of the likelihood be be pre-computed?

n.cluster

the number of i.i.d. observations.

n.endogenous

the number of outcomes

name.endogenous

[optional] name of the endogenous variables

index.obs

the indexes of the outcomes relative to each observation (e.g. 1,3 if only outcome 1 and 3 are observed for the observation).

x

same as object.

value

same as usefit.

data

[optional] data set.

name.latent

[optional] name of the latent variables

p

same as param.

usefit

If TRUE the parameters estimated by the model are used to pre-compute quantities. Only for lvmfit objects.

Details

For lvmfit objects, there are two levels of pre-computation:

  • a basic one that do no involve the model parameter

  • an advanced one that require the model parameters.

Examples

Run this code
# NOT RUN {
m <- lvm(Y1~eta,Y2~eta,Y3~eta)
latent(m) <- ~eta

e <- estimate(m, lava::sim(m,1e2))
res <- prepareScore2(e)
res$skeleton$df.param
# }

Run the code above in your browser using DataLab