Description Usage Arguments Details Value References See Also Examples

View source: R/baselearnersX.R

Base-learners that fit historical functional effects that can be used with the
tensor product, as, e.g., `hbistx(...) %X% bolsc(...)`

, to form interaction
effects (Ruegamer et al., 2016).
For expert use only! May show unexpected behavior
compared to other base-learners for functional data!

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)
``` |

`x` |
object of type |

`limits` |
defaults to |

`standard` |
the historical effect can be standardized with a factor. "no" means no standardization, "time" standardizes with the current value of time and "lenght" standardizes with the lenght of the integral |

`intFun` |
specify the function that is used to compute integration weights in |

`inS` |
historical effect can be smooth, linear or constant in s, which is the index of the functional covariates x(s). |

`inTime` |
historical effect can be smooth, linear or constant in time, which is the index of the functional response y(time). |

`knots` |
either the number of knots or a vector of the positions
of the interior knots (for more details see |

`boundary.knots` |
boundary points at which to anchor the B-spline basis (default the range of the data). A vector (of length 2) for the lower and the upper boundary knot can be specified. |

`degree` |
degree of the regression spline. |

`differences` |
a non-negative integer, typically 1, 2 or 3. Defaults to 1.
If |

`df` |
trace of the hat matrix for the base-learner defining the
base-learner complexity. Low values of |

`lambda` |
smoothing parameter of the penalty, computed from |

`penalty` |
by default, |

`check.ident` |
use checks for identifiability of the effect, based on Scheipl and Greven (2016); see Brockhaus et al. (2017) for identifiability checks that take into account the integration limits |

`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]*.
The base-learner `bhistx`

can be used to set up complex interaction effects
like factor-specific historical effects as discussed in Ruegamer et al. (2016).

Note that the data has to be supplied as a `hmatrix`

object for
model fit and predictions.

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).

Brockhaus, S., Melcher, M., Leisch, F. and Greven, S. (2017): Boosting flexible functional regression models with a high number of functional historical effects, Statistics and Computing, 27(4), 913-926.

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

Ruegamer D., Brockhaus, S., Gentsch K., Scherer, K., Greven, S. (2016). Detecting synchronisation in EEG- and EMG-Signals via boosted functional historical models. http://arxiv.org/abs/1609.06070

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 and `bhist`

for simple hisotorical effects.

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)
}
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.