integer: Generate a Basis Matrix of Indicator Variables for Integer...

Description Usage Arguments Details Value Note Author(s) See Also Examples

View source: R/integer.R

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

1
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

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

gasparrini/dlnm documentation built on Oct. 9, 2021, 2:22 a.m.