boost-R/FDboost

defaults for cross-validation for non-cyclical FDboostLSS

Almond-S opened this issue · 1 comments

When fitting an FDboostLSS model with method = "noncyclic" the resulting S3-object has the classes nc_mboostLSS, FDboostLSS and mboostLSS in this order. Thus, the defaults specified in FDboost:::cvrisk.FDboostLSS won't apply. (See code below.)
Two quick ideas would be to A) change the class order, if that's unproblematic, or B), stress that the folds have to be specified manually in the documentation and deprecate FDboost:::cvrisk.FDboostLSS.

library(FDboost)
library(gamboostLSS)

########### simulate Gaussian function-on-scalar data
n <- 50 ## number of observations
G <- 12 ## number of observations per functional covariate

set.seed(123) ## ensure reproducibility
n_innerknots <- 4
B <- mboost:::bsplines(1:G, knots = 4, boundary.knots = c(1,G), degree = 2)
theta <- rnorm(ncol(B)) ## sample coefficients for x = 1

x <- runif(n) ## sample covariates
y <- B %*% matrix( rnorm(n*length(theta), mean = rep(theta, n) * rep(x, each = length(theta)), sd = rep(x, each = length(theta))), ncol = n) ## sample response

dat_list <- list(y = t(y), x = x, t = 1:G)

## model fit assuming Gaussian location scale model 
model <- FDboostLSS(formula = y ~ bols(x, df = 2), 
                    timeformula = ~ bbs(t, df = 2), 
                    data = dat_list, method = "noncyclic")

class(model)

## -> cvrisk.nc_mboostLSS is directly applied
debug(cvrisk)
cvrisk(model)

thank you for the bug report. this was unintended. Now a model object that is fitted by FDboostLSS has as first class 'FDboostLSS' and thus the correct version of cvrisk is called.