Introduction to Smoothing Splines

Slides:



Advertisements
Similar presentations
The Simple Regression Model
Advertisements

Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 ~ Curve Fitting ~ Least Squares Regression Chapter.
Lecture 10 Curves and Surfaces I
Flexible smoothing with B-splines and Penalties or P-splines P-splines = B-splines + Penalization Applications : Generalized Linear and non linear Modelling.
Interpolation A method of constructing a function that crosses through a discrete set of known data points. .
Lecture 9 Today: Ch. 3: Multiple Regression Analysis Example with two independent variables Frisch-Waugh-Lovell theorem.
Regression Analysis Using Excel. Econometrics Econometrics is simply the statistical analysis of economic phenomena Here, we just summarize some of the.
The General Linear Model. The Simple Linear Model Linear Regression.
Data mining and statistical learning - lecture 6
MATH 685/ CSI 700/ OR 682 Lecture Notes
Basis Expansion and Regularization Presenter: Hongliang Fei Brian Quanz Brian Quanz Date: July 03, 2008.
1 Chapter 4 Interpolation and Approximation Lagrange Interpolation The basic interpolation problem can be posed in one of two ways: The basic interpolation.
1 Curve-Fitting Spline Interpolation. 2 Curve Fitting Regression Linear Regression Polynomial Regression Multiple Linear Regression Non-linear Regression.
EARS1160 – Numerical Methods notes by G. Houseman
統計計算與模擬 政治大學統計系余清祥 2003 年 6 月 9 日 ~ 6 月 10 日 第十六週:估計密度函數
Curve-Fitting Interpolation
Least Square Regression
Curve-Fitting Regression
Engineering Computation Curve Fitting: Interpolation 1
Least Square Regression
Chapter 4 Multiple Regression.
The Islamic University of Gaza Faculty of Engineering Civil Engineering Department Numerical Analysis ECIV 3306 Chapter 17 Least Square Regression.
Gradient Methods May Preview Background Steepest Descent Conjugate Gradient.
Basis Expansions and Regularization Based on Chapter 5 of Hastie, Tibshirani and Friedman.
Human Growth: From data to functions. Challenges to measuring growth We need repeated and regular access to subjects for up to 20 years. We need repeated.
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. by Lale Yurttas, Texas A&M University Chapter 171 CURVE.
1 An Introduction to Nonparametric Regression Ning Li March 15 th, 2004 Biostatistics 277.
Biostatistics-Lecture 14 Generalized Additive Models Ruibin Xi Peking University School of Mathematical Sciences.
Chapter 3 Root Finding.
Human Growth: From data to functions. Challenges to measuring growth We need repeated and regular access to subjects for up to 20 years. We need repeated.
Computational Methods in Physics PHYS 3437 Dr Rob Thacker Dept of Astronomy & Physics (MM-301C)
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 ~ Curve Fitting ~ Least Squares Regression Chapter.
Multiple Linear Regression - Matrix Formulation Let x = (x 1, x 2, …, x n )′ be a n  1 column vector and let g(x) be a scalar function of x. Then, by.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Part 4 Curve Fitting.
V. Space Curves Types of curves Explicit Implicit Parametric.
MECN 3500 Inter - Bayamon Lecture 9 Numerical Methods for Engineering MECN 3500 Professor: Dr. Omar E. Meza Castillo
Chapter 8 Curve Fitting.
Splines Vida Movahedi January 2007.
Model Comparison for Tree Resin Dose Effect On Termites Lianfen Qian Florida Atlantic University Co-author: Soyoung Ryu, University of Washington.
Curve-Fitting Regression
Basis Expansions and Regularization Part II. Outline Review of Splines Wavelet Smoothing Reproducing Kernel Hilbert Spaces.
Lecture 16 - Approximation Methods CVEN 302 July 15, 2002.
L5 – Curves in GIS NGEN06 & TEK230: Algorithms in Geographical Information Systems by: Sadegh Jamali (source: Lecture notes in GIS, Lars Harrie) 1 L5-
Generalized Finite Element Methods
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 ~ Curve Fitting ~ Least Squares Regression.
1 Chapter 4 Interpolation and Approximation Lagrange Interpolation The basic interpolation problem can be posed in one of two ways: The basic interpolation.
Basis Expansions and Generalized Additive Models Basis expansion Piecewise polynomials Splines Generalized Additive Model MARS.
LECTURE 17: BEYOND LINEARITY PT. 2 March 30, 2016 SDS 293 Machine Learning.
Introduction to Parametric Curve and Surface Modeling.
The simple linear regression model and parameter estimation
Piecewise Polynomials and Splines
Chapter 7. Classification and Prediction
Part 5 - Chapter
Part 5 - Chapter 17.
(5) Notes on the Least Squares Estimate
Curve-Fitting Spline Interpolation
Part 5 - Chapter 17.
The regression model in matrix form
Human Growth: From data to functions
Spline Interpolation Class XVII.
Linear regression Fitting a straight line to observations.
Undergraduated Econometrics
Discrete Least Squares Approximation
Least Square Regression
Basis Expansions and Generalized Additive Models (1)
Introduction to Parametric Curve and Surface Modeling
SKTN 2393 Numerical Methods for Nuclear Engineers
政治大學統計系余清祥 2004年5月26日~ 6月7日 第十六、十七週:估計密度函數
CISE-301: Numerical Methods Topic 1: Introduction to Numerical Methods and Taylor Series Lectures 1-4: KFUPM CISE301_Topic1.
Presentation transcript:

Introduction to Smoothing Splines Tongtong Wu Feb 29, 2004

Outline Introduction Interpolating and Smoothing splines Linear and polynomial regression, and interpolation Roughness penalties Interpolating and Smoothing splines Cubic splines Interpolating splines Smoothing splines Natural cubic splines Choosing the smoothing parameter Available software

Key Words roughness penalty penalized sum of squares natural cubic splines

Motivation

Motivation

Motivation

Motivation Spline(y18)

Introduction Linear and polynomial regression : Interpolation Global influence Increasing of polynomial degrees happens in discrete steps and can not be controlled continuously Interpolation Unsatisfactory as explanations of the given data Purposes of modeling Provide a summary to explore and present the relationship between the explanatory variable and the response variable Prediction To study the varying trend in the data Regard the very local variation in the curve as random noise in order to study the more slowly varying trend in the data

Roughness penalty approach A method for relaxing the model assumptions in classical linear regression along lines a little different from polynomial regression.

Roughness penalty approach Aims of curving fitting A good fit to the data To obtain a curve estimate that does not display too much rapid fluctuation Basic idea: making a necessary compromise between the two rather different aims in curve estimation

Roughness penalty approach Quantifying the roughness of a curve An intuitive way: (g: a twice-differentiable curve) Motivation from a formalization of a mechanical device: if a thin piece of flexible wood, called a spline, is bent to the shape of the graph g, then the leading term in the strain energy is proportional to The measure of roughness should not be affected by the addition of a constant or linear function. This leads naturally to the idea of a roughness function that depends on the second derivative of the curve under consideration. Other measurements: max of |g’’|, # of inflection points in g Integrated squared second derivative is a global measure of roughness that has considerable computational advantages.

Roughness penalty approach Penalized sum of squares g: any twice-differentiable function on [a,b] : smoothing parameter (‘rate of exchange’ between residual error and local variation) Penalized least squares estimator Cost of S(g) is determined not only by its goodness-of-fit to the data quantified by the residual sum of squares, but also by its roughness. For given alpha, minimizing S(g) will give the best compromise between smoothness and goodness-of-fit.

Roughness penalty approach Curve for a large value of The main component in S(g) will be roughness penalty term and hence minimizer g_hat will display very little curvature. In the limiting case as alpha tends to infinity the penalty term will be forced to zero and the curve g_hat will approach the linear regression line.

Roughness penalty approach Curve for a small value of The main component in S(g) will be residual SS, and the curve estimate g_hat will track the data closely

Interpolating and Smoothing Splines Cubic splines Interpolating splines Smoothing splines Choosing the smoothing parameter

Cubic Splines Given a<t1<t2<…<tn<b, a function g is a cubic spline if On each interval (a,t1), (t1,t2), …, (tn,b), g is a cubic polynomial The polynomial pieces fit together at points ti (called knots) s.t. g itself and its first and second derivatives are continuous at each ti, and hence on the whole [a,b]

Cubic Splines How to specify a cubic spline Natural cubic spline (NCS) if its second and third derivatives are zero at a and b, which implies d0=c0=dn=cn=0, so that g is linear on the two extreme intervals [a,t1] and [tn,b]. The continuity conditions on g and on its first two derivatives imply various relations between coefficients.

Natural Cubic Splines Value-second derivative representation We can specify a NCS by giving its value and second derivative at each knot ti. Define which specify the curve g completely. However, not all possible vectors represent a natural spline! This expression is not the most convenient representation of a natural cubic spline for computation or for mathematical discussion.

Natural Cubic Splines Value-second derivative representation Theorem 2.1 The vector and specify a natural spline g if and only if Then the roughness penalty will satisfy This expression is not the most convenient representation of a natural cubic spline for computation or for mathematical discussion.

Natural Cubic Splines Value-second derivative representation

