leverage2: Leverage With Small Sample Correction.

leverage2R Documentation

Leverage With Small Sample Correction.

Description

Extract leverage values from a latent variable model, with small sample correction.

Usage

leverage2(object, format, ssc, ...)

## S3 method for class 'lvmfit'
leverage2(object, format = "wide", ssc = lava.options()$ssc, ...)

## S3 method for class 'lvmfit2'
leverage2(object, format = "wide", ...)

Arguments

object

a lvmfit or lvmfit2 object (i.e. output of lava::estimate or lavaSearch2::estimate2).

format

[character] Use "wide" to return the residuals in the wide format (one row relative to each sample). Otherwise use "long" to return the residuals in the long format.

ssc

[character] method used to correct the small sample bias of the variance coefficients: no correction (code"none"/FALSE/NA), correct the first order bias in the residual variance ("residual"), or correct the first order bias in the estimated coefficients "cox"). Only relevant when using a lvmfit object.

...

additional argument passed to estimate2 when using a lvmfit object.

Details

The leverage are defined as the partial derivative of the fitted values with respect to the observations.

leverage_i = \frac{\partial \hat{Y}_i}{\partial Y_i}

See Wei et al. (1998).

When argument object is a lvmfit object, the method first calls estimate2 and then extract the leverage.

Value

a matrix containing the leverage relative to each sample (in rows) and each endogenous variable (in column).

References

Bo-Cheng Wei et al., Generalized Leverage and its applications (1998), Scandinavian Journal of Statistics 25:1:25-37.

See Also

estimate2 to obtain lvmfit2 objects.

Examples

#### simulate data ####
set.seed(10)
m <- lvm(Y1~eta,Y2~eta,Y3~eta)
latent(m) <- ~eta
d <- lava::sim(m,20, latent = FALSE)

#### latent variable models ####
e.lvm <- estimate(m, data = d)
leverage2(e.lvm)


lavaSearch2 documentation built on April 12, 2023, 12:33 p.m.