This function just calls ns() from the
splines
package.
Usage
ns(x, df = NULL, knots = NULL, intercept = FALSE,
Boundary.knots = range(x))Arguments
- x
the predictor variable. Missing values are allowed.
- df
degrees of freedom. One can supply
dfrather than knots;ns()then choosesdf - 1 - interceptknots at suitably chosen quantiles ofx(which will ignore missing values). The default,df = NULL, sets the number of inner knots aslength(knots).- knots
breakpoints that define the spline. The default is no knots; together with the natural boundary conditions this results in a basis for linear regression on
x. Typical values are the mean or median for one knot, quantiles for more knots. See alsoBoundary.knots.- intercept
if
TRUE, an intercept is included in the basis; default isFALSE.- Boundary.knots
boundary points at which to impose the natural boundary conditions and anchor the B-spline basis (default the range of the data). If both
knotsandBoundary.knotsare supplied, the basis parameters do not depend onx. Data can extend beyondBoundary.knots
