Learn R Programming

psre (version 0.1.2)

tpb: Truncated Power Basis Functions

Description

Makes truncated power basis spline functions.

Usage

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

Value

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

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.

Examples

Run this code

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

Run the code above in your browser using DataLab