Natural Cubic Splines Value-second derivative representation R is strictly diagonal dominant, i.e.  R is positive definite, so we can define

Interpolating Splines To find a smooth curve that interpolate (ti,zi), i.e. g(ti)=zi for all i. Theorem 2.2 Suppose and t1<…<tn. Given any values z1,…,zn, there is a unique natural cubic spline g with knots ti satisfying

Interpolating Splines The natural cubic spline interpolant is the unique minimizer of over S2[a,b] that interpolate the data. Theorem 2.3 Suppose g is the interpolant natural cubic spline, then S2[a,b]: space of functions that are differentiable on [a,b] and have absolutely continuous first derivative

Smoothing Splines Penalized sum of squares g: any twice-differentiable function on [a,b] : smoothing parameter (‘rate of exchange’ between residual error and local variation) Penalized least squares estimator

Smoothing Splines 1. The curve estimator is necessarily a natural cubic spline with knots at ti, for i=1,…,n. Proof: suppose g is the NCS

Smoothing Splines 2. Existence and uniqueness Let then since be precisely the vector of . Express ,

Smoothing Splines 2. Theorem 2.4 Let be the natural cubic spline with knots at ti for which . Then for any in S2[a,b]

Smoothing Splines 3. The Reinsch algorithm The matrix has bandwidth 5 and is symmetric and strictly positive-definite, therefore it has a Cholesky decomposition Where D is a strictly positive diagonal matrix and L is a lower triangular band matrix with L_ij=0 for j<i-2 and j>i, and L_ii=1 for all i. The matrix Q and R can all be found in O(n) algebraic operations, provided only the non-zero diagonals are stored. Hence, the matrices L and D require only linear time for their computation.

Smoothing Splines 3. The Reinsch algorithm for spline smoothing Step 1: Evaluate the vector . Step 2: Find the non-zero diagonals of and hence the Cholesky decomposition factors L and D. Step 3: Solve for by forward and back substitution. Step 4: Find g by .

Smoothing Splines 4. Some concluding remarks Minimizing curve essentially does not depend on a and b, as long as all the data points lie between a and b. If n=2, for any , setting to be the straight line through the two points (t1,Y1) and (t2,Y2) will reduce S(g) to zero. If n=1, the minimizer is no longer unique, since any straight line through (t1,Y1) will yield a zero value S(g).

Choosing the Smoothing Parameter Two different philosophical approaches Subjective choice Automatic method – chosen by data Cross-validation Generalized cross-validation

Choosing the Smoothing Parameter Cross-validation Generalized cross-validation EDF=tr(I-A(alpha))

Available Software smooth.spline in R Description: Usage: Fits a cubic smoothing spline to the supplied data. Usage: plot(speed, dist) cars.spl <- smooth.spline(speed, dist) cars.spl2 <- smooth.spline(speed, dist, df=10) lines(cars.spl, col = "blue") lines(cars.spl2, lty=2, col = "red") EDF=tr(I-A(alpha))

Available Software Example 1 library(modreg) y18 <- c(1:3,5,4,7:3,2*(2:5),rep(10,4)) xx <- seq(1,length(y18), len=201) (s2 <- smooth.spline(y18)) # GCV (s02 <- smooth.spline(y18, spar = 0.2)) plot(y18, main=deparse(s2$call), col.main=2) lines(s2, col = "blue"); lines(s02, col = "orange"); lines(predict(s2, xx), col = 2) lines(predict(s02, xx), col = 3); mtext(deparse(s02$call), col = 3) EDF=tr(I-A(alpha))

Available Software Example 1 EDF=tr(I-A(alpha))

Available Software Example 2 data(cars) ## N=50, n (# of distinct x) =19 attach(cars) plot(speed, dist, main = "data(cars) & smoothing splines") cars.spl <- smooth.spline(speed, dist) cars.spl2 <- smooth.spline(speed, dist, df=10) lines(cars.spl, col = "blue") lines(cars.spl2, lty=2, col = "red") lines(smooth.spline(cars, spar=0.1)) ## spar: smoothing parameter (alpha) in (0,1] legend(5,120,c(paste("default [C.V.] => df =",round(cars.spl$df,1)), "s( * , df = 10)"), col = c("blue","red"), lty = 1:2, bg='bisque') detach() EDF=tr(I-A(alpha))

Available Software Example 2 EDF=tr(I-A(alpha))

Extensions of Roughness penalty approach Semiparametric modeling: a simple application to multiple regression Generalized linear models (GLM) To allow all the explanatory variables to be nonlinear Additive model approach by relaxing the assumption of linearity on just on of the explanatory variables

Reference P.J. Green and B.W. Silverman (1994) Nonparametric Regression and Generalized Linear Models. London: Chapman & Hall