| simulate_gau | R Documentation |
Generate longitudinal continuous data from a Gaussian antedependence (AD) model of order 0, 1, or 2 using a conditional regression on predecessors.
simulate_gau(
n_subjects,
n_time,
order = 1L,
mu = NULL,
phi = NULL,
sigma = NULL,
blocks = NULL,
tau = 0,
seed = NULL
)
n_subjects |
number of subjects |
n_time |
number of time points |
order |
antedependence order, 0, 1 or 2 |
mu |
mean parameter; |
phi |
dependence parameter; ignored when |
sigma |
innovation standard deviation; |
blocks |
integer vector of length |
tau |
group effect vector indexed by block; |
seed |
optional random seed for reproducibility |
For order = 0, each time point is generated independently as
Y[, t] = mu[t] + tau[block] + eps, with eps ~ N(0, sigma[t]^2).
For order = 1, for t >= 2:
Y[, t] = m_t + phi[t] * (Y[, t - 1] - m_{t-1}) + eps_t,
where m_t = mu[t] + tau[block] and eps_t ~ N(0, sigma[t]^2).
For order = 2, for t >= 3:
Y[, t] = m_t + phi[1, t] * (Y[, t - 1] - m_{t-1}) + phi[2, t] * (Y[, t - 2] - m_{t-2}) + eps_t.
If blocks is provided, each subject s belongs to a block and receives a
mean shift tau[blocks[s]]. tau[1] is forced to 0.
numeric matrix with dimension n_subjects by n_time
y <- simulate_gau(
n_subjects = 20,
n_time = 6,
order = 1,
phi = 0.4,
seed = 42
)
dim(y)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.