Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

place.knots

Automatically place a set of knots evenly through covariate values


Description

Given a univariate array of covariate values, places a set of knots for a regression spline evenly through the covariate values.

Usage

place.knots(x,nk)

Arguments

x

array of covariate values (need not be sorted).

nk

integer indicating the required number of knots.

Details

Places knots evenly throughout a set of covariates. For example, if you had 11 covariate values and wanted 6 knots then a knot would be placed at the first (sorted) covariate value and every second (sorted) value thereafter. With less convenient numbers of data and knots the knots are placed within intervals between data in order to achieve even coverage, where even means having approximately the same number of data between each pair of knots.

Value

An array of knot locations.

Author(s)

References

See Also

Examples

require(mgcv)
x<-runif(30)
place.knots(x,7)
rm(x)

mgcv

Mixed GAM Computation Vehicle with Automatic Smoothness Estimation

v1.8-35
GPL (>= 2)
Authors
Simon Wood <simon.wood@r-project.org>
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.