Description Usage Arguments Details Value Note Author(s) See Also Examples
The function generates a basis matrix including transformed variables through high, low or double linear threshold parameterization. It is meant to be used internally by onebasis
and crossbasis
and not directly run by the users.
1 |
x |
the predictor variable. Missing values are allowed. |
thr.value |
numeric scalar or vector defining the threshold value(s). |
side |
type of threshold parameterization: |
intercept |
logical. If |
A linear threshold function defines a linear relationship beyond a specific threshold. A high linear threshold defines a linear increase above the threshold, while a low linear threshold defines a linear increase below. A double linear threshold includes both of them.
The argument thr.value
is placed at the median if not provided. If side
is not provided, the default is side="h"
when thr.value
is a scalar, side="d"
otherwise. Only the minimum (for side="h"
and side="l"
) and minimum and maximum values (for side="d"
) of thr.value
are considered.
If intercept=TRUE
, an intercept is included in the model, namely an additional variable with a constant value of 1.
A matrix object of class "thr"
. It contains the attributes thr.value
, side
and intercept
, with values which can be different than the arguments provided due to internal reset.
This function is mainly used internally thorugh onebasis
and crossbasis
to create basis and cross-basis matrices, respectively. It is not exported in the namespace, and can be accessed through the triple colon operator ':::
' (see Examples below).
Antonio Gasparrini <antonio.gasparrini@lshtm.ac.uk>
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.
1 2 3 4 5 6 7 8 9 10 11 | ### simple use (accessing non-exported function through ':::')
dlnm:::thr(1:5, thr=3)
dlnm:::thr(1:5, side="d")
dlnm:::thr(1:5, side="d", intercept=TRUE)
### use as an internal function in onebasis
b <- onebasis(chicagoNMMAPS$pm10, "thr", thr.value=20)
summary(b)
model <- glm(death ~ b, family=quasipoisson(), chicagoNMMAPS)
pred <- crosspred(b, model, at=0:60)
plot(pred, xlab="PM10", ylab="RR", main="RR for PM10")
|
This is dlnm 2.3.6. For details: help(dlnm) and vignette('dlnmOverview').
1
[1,] 0
[2,] 0
[3,] 0
[4,] 1
[5,] 2
attr(,"thr.value")
[1] 3
attr(,"side")
[1] "h"
attr(,"intercept")
[1] FALSE
attr(,"class")
[1] "thr" "matrix"
1 2
[1,] 2 0
[2,] 1 0
[3,] 0 0
[4,] 0 1
[5,] 0 2
attr(,"thr.value")
[1] 3 3
attr(,"side")
[1] "d"
attr(,"intercept")
[1] FALSE
attr(,"class")
[1] "thr" "matrix"
1 2 3
[1,] 1 2 0
[2,] 1 1 0
[3,] 1 0 0
[4,] 1 0 1
[5,] 1 0 2
attr(,"thr.value")
[1] 3 3
attr(,"side")
[1] "d"
attr(,"intercept")
[1] TRUE
attr(,"class")
[1] "thr" "matrix"
BASIS FUNCTION
observations: 5114
range: -3.049835 356.1768
df: 1
fun: thr
thr.value: 20
side: h
intercept: FALSE
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.