Learn R Programming

plotRCS (version 0.1.4)

knot: Location of knots for RCS

Description

Location of knots from Harrell (2015), Regression Modeling Strategies.

Usage

knot(k = 3)

Value

a numeric vector.

Arguments

k

number of knots, must be strictly between 3 and 7.

Details

Harrell (2015) states that for many datasets, k = 4 offers an adequate fit of the model and is a good compromise between flexibility and loss of pocesion caused by overfitting a small sample”. If the sample size is small, three knots should be used in order to have enough observations in between the knots to be able to fit each polynomial. If the sample size is large and if there is reason to believe that the relationship being studied changes quickly, more than five knots can be used.

References

Harrell FE (2015). Regression models for continuous y and case study in ordinal regression. In: Harrell FE, ed. Regression Modeling Strategies. New York: Springer.

Examples

Run this code
# Location of 3 knots
knot(3)

# Location of 7 knots
knot(7)

Run the code above in your browser using DataLab