R: Specify a smoothing spline fit in a PSgam formula

ps {DPpackage} | R Documentation

## Specify a smoothing spline fit in a PSgam formula

### Description

A symbolic wrapper to indicate a smooth term in a formula argument to PSgam

### Usage

    ps(..., k=50,degree=3,pord=1)

### Arguments

`...` | the predictors.
`k` | an integer giving the number of knots. The number of basis functions is k+degree.
`degree` | an integer giving the degree of the B-splines, e.g. degree=3 gives a cubic spline.
`pord` | an integer giving the order of difference penalty.

### Value

`ps` returns the vectors of predictors, endowed with a number of attributes. The vector itself is used in the construction of the model matrix.

Note that `ps` does not do the smoothing; it simply sets things up for `PSgam`.

### Author(s)

Alejandro Jara <atjara@uc.cl>

### References

Eilers, P.H.C. and Marx, B.D. (1996) Flexible Smoothing with B-splines and penalties. Statistical Science, 11(2): 89-121.

### Examples

       # fit Start using a smoothing spline with 4 df.
         y ~ Age + ps(Start, degree=4)
       # fit log(Start) using a smoothing spline with 5 df.
         y ~ Age + ps(log(Start), degree=5)

[Package DPpackage version 1.1-7.4 Index]