restrictions2RAM: Convert to reticular action model

Description Usage Arguments Value Methods Warning Author(s) See Also Examples

Description

These functions convert to the reticular action model (RAM) format utilized by the sem package.

Usage

1
FA2RAM(FAobject)

Arguments

FAobject

object of FA-class

Value

A character matrix with three columns of S3 class "mod", which is suitable for passing to sem.

Methods

Note FA2RAM is not a S4 generic function, but it primarily exists to call the S4 generic function, restrictions2RAM. There are methods for each flavor of restrictions-class, except for "restrictions.factanal".

The restrictions2RAM S4 generic function takes one argument, restrictions, which is an object that inherits from restrictions-class.

Warning

It is not possible to map exactly to the RAM specification used in the sem package for models with two levels. FA2RAM will produce a warning in such cases indicating that the normalizations of the latent variables differ from the normalizations used in FAiR. The reproduced covariance matrix should be the same (up to some numerical error) but the parameter values at the optimum will differ.

Author(s)

Ben Goodrich

See Also

See specify.model and sem in the sem package for details on the RAM specification.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
man  <- make_manifest(covmat = ability.cov)

## Here is also an example of how to set up a CFA model the hard way
beta <- matrix(NA_real_, nrow = nrow(cormat(man)), ncol = 2)
rownames(beta) <- rownames(cormat(man))
beta[2:3,1] <- beta[5:6,2] <- 0
free <- is.na(beta)
beta <- new("parameter.coef", x = beta, free = free, num_free = sum(free))

Phi  <- diag(2)
free <- lower.tri(Phi)
Phi  <- new("parameter.cormat", x = Phi, free = free, num_free = sum(free))

res <- make_restrictions(manifest = man, beta = beta, Phi = Phi, 
                         discrepancy = "MLE")
show(res)
RAM <- restrictions2RAM(res)
if(require(sem)) {
  RAM[,3] <- c(0.5, 0, 0, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0, 0, 
               1, 0, 1,  0.5, 0.5, 0.5, 0.5, 0.5, 0.5)
  cfa <- sem(RAM, model.matrix(man, standardize = FALSE), man@n.obs)
  summary(cfa)
}

FAiR documentation built on May 29, 2017, 6:08 p.m.