Learn R Programming

lavaSearch2 (version 2.0.3)

gaussian_weight: Estimate LVM With Weights

Description

Estimate LVM with weights.

Usage

gaussian_weight.estimate.hook(x, data, estimator, ...)

gaussian_weight_method.lvm

gaussian_weight_logLik.lvm(object, type = "cond", p, data, weights, ...)

gaussian_weight_objective.lvm(x, ...)

gaussian_weight_score.lvm( x, data, p, S, n, mu = NULL, weights = NULL, debug = FALSE, reindex = FALSE, mean = TRUE, constrain = TRUE, indiv = FALSE, ... )

gaussian_weight_gradient.lvm(...)

gaussian_weight_hessian.lvm(x, p, n, weights = NULL, ...)

Format

An object of class character of length 1.

Arguments

x, object

A latent variable model

data

dataset

estimator

name of the estimator to be used

...

passed to lower level functions.

type

must be "cond"

p

parameter value

weights

weight associated to each iid replicate.

S

empirical variance-covariance matrix between variable

n

number of iid replicates

mu

empirical mean

debug, reindex, mean, constrain, indiv

additional arguments not used

Examples

Run this code
#### linear regression with weights ####

## data
df <- data.frame(Y = c(1,2,2,1,2),
                 X = c(1,1,2,2,2),
                 missing = c(0,0,0,0,1),
                 weights = c(1,1,2,1,NA))

## using lm
e.lm.GS <- lm(Y~X, data = df)
e.lm.test <- lm(Y~X, data = df[df$missing==0,], weights = df[df$missing==0,"weights"])

## using lvm
m <- lvm(Y~X)
e.GS <- estimate(m, df)
## e.lava.test <- estimate(m, df[df$missing==0,], weights = df[df$missing==0,"weights"])
## warnings!!
e.test <- estimate(m, data = df[df$missing==0,],
                   weights = df[df$missing==0,"weights"],
                   estimator = "gaussian_weight")

Run the code above in your browser using DataLab