File: modelMatrices.Rd

package info (click to toggle)
r-cran-semplot 1.1.7-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 464 kB
  • sloc: makefile: 2
file content (67 lines) | stat: -rw-r--r-- 2,379 bytes parent folder | download | duplicates (3)
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
\name{modelMatrices}
\alias{modelMatrices}
%- Also NEED an '\alias' for EACH other topic documented here.
\title{
Extract SEM model matrices
}
\description{
Create a \code{"semMatriModel"} object. Use \code{\link{semMatrixAlgebra}} to extract or compute with these models. The structure of \code{"semMatriModel"} objects is chosen such that they can be used to create a \code{\link{semPlotModel-class}} object using \code{do.call} in combination with \code{\link{ramModel}}, \code{\link{lisrelModel}} or \code{mplusModel} (not yet implemented). See details.
}
\usage{
modelMatrices(object, model = "ram", endoOnly = FALSE)
}
%- maybe also 'usage' for other objects documented here.
\arguments{
  \item{object}{
A \code{"semPlotModel"} object or any of the input types that can be used in \code{\link{semPlotModel}} directly. 
}
  \item{model}{
Model to be used, \code{"mplus"}, \code{"ram"} or \code{"lisrel"}
}
  \item{endoOnly}{
Only needed when the model is \code{"lisrel"}, sets all variables to endogenous.
}
}
\details{
The \code{"lisrel"} model uses the following matrix names: \code{LY}, \code{TE}, \code{PS}, \code{BE}, \code{LX}, \code{TD}, \code{PH}, \code{GA}, \code{TY}, \code{TX}, \code{AL} and \code{KA}. Regressions on manifest variables will cause dummy latents to be included in the model.

The \code{"mplus"} model uses the following matrix names: \code{Lambda}, \code{Nu}, \code{Theta}, \code{Kappa}, \code{Alpha}, \code{Beta}, \code{Gamma} and \code{Psi}.

The \code{"ram"} model uses the following matrix names: \code{F}, \code{A} and \code{S}.
}
\value{
a \code{"semMatriModel"} object
}
\author{
Sacha Epskamp <mail@sachaepskamp.com>
}

\seealso{
\code{\link{semPlotModel}}
 \code{\link{semPlotModel-class}}
 \code{\link{semMatrixAlgebra}}
 \code{\link{lisrelModel}}
 \code{\link{ramModel}}
}

\examples{
## Mplus user guide SEM example:
outfile <- tempfile(fileext=".out")
tryres <- try({
  download.file("http://www.statmodel.com/usersguide/chap5/ex5.11.html",outfile)
})

if (!is(tryres,"try-error")){
  # Plot model:
  semPaths(outfile, intercepts = FALSE)

  # Extract RAM:
  RAM <- modelMatrices(outfile, "ram")
  semPaths(do.call(ramModel, RAM), as.expression = "edges", intercepts = FALSE)

  # Extract LISREL:
  LISREL <- modelMatrices(outfile, "lisrel")
  semPaths(do.call(lisrelModel, LISREL), as.expression = "edges", intercepts = FALSE)
}
}