| mc_rw | R Documentation |
Constructs the components of the matrix linear predictor associated with random walk (RW) models for longitudinal or time series data. The user may specify the order of the random walk process.
mc_rw(id, time, data, order = 1, proper = FALSE)
id |
A character string giving the name of the column in
|
time |
A character string giving the name of the column in
|
data |
A data frame containing the variables specified in
|
order |
A positive integer specifying the order of the random walk model. |
proper |
Logical indicating whether a proper random walk specification should be used. |
This function builds sparse precision matrix components corresponding
to random walk structures of a given order. It is primarily intended
for longitudinal data indexed by a subject identifier and a time
variable. For pure time series data, the same id value should
be used for all observations. When proper = TRUE, the precision
structure is decomposed into diagonal and off-diagonal components.
If proper = FALSE, a list with a single component:
A sparse matrix of class dgCMatrix representing the
random walk precision structure.
If proper = TRUE, a list with two components:
A sparse diagonal matrix of class dgCMatrix.
A sparse off-diagonal matrix of class dgCMatrix.
The matrices are ordered consistently with the original data.
Wagner Hugo Bonat, wbonat@ufpr.br
Bonat, W. H. (2018). Multiple Response Variables Regression Models in R: The mcglm Package. Journal of Statistical Software, 84(4), 1–30.
mc_id, mc_dist, mc_car,
mc_ma, mc_mixed, mc_compute_rho
id <- rep(1:2, each = 4)
time <- rep(1:4, 2)
data <- data.frame(id = id, time = time)
mc_rw(id = "id", time = "time", data = data, order = 1, proper = FALSE)
mc_rw(id = "id", time = "time", data = data, order = 1, proper = TRUE)
mc_rw(id = "id", time = "time", data = data, order = 2, proper = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.