Splines Flashcards

1
Q

Spline function definition

A

[a,b] -> R with m knots (m-2 internal) of degree l if:
- (l-1) order continuously differentiable;
- Within each m-1 interval, different polynomial of degree l.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Number of free parameters in splines

A

d = l + m - 1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Truncated power basis

A

Bj(z) =
- zj j=1,…l+1
- (z-kj-1)l+ j=l+2,…d

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

B-splines definition

A

Defined recursively
- Values > 0 only between a pair of knots
- Σ Bj(z) = 1 ∀ z
- ∀ z ∈ [a,b] only (l+1) bases are > 0.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

MLE for B-splines

A

β^ = (Z’Z)-1Z’y

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Model selection for splines

A

LRT only if using truncated power basis for add/removal of knots.
All other cases (B-splines, movement of knots), model selection criteria.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

P-splines definition

A
  1. We start with a high number of m-2 internal knots;
  2. We remove some using the penalized log-likelihood pl(β,σ2) = l(β,σ2) - λ/2 Ji(β) = -n/2 ln(σ2) - n/(2σ2) (y-Zβ)’(y-Zβ) - λ/2 β‘Kiβ.
    If λ=0 we have B-splines with no penalization.
    If λ -> + &infty; we tend to have only constant functions (very smooth ones).
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Order differences

A

For B-splines, we can use:
J1(β) = Σj=2dj - βj-1)2 = βK1β’
J2(β) = Σj=3dj - 2βj-1 + βj-2)2 = βK2β’

Ki, dXd matrix made of differential matrices D(d)1, (d-1)Xd and D(d-1)1, (d-2)Xd

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

MLE for P-splines

A

β^ = (Z’Z - ΛKi)-1Z’y
- Λ = λσ2
Equivalent to minimizing the penalized least squares: PLS = (y-Zβ)’(y-Zβ) - Λβ‘Kiβ

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Fitted values P-splines

A

f^ = y - Zβ^ = y - Z(Z’Z-ΛK)-1Z’y = [I - Z(Z’Z-ΛK)-1Z’]y = [I - S]y
S: Smoother matrix

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Effective number of parameters P-splines

A

df(S) = trace(S)
{ edf in output }

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Estimator for σ2 P-splines

A

[Σ(yi - f^(zi))2]/[n - df(S)]
If ML (for AIC and BIC): 1/n * Σ(yi - f^(zi))2]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Choice of best Λ

A
  • CV = 1/n Σ [(yi - f^(zi))/(1 - Sii)]2
  • GCV = 1/n Σ [(yi - f^(zi))/(1 - df(S)/n)]2
  • AIC or BIC, remembering σ2ML^ and number of parameters = df(S)+1
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Inference basis for P-splines

A

Y|Z ∼ Nn (f, σ2In) that leads to:
f^|Z ∼ Nn (Sf, σ2SS)
- P-splines are biased estimators;
- Produced p-values for hypothesis testing are anticonservative: they underestimate the true values.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

B-splines in R

A

library(splines)
internal = m-2
location = quantile(z, probs=(1:internal)/(internal+1))
bsp = bs(z, knots=location, degree=l, intercept=F)
#Equidistant knots: bsp = bs(z, df=d, degree=l)
fit = lm(y~bsp) #Or -1 if intercept=T

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

P-splines in R

A

library(mgcv)
smoothers = s(z, bs=”ps”, k=m, m=c((l-1), i), sp=lambda)
fit = gam(y~smoothers)
#edf = df(S) effective number of parameters
#edf+1 total coefficients