funRsquared: Functional R-squared

Description Usage Arguments Details Value Note References


Calculates the functional R-squared for a fitted FDboost-object


funRsquared(object, overTime = TRUE, breaks = object$yind, global = FALSE,



fitted FDboost-object


per default the functional R-squared is calculated over time if overTime=FALSE, the R-squared is calculated per curve


an optional vector or number giving the time-points at which the model is evaluated. Can be specified as number of equidistant time-points or as vector of time-points. Defaults to the index of the response in the model.


logical. defaults to FALSE, if TRUE the global R-squared like in a normal linear model is calculated


currently not used


breaks should be set to some grid, if there are many missing values or time-points with very few observations in the dataset. Otherwise at these points of t the variance will be almost 0 (or even 0 if there is only one observation at a time-point), and then the prediction by the local means μ(t) is locally very good. The observations are interpolated linearly if necessary.

Formula to calculate R-squared over time, overTime=TRUE:
R^2(t) = 1 - ∑_{i}( Y_i(t) - \hat{Y}_i(t))^2 / ∑_{i}( Y_i(t) - \bar{Y}(t) )^2

Formula to calculate R-squared over subjects, overTime=FALSE:
R^2_i = 1 - \int (Y_i(t) - \hat{Y}_i(t))^2 dt / \int (Y_i(t) - \bar{Y}_i )^2 dt


Returns a vector with the calculated R-squared and some extra information in attributes.


breaks cannot be changed in the case the bsignal() is used over the same domain as the response! In that case you would have to rename the index of the response or that of the covariates.


Ramsay, J., Silverman, B. (2006). Functional data analysis. Wiley Online Library. chapter 16.3

Search within the FDboost package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.