mc_rw: Random Walk Models Structure

View source: R/mc_rw.R

mc_rwR Documentation

Random Walk Models Structure

Description

The function mc_rw builds the components of the matrix linear predictor associated with random walk models. This function is generaly used for the analysis of longitudinal and times series data. The user can specify the order of the random walk process.

Usage

mc_rw(id, time, data, order = 1, proper = FALSE)

Arguments

id

name of the column (string) containing the subject index. Note that this structure was designed to deal with longitudinal data. For times series data use the same id for all observations (one unit sample).

time

name of the column (string) containing the index indicating the time.

data

data set.

order

order of the random walk model.

proper

logical.

Value

If proper = FALSE a matrix of dgCMatrix class. If proper = TRUE a list with two matrices of dgCMatrix class.

Author(s)

Wagner Hugo Bonat, wbonat@ufpr.br

Source

Bonat, W. H. (2018). Multiple Response Variables Regression Models in R: The mcglm Package. Journal of Statistical Software, 84(4):1–30.

See Also

mc_id, mc_dist, mc_car, mc_ma, mc_mixed and mc_compute_rho.

Examples

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)

mcglm documentation built on Sept. 16, 2022, 1:06 a.m.