View source: R/generate_data.R
generate_data | R Documentation |
Generates data according to the one-dimensional cumulative structural equation model with shock-error output measurement equation and assumptions of normality and independence with given model parameter values.
generate_data(n, L, sigma, mu)
n |
The number of time moments to generate the data for (vector of length 1, finite positive integer). |
L |
Factor loadings ((m + 1) x k matrix of finite numeric elements: the first m rows correspond to the input measurement equation; the last row corresponds to the transition equation). |
sigma |
Standard deviations of the error/noise terms ((m + 2) x 1 matrix of finite non-negative numeric elements: the first m rows correspond to the input measurement equation; the row before the last one corresponds to the transition equation; the last row corresponds to the output measurement equation). |
mu |
Intercept terms ((m + 1) x 1 matrix of finite numeric elements; the first m rows correspond to the input measurement equation; the last row corresponds to the transition equation). |
An (n + 1) x (m + 1) data frame of numeric elements (except for row 1 columns 1 to m that contain NA's) containing observed input (columns 1 to m) and output (column m + 1) data.
set.seed(1) m <- 4 k <- 2 L <- matrix(runif((m + 1) * k, min = -10, max = 10), nrow = m + 1) sigma <- matrix(runif(m + 2, min = 0, max = 10), nrow = m + 2) mu <- matrix(runif(m + 1, min = -10, max = 10), nrow = m + 1) generate_data(10, L, sigma, mu)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.