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

bug in cvrisk.mboostLSS() if families at default #9

Closed
sbrockhaus opened this issue Feb 5, 2016 · 0 comments
Closed

bug in cvrisk.mboostLSS() if families at default #9

sbrockhaus opened this issue Feb 5, 2016 · 0 comments

Comments

@sbrockhaus
Copy link
Member

If the families argument is not specified explicitly in mboostLSSone gets an error in cvrisk.mboostLSS() (spotted by Almond Stöcker).
See the following MWP:

library(gamboostLSS)

### Data generating process:
set.seed(1907)
x1 <- rnorm(1000)
mu    <- 2*x1
sigma <- rep(1, 1000)
y <- numeric(1000)
for( i in 1:1000)
       y[i] <- rnorm(1, mean = mu[i], sd=sigma[i])

dat <- data.frame(x1=x1, y=y)

## model with default families 
model <- mboostLSS(y ~ bbs(x1), data = dat)

## cvrisk.mboostLSS() does not work as families was not specified in model call
cvr <- cvrisk(model, folds = cv(model.weights(model), B=3), trace=FALSE)


## model with families = GaussianLSS()
model2 <- mboostLSS(y ~ bbs(x1), families = GaussianLSS())

## works as families was specified in model call
cvr2 <- cvrisk(model2, folds = cv(model.weights(model2), B=3), trace=FALSE)

I think that a possible fix is to define familiesin clin mboostLSS after line
https://github.com/hofnerb/gamboostLSS/blob/master/pkg/R/mboostLSS.R#L8
by adding

if(is.null(cl$families)) cl$families <- GaussianLSS()

Best

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

1 participant