# bhistx: Base-learners for Functional Covariates In FDboost: Boosting Functional Regression Models

### Description

Base-learners that fit historical functional effects that can be used with the tensor product, as e.g., hbistx(...) %X% bolsc(...). For expert use only! May show unexpected behavior compared to other base-learners for functional data!

### Usage

 1 2 3 4 5 bhistx(x, limits = "s<=t", standard = c("no", "time", "length"), intFun = integrationWeightsLeft, inS = c("smooth", "linear", "constant"), inTime = c("smooth", "linear", "constant"), knots = 10, boundary.knots = NULL, degree = 3, differences = 1, df = 4, lambda = NULL, penalty = c("ps", "pss"), check.ident = FALSE) 

### Arguments

 x object of type hmatrix containing time, index and functional covariate; note that timeLab in the hmatrix-object must be equal to the name of the time-variable in timeformula in the FDboost-call limits defaults to "s<=t" for an historical effect with s<=t; either one of "s

### Details

bhistx implements a base-learner for functional covariates with flexible integration limits l(t), r(t) and the possibility to standardize the effect by 1/t or the length of the integration interval. The effect is stand * int_{l(t)}^{r_{t}} x(s)beta(t,s) ds. The base-learner defaults to a historical effect of the form \int_{T1}^{t} x_i(s)beta(t,s) ds, where T1 is the minimal index of t of the response Y(t). bhistx can only be used if Y(t) and x(s) are observd over the same domain s,t \in [T1, T2].

Note that the data has to be supplied as a hmatrix object for model fit and predictions.

### Value

Equally to the base-learners of package mboost:

An object of class blg (base-learner generator) with a dpp function (dpp, data pre-processing).

The call of dpp returns an object of class bl (base-learner) with a fit function. The call to fit finally returns an object of class bm (base-model).

### References

Brockhaus, S., Melcher, M., Leisch, F. and Greven, S. (2016): Boosting flexible functional regression models with a high number of functional historical effects, Statistics and Computing, accepted.

Marra, G. and Wood, S.N. (2011): Practical variable selection for generalized additive models. Computational Statistics & Data Analysis, 55, 2372-2387.

Scheipl, F., Staicu, A.-M. and Greven, S. (2015): Functional Additive Mixed Models, Journal of Computational and Graphical Statistics, 24(2), 477-501. http://arxiv.org/abs/1207.5947

Scheipl, F. and Greven, S. (2016): Identifiability in penalized function-on-function regression models. Electronic Journal of Statistics, 10(1), 495-526.

FDboost for the model fit.
  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 if(require(refund)){ ## simulate some data from a historical model ## the interaction effect is in this case not necessary n <- 100 nygrid <- 35 data1 <- pffrSim(scenario = c("int", "ff"), limits = function(s,t){ s <= t }, n = n, nygrid = nygrid) data1$X1 <- scale(data1$X1, scale = FALSE) ## center functional covariate dataList <- as.list(data1) dataList$tvals <- attr(data1, "yindex") ## create the hmatrix-object X1h <- with(dataList, hmatrix(time = rep(tvals, each = n), id = rep(1:n, nygrid), x = X1, argvals = attr(data1, "xindex"), timeLab = "tvals", idLab = "wideIndex", xLab = "myX", argvalsLab = "svals")) dataList$X1h <- I(X1h) dataList$svals <- attr(data1, "xindex") ## add a factor variable dataList$zlong <- factor(gl(n = 2, k = n/2, length = n*nygrid), levels = 1:3) dataList$z <- factor(gl(n = 2, k = n/2, length = n), levels = 1:3) ## do the model fit with main effect of bhistx() and interaction of bhistx() and bolsc() mod <- FDboost(Y ~ 1 + bhistx(x = X1h, df = 5, knots = 5) + bhistx(x = X1h, df = 5, knots = 5) %X% bolsc(zlong), timeformula = ~ bbs(tvals, knots = 10), data = dataList) ## alternative parameterization: interaction of bhistx() and bols() mod <- FDboost(Y ~ 1 + bhistx(x = X1h, df = 5, knots = 5) %X% bols(zlong), timeformula = ~ bbs(tvals, knots = 10), data = dataList) ## Not run: # find the optimal mstop over 5-fold bootstrap (small example to reduce run time) cv <- cvrisk(mod, folds = cv(model.weights(mod), B = 5)) mstop(cv) mod[mstop(cv)] appl1 <- applyFolds(mod, folds = cv(rep(1, length(unique(mod$id))), type = "bootstrap", B = 5)) # plot(mod) ## End(Not run) } `