integer.RdThe 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.
integer(x, values, intercept=FALSE)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.
A matrix object of class "integer". It contains the attributes values and intercept.
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).
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.
### simple use (accessing non-exported function through ':::')
dlnm:::integer(1:5)
#> 1 2 3 4
#> [1,] 0 0 0 0
#> [2,] 1 0 0 0
#> [3,] 0 1 0 0
#> [4,] 0 0 1 0
#> [5,] 0 0 0 1
#> attr(,"values")
#> [1] 1 2 3 4 5
#> attr(,"intercept")
#> [1] FALSE
#> attr(,"class")
#> [1] "integer" "matrix"
dlnm:::integer(1:5, intercept=TRUE)
#> 1 2 3 4 5
#> [1,] 1 0 0 0 0
#> [2,] 0 1 0 0 0
#> [3,] 0 0 1 0 0
#> [4,] 0 0 0 1 0
#> [5,] 0 0 0 0 1
#> attr(,"values")
#> [1] 1 2 3 4 5
#> attr(,"intercept")
#> [1] TRUE
#> attr(,"class")
#> [1] "integer" "matrix"