Description Usage Arguments Details Value Author(s) References See Also Examples
This function performs linear regression with functional responses and scalar predictors by (1) fitting a separate linear model at each point along the function, and then (2) smoothing the resulting coefficients to obtain coefficient functions.
1 2 3 4 5 6 7 8 9 
Y 
the functional responses, given as an n\times d matrix. 
X 
n\times p model matrix, whose columns represent scalar predictors. Should ordinarily include a column of 1s. 
argvals 
the d argument values at which the functional responses are evaluated, and at which the coefficient functions will be evaluated. 
nbasis 
number of basis functions used to represent the coefficient functions. 
norder 
norder of the spline basis, when 
pen.order 
order of derivative penalty. 
basistype 
type of basis used. The basis is created by an appropriate
constructor function from the fda package; see

Unlike fosr
and pffr
, which obtain smooth
coefficient functions by minimizing a penalized criterion, this function
introduces smoothing only as a second step. The idea was proposed by Fan
and Zhang (2000), who employed local polynomials rather than roughness
penalization for the smoothing step.
An object of class fosr
, which is a list with the following
elements:
fd 
object of class 
raw.coef 
d\times p matrix of coefficient estimates from
regressing on 
raw.se 
d\times p matrix of standard errors of the raw coefficient estimates. 
yhat 
n\times d matrix of fitted values. 
est.func 
d\times p matrix of coefficient function
estimates, obtained by smoothing the columns of 
se.func 
d\times p matrix of coefficient function standard errors. 
argvals 
points at which the coefficient functions are evaluated. 
lambda 
smoothing parameters (chosen by REML) used to smooth the p coefficient functions with respect to the supplied basis. 
Philip Reiss phil.reiss@nyumc.org and Lan Huo
Fan, J., and Zhang, J.T. (2000). Twostep estimation of functional linear models with applications to longitudinal data. Journal of the Royal Statistical Society, Series B, 62(2), 303–322.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18  require(fda)
# Effect of latitude on daily mean temperatures
tempmat = t(CanadianWeather$dailyAv[,,1])
latmat = cbind(1, scale(CanadianWeather$coord[ , 1], TRUE, FALSE)) # centred!
fzmod < fosr2s(tempmat, latmat, argvals=day.5, basistype="fourier", nbasis=25)
par(mfrow=1:2)
ylabs = c("Intercept", "Latitude effect")
for (k in 1:2) {
with(fzmod,matplot(day.5, cbind(raw.coef[,k],raw.coef[,k]2*raw.se[,k],
raw.coef[,k]+2*raw.se[,k],est.func[,k],est.func[,k]2*se.func[,k],
est.func[,k]+2*se.func[,k]), type=c("p","l","l","l","l","l"),pch=16,
lty=c(1,2,2,1,2,2),col=c(1,1,1,2,2,2), cex=.5,axes=FALSE,xlab="",ylab=ylabs[k]))
axesIntervals()
box()
if (k==1) legend("topleft", legend=c("Raw","Smoothed"), col=1:2, lty=2)
}

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.