knot: Location of knots for RCS

View source: R/knots.R

knotR Documentation

Location of knots for RCS

Description

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

Usage

knot(k = 3)

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.

Value

a numeric vector.

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

# Location of 3 knots
knot(3)

# Location of 7 knots
knot(7)

plotRCS documentation built on April 6, 2023, 9:23 a.m.

Related to knot in plotRCS...