integer {dlnm}R Documentation

Generate a Basis Matrix of Indicator Variables for Integer Values

Description

The function generates a basis matrix including indicator variables defining intervals for integer values. It is meant to be used internally by onebasis and crossbasis and not directly run by the users.

Usage

integer(x, values, intercept=FALSE)

Arguments

x

the predictor variable. Missing values are allowed.

values

the values for which the indicator variables should be computed. Used internally, usually to be left as missing.

intercept

logical. If TRUE, an intercept is included in the basis matrix. See Details below.

Details

The function returns indicator variables for intervals defined by the integer values within the range of x. It is expressly created to specify an unconstrained function in the space of lags for distributed lag linear (DLMs) or non-linear (DLNMs) models, and probably of no use beyond that.

The argument intercept determines the presence of an intercept. If FALSE, the interval corresponding to the first value in values is excluded, and the parameterization is indentical to dummy variables with the first group as a reference.

Value

A matrix object of class "integer". It contains the attributes values and intercept.

Note

This function is mainly used internally thorugh onebasis to create basis matrices. It is not exported in the namespace to avoid conflicts with the function with the same name in the package base, and can be accessed through the triple colon operator ':::' (see Examples below).

Author(s)

Antonio Gasparrini <antonio.gasparrini@lshtm.ac.uk>

See Also

onebasis to generate basis matrices and crossbasis to generate cross-basis matrices.

See dlnm-package for an introduction to the package and for links to package vignettes providing more detailed information.

Examples

### simple use (accessing non-exported function through ':::')
dlnm:::integer(1:5)
dlnm:::integer(1:5, intercept=TRUE)

[Package dlnm version 2.4.7 Index]