interpret.dlm: Interpret a DLM formula

Description Usage Arguments Details Value

View source: R/interpret.dlm.R

Description

Given an appropriate DL model formula and data-frame, prepares the data to be fit by interpreting the formula and extracting available smooth lag terms.

Usage

1
2
interpret.dlm(formula, data, .names.func = function(n) paste("pseudoGroups",
  n, sep = ""))

Arguments

formula

a symbolic description of the model to be fitted. See dlm for details.

data

a model-frame containing the data for each term in the model. Should already be appropriately subset, etc.

.names.func

a function for creating names of dummy variables that act as placeholders for penalized spline terms in lme4's setup. There should not be a need to alter this in normal use cases

Details

Users should not typically have to interact with interpret.dlm directly, but it may be useful for extensions.

Uses R's stats::model.matrix mechanisms to build and parse the random effects (or penalized) components of spline-lag terms in the model. The object returned is later passed to other dlmBE functions in order to fit the specified model.

Value

an S3 object of class "parsed.dlm" with list elements:

formula

the formula passed to interpret.dlm

lme4.formula

a reconstructed formula that is then passed to the lme4 modular functions

model

a data.frame returned by call to stats::model.frame; a copy of the fixed effects data needed to fit the model

Bt

a matrix of the random or penalized lag basis vectors, where each vector is a row. Stored as an object that inherits from Matrix::dMatrix

bases

a list of all the unique bases represented in the formula. This may be <= the number of separate spline-lag terms. All elements should inherit from SmoothLag

lag.group

an integer vector returned by parse.names where each unique integer corresponds to a separate spline-lag term. For lag term i, lag.group == i indexes the rows of Bt that correspond to the set of random or penalized basis vectors for that term

bi

for "basis index." Each set of lag terms indexed in lag.group has a matching basis decomposition in bases. bi keeps track of that matching


Biostatistics4SocialImpact/dlm documentation built on May 19, 2019, 10:47 p.m.