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

Handling of missing values #12

Closed
hofnerb opened this issue Jul 22, 2015 · 1 comment
Closed

Handling of missing values #12

hofnerb opened this issue Jul 22, 2015 · 1 comment
Assignees
Labels

Comments

@hofnerb
Copy link
Member

hofnerb commented Jul 22, 2015

The handling of missing values in gamboost is seriously corrupted. Missing values in glmboost are not an issue. For an example to reproduce the issue see below:

### Simulate data with missing values and check if results are correct.
library("mvtnorm")
library("mboost")

set.seed(1234)
x <- rmvnorm(100, mean = rep(0, 10))
head(x)

beta <- c(1, 2, 3, -1, -2, -3, rep(0, 4))
y <- rnorm(100, mean = crossprod(t(x), beta))

## complete data
data <- as.data.frame(x)
names(data) <- paste0("x", 1:10)
data$y <- y
head(data)

## now data with missings
miss <- data
miss$x1[1:10] <- NA
miss$x3[11:20] <- NA

## complete cases from miss
cc <- miss[complete.cases(miss),]

#############################################
## fit glmboost models
#############################################

mod <- glmboost(y ~ ., data = data)
mstop(mod) <- 1000
coef(mod)
## ok

mod <- glmboost(y ~ ., data = miss)
mstop(mod) <- 1000
coef(mod)
## ok

mod <- glmboost(y ~ ., data = cc)
mstop(mod) <- 1000
coef(mod)
## ok

#############################################
## fit gamboost models
#############################################

mod <- gamboost(y ~ ., baselearner = bols, data = data)
mstop(mod) <- 1000
## extract coefficients (and drop intercept of each base-learner)
sapply(coef(mod), function(x) x[2])
## ok

fm <- as.formula(paste0("y ~ ", paste0(paste0("x", c(2, 4:10)), collapse = "+")))
mod <- gamboost(fm, baselearner = bols, data = miss)
sapply(coef(mod), function(x) x[2])
## ok

fm <- as.formula(paste0("y ~ ", paste0(paste0("x", c(1, 3)), collapse = "+")))
mod <- gamboost(fm, baselearner = bols, data = miss)
sapply(coef(mod), function(x) x[2])
## not ok!!

(This issue was reported by Max Schneider)

@hofnerb hofnerb added the bug label Jul 22, 2015
@hofnerb hofnerb self-assigned this Jul 22, 2015
@hofnerb
Copy link
Member Author

hofnerb commented Jul 23, 2015

Also check the impact of na.action in glmboost as reported on stackoverflow.

I guess this is not a real issue.

@hofnerb hofnerb closed this as completed in b7cfb0a Mar 7, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant