ramFit: Fit a model using lavaan based on ram input

Description Usage Arguments Value References Examples

Description

Fit a model using lavaan based on ram input

Usage

1
ramFit(ramModel, data, type=c('ram','lavaan'), digits = 3, zero.print = "0", ...)

Arguments

ramModel

An ram model

data

data

type

ram: specify a ram model; lavaan: specify a lavaan model

digits

Digits for print

zero.print

Format of zeros

...

Options for lavaan

Value

A and Ase

A matrix and its standard error

S and Sse

S matrix and its standard error

lavaan

Original lavaan output

fit

Model fit statistics and indices

References

Yves Rosseel (2012). lavaan: An R Package for Structural Equation Modeling. Journal of Statistical Software, 48(2), 1-36. URL http://www.jstatsoft.org/v48/i02/.

Zhang, Z., Hamagami, F., Grimm, K. J., & McArdle, J. J. (2013). Using R Package RAMpath for Tracing SEM Path Diagrams and Conducting Complex Longitudinal Data Analysis. Structural Equation Modeling.

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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
## Example 1. A path model
data(ex1)
m1<-'
manifest=3
label=age,hvlt,ept
arrow(2,1)=?
arrow(3,1)=?
arrow(3,2)=?
sling(1,1)=?
sling(2,2)=?
sling(3,3)=?
'

## Fit the model
res1<-ramFit(m1, ex1)

## More output from Lavaan
summary(res1$lavaan, fit=TRUE)

## Effects and variance decomposition
bridge<-ramPathBridge(res1, allbridge=TRUE, indirect=TRUE)
summary(bridge)
summary(bridge, type='bridge')

## plot the path diagram
plot(bridge, 'ex1')

## plot the effects from age to ept
plot(bridge, 'ex1effect', 'age','ept')

## plot the bridges for ept
plot(bridge, 'ex1bridge', 'ept','hvlt', type='bridge')

## summarize
summary(bridge)
summary(bridge, type='bridge')


## Example 2: An SEM model (MIMIC model)
data(ex2)
## Using lavaan directly for model estimation and specification
mimic<-'
R =~ ws1 + ls1 + lt1
R ~ edu + gender
'

mimic.res<-sem(mimic, data=ex2)

mimic.ram<-lavaan2ram(mimic.res)

## plot the path diagram
bridge<-ramPathBridge(mimic.ram, allbridge=FALSE, indirect=FALSE)
plot(bridge, 'mimic')

RAMpath documentation built on May 2, 2019, 9:12 a.m.