Learn R Programming

lava (version 1.4.1)

estimate.lvm: Estimation of parameters in a Latent Variable Model (lvm)

Description

Estimate parameters. MLE, IV or user-defined estimator.

Usage

## S3 method for class 'lvm':
estimate(x, data = parent.frame(), estimator = "gaussian",
  control = list(), missing = FALSE, weight, weightname, weight2, cluster,
  fix, index = TRUE, graph = FALSE, silent = lava.options()$silent,
  quick = FALSE, method, param, ...)

Arguments

x
lvm-object
data
data.frame
estimator
String defining the estimator (see details below)
control
control/optimization parameters (see details below)
missing
Logical variable indiciating how to treat missing data. Setting to FALSE leads to complete case analysis. In the other case likelihood based inference is obtained by integrating out the missing data under assumption the assumption that data is missing at
weight
Optional weights to used by the chosen estimator.
weightname
Weight names (variable names of the model) in case weight was given as a vector of column names of data
weight2
Optional additional dataset used by the chosen estimator.
cluster
Vector (or name of column in data) that identifies correlated groups of observations in the data leading to variance estimates based on a sandwich estimator
fix
Logical variable indicating whether parameter restriction automatically should be imposed (e.g. intercepts of latent variables set to 0 and at least one regression parameter of each measurement model fixed to ensure identifiability.)
index
For internal use only
graph
For internal use only
silent
Logical argument indicating whether information should be printed during estimation
quick
If TRUE the parameter estimates are calculated but all additional information such as standard errors are skipped
method
Optimization method
param
set parametrization (see help(lava.options))
...
Additional arguments to be passed to the low level functions

Value

  • A lvmfit-object.

Details

A list of parameters controlling the estimation and optimization procedures is parsed via the control argument. By default Maximum Likelihood is used assuming multivariate normal distributed measurement errors. A list with one or more of the following elements is expected:

[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]

See Also

score, information, ...

Examples

Run this code
dd <- read.table(header=TRUE,
text="x1 x2 x3
1.0 2.0 1.4
2.1 4.1 4.0
3.1 3.4 7.0
4.2 6.1 3.5
5.3 5.2 2.3
1.1 1.6 2.9")
e <- estimate(lvm(c(x1,x2,x3)~u),dd)

## Simulation example
m <- lvm(list(y~v1+v2+v3+v4,c(v1,v2,v3,v4)~x))
covariance(m) <- v1~v2+v3+v4
dd <- sim(m,10000) ## Simulate 10000 observations from model
e <- estimate(m, dd) ## Estimate parameters
e

## Using just sufficient statistics
n <- nrow(dd)
e0 <- estimate(m,data=list(S=cov(dd)*(n-1)/n,mu=colMeans(dd),n=n))

## Multiple group analysis
m <- lvm()
regression(m) <- c(y1,y2,y3)~u
regression(m) <- u~x
d1 <- sim(m,100,p=c("u,u"=1,"u~x"=1))
d2 <- sim(m,100,p=c("u,u"=2,"u~x"=-1))

mm <- baptize(m)
regression(mm,u~x) <- NA
covariance(mm,~u) <- NA
intercept(mm,~u) <- NA
ee <- estimate(list(mm,mm),list(d1,d2))

## Missing data
d0 <- makemissing(d1,cols=1:2)
e0 <- estimate(m,d0,missing=TRUE)
e0

Run the code above in your browser using DataLab