Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stabsel.mboostLSS does not work on FDboost with scalar response #51

Closed
fabian-s opened this issue Mar 10, 2019 · 3 comments
Closed

stabsel.mboostLSS does not work on FDboost with scalar response #51

fabian-s opened this issue Mar 10, 2019 · 3 comments

Comments

@fabian-s
Copy link
Contributor

because this check:

n <- if(inherits(x, "FDboostLSS")) {

assumes a functional response model, I think.

@sbrockhaus
Copy link
Member

To give it a try, I fitted a model with scalar response with FDboost and used stabsel() on it and it worked fine:

library(FDboost)

## simulate a small data set 
set.seed(230)
dat <- list()
dat$X1 <- scale(matrix(rnorm(25*21), nrow = 25), scale = FALSE)
dat$X2 <- scale(matrix(rnorm(25*21), nrow = 25), scale = FALSE)
dat$X3 <- scale(matrix(rnorm(25*21), nrow = 25), scale = FALSE)
dat$X4 <- scale(matrix(rnorm(25*21), nrow = 25), scale = FALSE)
dat$X5 <- scale(matrix(rnorm(25*21), nrow = 25), scale = FALSE)

dat$svals <- seq(0, 1, l = 21)

dat$Y_scalar <- 2 + 0.1 * rowSums(dat$X1) + 0.01 * rowSums(dat$X2)

## fit a FDboost model with scalar response and 6 base-learners 
mod <- FDboost(Y_scalar ~ 1 
               + bsignal(X1, svals, knots = 6, df = 3)
               + bsignal(X2, svals, knots = 6, df = 3) 
               + bsignal(X3, svals, knots = 6, df = 3)
               + bsignal(X4, svals, knots = 6, df = 3)
               + bsignal(X5, svals, knots = 6, df = 3), 
               timeformula = NULL, 
               control = boost_control(mstop = 50), data = dat)
class(mod)

## prepare for stability selection 

### use PFER = 0.1*(number of base-learners)
### use cutoff = 0.9 (rather high cutoff)
cat("cutoff:", 0.9)
cat(" PFER:", 0.1*length(mod$baselearner), "\n")
print(stabsel_parameters(p = length(mod$baselearner), 
                         cutoff = 0.9, PFER = 0.1*length(mod$baselearner)))

# do stability selection
set.seed(2581)  
stab1 <- stabsel(mod, cutoff=0.9, PFER=0.1*length(mod$baselearner), 
                 sampling.type="SS", mc.cores=1)

@sbrockhaus
Copy link
Member

Ah, sorry, I misunderstood. You talk about models that are fitted with FDboostLSS() not about models that are fitted with FDboost(). I will have a look...

@sbrockhaus
Copy link
Member

sbrockhaus commented Mar 17, 2019

As you wrote, the problem is, that the scalar response is treated as a functional response and thus stabsel() does not work. I did some further testing and realized that for functional response, in the current version you have to provide the folds argument, otherwise stabsel fails also for functional response.
I fixed stabsel() for FDboostLSS models with scalar and functional responses. After finishing some checks, I will upload the adapted code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants