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

Description Usage Arguments Details Value Author(s) See Also Examples

Description

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

Usage

1
2
3
4
5
## 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, param, ...)

Arguments

x

lvm-object

data

data.frame

estimator

String defining the estimator (see details below)

control

control/optimization parameters (see details below)

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

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 random (MAR).

index

For internal use only

graph

For internal use only

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.)

quick

If TRUE the parameter estimates are calculated but all additional information such as standard errors are skipped

silent

Logical argument indicating whether information should be printed during estimation

param

set parametrization (see help(lava.options))

...

Additional arguments to be passed to the low level functions

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:

start:

Starting value. The order of the parameters can be shown by calling coef (with mean=TRUE) on the lvm-object or with plot(..., labels=TRUE). Note that this requires a check that it is actual the model being estimated, as estimate might add additional restriction to the model, e.g. through the fix and exo.fix arguments. The lvm-object of a fitted model can be extracted with the Model-function.

starterfun:

Starter-function with syntax function(lvm, S, mu). Three builtin functions are available: startvalues, startvalues0, startvalues1, ...

estimator:

String defining which estimator to use (Defaults to “gaussian”)

meanstructure

Logical variable indicating whether to fit model with meanstructure.

method:

String pointing to alternative optimizer (e.g. optim to use simulated annealing).

control:

Parameters passed to the optimizer (default stats::nlminb).

tol:

Tolerance of optimization constraints on lower limit of variance parameters.

Value

A lvmfit-object.

Author(s)

Klaus K. Holst

See Also

score, information, ...

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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

Example output

lava version 1.6.3
There were 38 warnings (use warnings() to see them)
                    Estimate Std. Error  Z-value  P-value
Regressions:                                             
   y~v1              0.98569    0.01786 55.20469   <1e-12
   y~v2              0.99438    0.01094 90.85556   <1e-12
   y~v3              1.01832    0.01085 93.88639   <1e-12
   y~v4              0.99872    0.01099 90.87503   <1e-12
    v1~x             0.99924    0.01006 99.32101   <1e-12
   v2~x              1.00216    0.01010 99.20621   <1e-12
    v3~x             1.00122    0.01009 99.23769   <1e-12
   v4~x              0.99776    0.01009 98.88803   <1e-12
Intercepts:                                              
   y                -0.01411    0.00996 -1.41619   0.1567
   v1               -0.00103    0.00996 -0.10332   0.9177
   v2                0.01367    0.01000  1.36730   0.1715
   v3               -0.02321    0.00998 -2.32488  0.02008
   v4                0.00494    0.00998  0.49469   0.6208
Residual Variances:                                      
   y                 0.99158    0.01402 70.71068         
   v1                0.99122    0.01111 89.23685         
   v1~~v2            0.49944    0.00866 57.69711   <1e-12
   v1~~v3            0.48865    0.00853 57.29616   <1e-12
   v1~~v4            0.50072    0.00867 57.76953   <1e-12
   v2                0.99933    0.01413 70.71068         
   v3                0.99682    0.01410 70.71068         
   v4                0.99696    0.01410 70.71068         
                    Estimate Std. Error  Z value Pr(>|z|)
Regressions:                                             
   y1~u              1.06484    0.07200 14.79001   <1e-12
    y2~u             0.90965    0.07408 12.28012   <1e-12
   y3~u              1.01145    0.06524 15.50343   <1e-12
    u~x              1.06101    0.10059 10.54802   <1e-12
Intercepts:                                              
   y1               -0.18336    0.10879 -1.68551  0.09189
   y2               -0.01954    0.10871 -0.17973   0.8574
   y3               -0.14762    0.09377 -1.57423   0.1154
   u                 0.04771    0.09969  0.47862   0.6322
Residual Variances:                                      
   y1                0.96702    0.15104  6.40246         
   y2                0.97800    0.15183  6.44139         
   y3                0.87450    0.12369  7.07026         
   u                 0.97254    0.13755  7.07034         

lava documentation built on May 2, 2019, 4:49 p.m.