store: State-trait ordinal regression

View source: R/store.R

storeR Documentation

State-trait ordinal regression

Description

This function performs regression of an ordinal response on an ordinal predictor with intensive longitudinal data. The methodology allows for separating state effects from trait effects.

Usage

store(
  formula,
  data,
  id,
  penalize = TRUE,
  method = "mgcv",
  model = "TS",
  covt = NULL,
  save.data = TRUE,
  ...
)

Arguments

formula

An expression of the form y ~ x representing the model.

data

Data frame containing the variables in the model.

id

Variable name for the subjects of the data.

penalize

A logical variable: if TRUE (the default), a non-linearity penalty is applied.

method

Package implementing ordinal mixed-effect regression: either "mgcv" (the default) or "ordinal".

model

The model to fit: "TS" for trait-state model with random effects (the default), "trait" for trait-only model with random effects, "RE" for model with random effects only.

covt

The covariates of the model; default is NULL.

save.data

A logical variable: if TRUE (the default) store the data.

...

Other arguments, passed to gam.

Value

A fitted model object with response and predictor ordinal variables extracted from formula. This is a gam object with some additional components, including fixed.edf, the effective degrees of freedom of the fixed-effect terms, and R2, the coefficient of determination. These last two are discussed in Osei and Reiss (2022)..

When model is "TS" or "trait", the model matrix is called tsmat. Coefficient tsmatmed1, for example, is the "trait effect" associated with median predictor value 1. Coefficient tsmat1.2 is the "state effect" of current predictor value 2 for an individual whose median is 1.

Author(s)

Prince P. Osei and Philip T. Reiss

References

Osei, P. P. and Reiss, P. T. (2022). Ordinal state-trait regression for intensive longitudinal data. Under revision.

See Also

lagged.response.model, which shows how to add the previous response value as a predictor.

Examples

## Not run: 
mod <- store(pleasant.~stressed., data=thoughts, id="Subject")  # takes several minutes
summary(mod)
plot(mod)

## End(Not run)

oseipep/store documentation built on June 30, 2022, 4:43 a.m.