DemoNull: Demonstrate null space of a P-spline

DemoNullR Documentation

Demonstrate null space of a P-spline

Description

Demonstrate the limiting behaviour of a P-spline at \lambda = +\infty. A cubic P-spline set up with non-uniform B-splines and 2nd order difference penalty is fitted to observations simulated from y = x. If this P-spline has the correct null space, its limiting fit will be a straight line regardless of knot locations. In this demo, non-uniform knots from different distributions (primarily Beta distributions with varying shape parameters) are attempted. The result shows that when handling non-uniform B-splines, standard P-spline has an incorrect and unpredictable limiting behavior that is sensitive to knot locations, whereas general P-spline has a correct and consistent limiting behavior.

Usage

DemoNull(n, k, gps = FALSE)

Arguments

n

number of simulated observations from y = x.

k

number of interior knots to place.

gps

TRUE to fit general P-spline; FALSE to fit standard P-spline.

Value

This function has no returned values.

Author(s)

Zheyuan Li zheyuan.li@bath.edu

Examples

require(gps.mgcv)

## standard P-spline
DemoNull(n = 100, k = 10, gps = FALSE)

## general P-spline
DemoNull(n = 100, k = 10, gps = TRUE)

ZheyuanLi/gps.mgcv documentation built on Sept. 19, 2024, 9:11 p.m.