Description Usage Arguments Details Value Author(s) References See Also Examples
Generates data from a multivariate normal distribution
using the Reticular Action Model (RAM) notation
with the MASS::mvrnorm()
function.
1 |
n |
Integer. Sample size. |
A |
|
S |
|
u |
vector of length |
Filter |
|
... |
Additional arguments to pass to |
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) .
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:
Eq2Data()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | # This is an example for the model
# y = alpha + beta * x + e
# y = 0 + 1 * x + e
n <- 50
A <- S <- matrixR::ZeroMatrix(3)
A[1, ] <- c(0, 1, 1)
diag(S) <- c(0, 0.25, 1)
u <- c(0.00, 0.50, 0.00)
Filter <- diag(2)
Filter <- cbind(Filter, 0)
colnames(Filter) <- c("y", "x", "e")
rownames(Filter) <- c("y", "x")
RAM2Data(n, A, S, u, Filter)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.