Description Usage Arguments Details Value Syntax Operations par.label Line breaks Comments Author(s) References See Also Examples
Generates data from a multivariate normal distribution
from model equations using the MASS::mvrnorm()
function.
The argument eq
is a character string
that specifies the associations between the variables.
See Syntax
, Operations
, par.label
,
Line breaks
, and Comments
below.
1 |
eq |
Character string. Equations. See Details. |
n |
Integer. Sample size. |
check |
Logical.
If |
... |
... |
The multivariate normal distribution is given by
\mathbf{X} \sim \mathcal{N}_{k} ≤ft( \boldsymbol{μ}, \boldsymbol{Σ} \right)
with location parameter
\boldsymbol{μ} \in \mathbf{R}^{k}
and a positive definite covariance matrix
\boldsymbol{Σ} \in \mathbf{R}^{k \times k} .
The probability density function is given by
f_{\mathbf{X}} ≤ft( x_1, \cdots, x_k \right) = \frac{ \exp ≤ft[ - \frac{1}{2} ≤ft( \mathbf{x} - \boldsymbol{μ} \right)^{\mathsf{T}} \boldsymbol{Σ}^{-1} ≤ft( \mathbf{x} - \boldsymbol{μ} \right) \right] }{ √{ ≤ft( 2 π \right)^k | \boldsymbol{Σ} | } }
In this function, the model-implied mean vector and variance-covariance matrix are used as parameters to generate the data.
\boldsymbol{μ} ≤ft( \boldsymbol{θ} \right) = \mathbf{g} = \mathbf{F} ≤ft( \mathbf{I} - \mathbf{A} \right)^{\mathsf{T}} \mathbf{u} = \mathbf{F} \mathbf{E} \mathbf{u}
\boldsymbol{Σ} ≤ft( \boldsymbol{θ} \right) = \mathbf{M} = \mathbf{F} ≤ft( \mathbf{I} - \mathbf{A} \right)^{-1} \mathbf{S} ≤ft[ ≤ft( \mathbf{I} - \mathbf{A} \right)^{-1} \right]^{\mathsf{T}} \mathbf{F}^{\mathsf{T}} \\ = \mathbf{F} \mathbf{E} \mathbf{S} \mathbf{E}^{\mathsf{T}} \mathbf{F}^{\mathsf{T}} \\ = \mathbf{F} \mathbf{C} \mathbf{F}^{\mathsf{T}}
n variates from \mathbf{X} \sim \mathcal{N}_{k} ≤ft( \boldsymbol{μ} ≤ft( \boldsymbol{θ} \right), \boldsymbol{Σ} ≤ft( \boldsymbol{θ} \right) \right) .
Each line should follow the syntax below
lhs <space> op <space> rhs <space> par.label <\n> or <;>
is the variable on the left-hand side,
is the variable on the right-hand side,
is the operation between lhs
and rhs
,
is the column of parameter label,
are line breaks. Each line should end with a line break.
The associations are defined by the following operations
left-hand side
measured by right-hand side
,
left-hand side
regressed on right-hand side
,
left-hand side
covarying with right-hand side
,
left-hand side
regressed on 1 for mean structure.
Each parameter should have a numeric value.
The characters \n
and ;
can be used as line breaks.
Each line should end with a line break.
Comments can be written after a hash (#
) sign.
Ivan Jacob Agaloos Pesigan
McArdle, J. J., & McDonald, R. P. (1984). Some algebraic properties of the Reticular Action Model for moment structures. British Journal of Mathematical and Statistical Psychology, 37 (2), 234–251. https://doi.org/10.1111/j.2044-8317.1984.tb00802.x
Other data generation functions:
RAM2Data()
1 2 3 4 5 6 7 8 9 10 | eq <- "
# lhs op rhs value
e by y 1
y on x 1
e with e 1
x with x 0.25
y on 1 0
x on 1 0.50
"
Eq2Data(eq, n = 100)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.