FunRegPoI: FunRegPoI

View source: R/FunRegPoI.R

FunRegPoIR Documentation

FunRegPoI

Description

Functional Linear Regression with Points of Impact

Usage

FunRegPoI(Y, X_mat, grd, add.vars = NULL, estimator = c("PESES", "KPS",
  "CKS"), maxPoI = 8, A_m, X_B, ...)

Arguments

Y

A vector of length N containing the scalar dependent variable.

X_mat

A p \times N-matrix holding the functional predictors, where p is the number of grid points provided by grd and N is the number of observations.

grd

A vector of length p giving the location of the (equidistant) grid where the functional observations are observed.

add.vars

Additional explanatory variables (optional, e.g. seasonal dummies or further scalar valued covariates, supplied as a matrix.

estimator

Character, one of "PESES" , "KPS" (Kneip, Poss and Sarda, 2016), "CKS" (Crambes, Kneip and Sarda, 2016), see details.

maxPoI

Maximum number of PoIs.

A_m

An optional p \times p matrix holding the scalar product of the basis function's second derivatives. Specifying this argument togehter with the X_B only makes sense in situations, where the estimation is performed many times on the same domain (grd) in order to speed up the calculation, as for instance in simulation studies. This matrix can be obtained via the function calSecDerNatSpline.

X_B

An optional p \times p matrix of the natural cubic spline basis evaluated at grd, provided together with A_m. This matrix can be obtained via the function calSecDerNatSpline.

...

Further arguments passed to optim().

Details

FunRegPoI estimates the functional linear regression model with points of impact. It offers the usage of different estimators, such as the originally suggested FPCA-based approach or an estimation approach based on smoothing splines. In particular, the PESES approach as proposed in Liebl, Rameseder, Rust (2017), is implemented.

FunRegPoI estimates the functional linear regression model with points of impact (Kneip, Poss, Sarda, 2010). In addition to the proposed FPCA-based estimator, an estimation procedure based on smoothing splines is available. This approach is based on the work of Crambes, Kneip and Sarda (2009) which is extended to the situation with points of impact in Liebl, Rameseder, Rust (2017). The default estimator in this situation is called "PESES" and implements the proposed estimation procedure which consists in a sequential selection procedure, see Liebl, Rameseder, Rust (2017) for a more detailed description:

  1. Preselect potential points of impact.

  2. Estimate a β-curve and PoI coefficients given the potential points of impact.

  3. Sub-Select relevant points of impact.

  4. re-Estimate a final β-curve and PoI cofficients given the selected points of impact.

  5. re-Select the final set of points of impact.

Value

Object of class "FunRegPoI":

coefficients

A list holding the estimated β-curve (betaCurve), the PoI coefficients (betaPoI), coefficients for additional variables if provided (betaAddVar), the PoI's location in the domain (tauGrd) transformed to the unit interval with corresponding grd-indices (tauInd) and the number of PoIs (selS).

residuals

A vector of length p with residuals of the fit.

fitted

A vector of length p with fitted values of the estimate.

call

Type of the estimator (PESES , CKS, or KPS).

model

A list containing the relevant model parameters, such as k, rho, gcv, covariance function between Y and decorrelated X, effective degrees of freedom, BIC and the hat matrix.

kSeqRes

A list of same length as k_seq holding the estimation result for each k in k_seq. These estimation results are used during estimation procedure to find the optimal fit with respect to the selected criterium.

Note

The estimation procedure retransforms any grd covering a domain different from [0,1] onto the unit interval. Also the estimation output is defined on this interval and has to be interpreted accordingly. Of course, this has no effect on the estimates of the points of impact coefficients, but their location also is transformed to the unit interval.

Author(s)

Dominik Liebl, Stefan Rameseder and Christoph Rust

References

Crambes, C., Kneip, A., Sarda, P. (2009) Smoothing Splines Estimators for Functional Linear Regression. The Annals of Statistics, 37(1), 35-72.

Kneip A., Poss, D., Sarda, P. (2016) Functional Linear Regression with Points of Impact. The Annals of Statistics, 44(1), 1-30.

Liebl, D., Rameseder, S., Rust, C. (2018) Improving Estimation in Functional Linear Regression with Points of Impact: Insights into Google AdWords. Available at www.dliebl.com/files/Liebl_Rameseder_Rust_2017.pdf

See Also

FunRegPoISim, calSecDerNatSpline

Examples

library(FunRegPoI)

## Define Parameters for Simulation
DGP_name    <- "Easy"
k_seq       <- c(1,seq(2, 62, 4))
error_sd    <- 0.125
N           <- 500
p           <- 300
domain      <- c(0,1)
grd         <- seq(domain[1],domain[2],length.out = p)

set.seed(1)
## simulate some data:
PoISim      <- FunRegPoISim(N = N , grd, DGP = DGP_name , error_sd = error_sd)

# PESES
EstPeses    <- FunRegPoI(Y = PoISim$Y , X_mat = PoISim$X , grd, estimator = "PESES", k_seq = k_seq)

# KPS
EstKPS      <- FunRegPoI(Y = PoISim$Y , X_mat = PoISim$X , grd, estimator = "KPS", k_seq = k_seq)


# CKS
EstCKS      <- FunRegPoI(Y = PoISim$Y , X_mat = PoISim$X , grd, estimator = "CKS")

par(mfrow=c(3,1))
plot(EstPeses, main = "PESES")
lines(x = grd , y = PoISim$trueBetaCurve , col ="red")
abline( v = PoISim$trueTauGrd , col ="red" , lwd = 2)
plot(EstKPS, main = "KPS")
lines(x = grd , y = PoISim$trueBetaCurve , col ="red")
abline( v = PoISim$trueTauGrd , col ="red" , lwd = 2)
plot(EstCKS, main = "KPS")
lines(x = grd , y = PoISim$trueBetaCurve , col ="red")

abline( v = PoISim$trueTauGrd , col ="red" , lwd = 2)
dev.off()


christophrust/FunRegPoI documentation built on April 10, 2022, 2:22 p.m.