mc_ma: Moving Average Models Structure

View source: R/mc_ma.R

mc_maR Documentation

Moving Average Models Structure

Description

The function mc_ma helps to build the components of the matrix linear predictor associated with moving average models. This function is generaly used for the analysis of longitudinal and times series data. The user can specify the order of the moving average process.

Usage

mc_ma(id, time, data, order = 1)

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 moving average process.

Details

This function was designed mainly to deal with longitudinal data, but can also be used for times series analysis. In that case, the id argument should contain only one index. It pretends a longitudinal data taken just for one individual or unit sample. This function is a simple call of the bandSparse function from the Matrix package.

Value

A matrix 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_rw and mc_mixed.

Examples

id <- rep(1:2, each = 4)
time <- rep(1:4, 2)
data <- data.frame("id" = id, "time" = time)
mc_ma(id = "id", time = "time", data = data, order = 1)
mc_ma(id = "id", time = "time", data = data, order = 2)


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