[R] where are my pspline knots?

Terry Therneau therneau at mayo.edu
Thu Nov 18 15:18:04 CET 2010


 The pspline function uses P-splines (Eilers and Marx, Statistical
Science, 1981), which are a spline basis using a regular set of knots. 

Looking at the code for pspline, which isn't so hard, let
	dx = (max(x) - min(x))/ nterm    where nterm is round(2.5 * desired
degrees of freedom)

 The knots go from min(x) -df*dx to max(x) + df*dx.
 The default df is 4.

 Once the knots are known, the bs() function generates the pspline basis
for me.

Terry T



More information about the R-help mailing list