Description Usage Arguments Value Methods Warning Author(s) See Also Examples
These functions convert to the reticular action model (RAM) format utilized by the sem package.
1 | FA2RAM(FAobject)
|
FAobject |
object of |
A character matrix with three columns of S3 class "mod"
, which is suitable for
passing to sem
.
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
.
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.
Ben Goodrich
See specify.model
and sem
in the sem
package for details on the RAM specification.
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)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.