funRsquared function

Functional R-squared

Functional R-squared

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

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

Arguments

  • object: fitted FDboost-object
  • overTime: per default the functional R-squared is calculated over time if overTime=FALSE, the R-squared is calculated per curve
  • breaks: 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.
  • global: logical. defaults to FALSE, if TRUE the global R-squared like in a normal linear model is calculated
  • ...: currently not used

Returns

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

Details

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)\mu(t) is locally very good. The observations are interpolated linearly if necessary.

Formula to calculate R-squared over time, overTime=TRUE:

R2(t)=1i(Yi(t)Y^i(t))2/i(Yi(t)Yˉ(t))2R^2(t) = 1 - \sum_{i}( Y_i(t) - \hat{Y}_i(t))^2 / \sum_{i}( Y_i(t) - \bar{Y}(t) )^2

Formula to calculate R-squared over subjects, overTime=FALSE:

Ri2=1(Yi(t)Y^i(t))2dt/(Yi(t)Yˉi)2dtR^2_i = 1 - \int (Y_i(t) - \hat{Y}_i(t))^2 dt / \int (Y_i(t) - \bar{Y}_i )^2 dt

Note

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.

References

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

  • Maintainer: David Ruegamer
  • License: GPL-2
  • Last published: 2023-08-12