tpb: Truncated Power Basis Functions

View source: R/effective_functions.r

tpbR Documentation

Truncated Power Basis Functions

Description

Makes truncated power basis spline functions.

Usage

tpb(x, degree = 3, nknots = 3, knot_loc = NULL)

Arguments

x

Vector of values that will be transformed by the basis functions.

degree

Degree of the polynomial used by the basis function.

nknots

Number of knots to use in the spline.

knot_loc

Location of the knots. If NULL they will be placed evenly along the appropriate quantiles of the variable.

Value

A n x degree+nknots matrix of basis function values.

Examples


library(psre)
data(wvs)
smod3 <- lm(secpay ~ tpb(gini_disp, degree=3, knot_loc=.35) + democrat, data=wvs)
summary(smod3)


davidaarmstrong/psre documentation built on Aug. 28, 2024, 6:35 a.m.