Functional Regression
Using the fda Package in R
Spencer Graves, Giles Hooker, James Ramsay
Ramsay, Hooker and Graves (2009) Functional Data Analysis with
R and Matlab (Springer)
1 / 14
This Presentation
What Is Functional Regression?
Different types of Functional Regression
fRegress: 3 examples + formula interface
linmod: Full Integration Regression
pda.fd: Estimating a Differential Equation
Closing Remarks
References
2 / 14
What Is Functional Regression?
Functional Data Analysis extends spline smoothing to:
an arbitrary finite basis approximation to a function space
smoothing with an arbitrary linear differential operator
Functional regression = fitting a model where
the response or
an explanatory variable
is a function.
3 / 14
Different types of Functional Regression
Functional regression = fitting a model where
the response or
an explanatory variable
is a function.
response
scalar
function
scalar
lm
fRegress.fdPar
Explanatory Variable
function
fRegress.numeric
fRegress.fdPar / linmod / pda.df
R code for all of these appears in script files in the fda package
4 / 14
fRegress.numeric: Scalar Response
Z
yi = α0 +
xi (t)β(t)dt + ²i .
log(annual precipitation) ˜ (temperature profile)
0
Beta for temperature
^
β(t)
Jan
Mar
May
Jul
Sep
Nov
5 / 14
log(annual precipitation) ˜ temperature(t)
0
Beta for temperature
^
β(t)
Jan
Mar
May
Jul
Sep
Conclusion: Wetter locations tend to be
cooler in February and August and
warmer in May and November
Ramsay, Hooker, Graves (2009, Fig. 9.1)
Nov
6 / 14
fRegress.numeric: functional response, x = scalar
yi (t) = β0 (t) +
X
xij βj (t) + ²i (t)
temperature ˜ region; Region Deviation:
Q1
Pacific
Q2
Q3
Q4
Q1
Continental
Arctic
Q2
Q3
Q4
Atlantic
beta.region
10
0
−10
Q1
Q2
Q3
Q4
Q1
Q2
Q3
Q4
Ramsay, Hooker, Graves (2009, Fig. 10.1)
7 / 14
fRegress.fdPar: Concurrent Functional Model
yi (t) = β0 (t) +
X
xij (t)βj (t) + ²i (t)
(knee angle) ˜ (hip angle)
0.0
0.2
0.4
0.6
Hip Coefficient and Squared Multiple Correlation
0
5
10
15
20
gait cycle
Ramsay, Hooker and Graves (2009, Fig. 10.7)
8 / 14
fRegress.formula: Simple fRegress Setup
Traditional: fRegress(y, xlist, betalist)
Formula interface:
model <- fRegress(y ˜ x, method=’model’)
model = list(y, xlist, betalist)
Manually adjust model to get what you want.
Easier than manual set up, esp. w. x factors?
9 / 14
linmod: Full Integration Regression
Z
yi (t) = β0 (t) +
Ωt
β1 (t, s)xi (s)ds + ²i (t)
β1 (t, s) = bivariate regression coefficient function Ωt = {s < t}:
historical linear model Ωt = unconstrained: full integration
regression
Example:
Swedish Female Mortality 1751 to 1914 Cohorts
Z
xi+1 (t) = β0 (t) + β1 (s, t)xi (t)ds + ²i (t)
xi (t) = log(hazard) at age t for cohort i
10 / 14
linmod: Full Integration Regression
Z
xi+1 (t) = β0 (t) +
β1 (s, t)xi (t)ds + ²i (t)
beta
s
t
Ramsay, Hooker and Graves (2009, Fig. 10.11)
11 / 14
pda.fd: Estimating a Differential Equation
200 400 600 800 1000
(1)
0.35
0.315
0.105
0.14
0.28
0.07
0.245
0.175
0
0.035
0
beta 0
D 2 x(t) = −β1 (t)Dx(t) − β0 (t)x(t)
−200
0.21
−50
0
50
100
beta 1
Ramsay, Hooker and Graves (2009, Fig. 11.4)
12 / 14
Closing Remarks
The fda package for R supports several types of functional
regression
including regression with either scalars or functions
as either response or explanatory variables
and estimating non-constant coefficients in a differential equation
13 / 14
References
Software: Ramsay, Wickham, Graves and Hooker (2009) fda:
Functional Data Analysis. R package, version 2.1.2
(www.functionaldata.org)
How to: Ramsay, Hooker and Graves (2009) Functional Data
Analysis with R and Matlab (Springer, ch. 11)
Theory: Ramsay and Silverman (2005) Functional Data Analysis,
2nd ed. (Springer)
14 / 14
© Copyright 2026 Paperzz