Description Usage Arguments Details Value Author(s) References See Also Examples
Generate a basis for a linear spline for piecewise regression
1 2 |
var |
the covariate to generate the basis |
knots |
a vector indicating the positions of the knots. See Details |
nknots |
an integer indicating the number of knots. See Details |
percentiles |
a vector of percentiles indicating the positions of the knots. See Details |
marginal |
logical indicating whether the effect for each interval of the spline represents the change in slope from the preceding one. Default is |
names |
a vector of quoted strings with alternate names for the columns of the resulting matrix. The length must be the number of knots plus 1 |
This functions implements in R the Stata mkspline
command. For further references see the article Gould (1993).
It is necessary to set either of knots
, nknots
, or percentiles
. If more than one is specified, it will throw an error. If nknots
is specified the intervals created will be equally spaced.
The function is designed to be called directly from within a formula. Therefore, there is no need to create the basis prior to fitting the model.
This function is very useful for exploring the exposure-response curve of the pollutants.
This function returns a matrix with the basis for a linear spline. The number of columns in the matrix is the number of knots plus 1. The columns are named accordingly or after names
Washington Junger wjunger@ims.uerj.br and Antonio Ponce de Leon ponce@ims.uerj.br
Gould, W. W. (1993) Linear splines and piecewise linear functions. Stata Technical Bulletin 15, 13–17.
Schwartz, J., Spix, C., Touloumi, G. et al. (1996) Methodological issues in studies of air pollution and daily counts of deaths or hospital admissions. J Epidemiol. Community Health 50 (suppl 1), S12–S18.
1 2 3 4 5 6 7 8 9 10 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.