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

Fit of Inf or -Inf does not raise an error #18

Closed
ja-thomas opened this issue Oct 15, 2015 · 3 comments
Closed

Fit of Inf or -Inf does not raise an error #18

ja-thomas opened this issue Oct 15, 2015 · 3 comments

Comments

@ja-thomas
Copy link
Member

@ja-thomas ja-thomas commented Oct 15, 2015

When an glmboost model fits values of +/-Inf it does not raise an error, but sets an baselearner to NA. So there can be mboost models with mstop > 1 but every baselearner is NA and no coefficients are fitted (coef(model) is NULL) but no error or warning is shown.

If you fit it with gamboost and bols baselearner an error is raised.

@hofnerb
Copy link
Member

@hofnerb hofnerb commented Oct 15, 2015

Can you please supply a minimal example?

Am 15.10.2015 um 15:25 schrieb ja-thomas:

When an glmboost model fits values of +/-Inf it does not raise an error,
but sets an baselearner to NA. So there can be mboost models with mstop

1 but every baselearner is NA and no coefficients are fitted
(coef(model) is NULL) but no error or warning is shown.

If you fit it with gamboost and bols baselearner an error is raised.


Reply to this email directly or view it on GitHub
#18.

@ja-thomas
Copy link
Member Author

@ja-thomas ja-thomas commented Oct 16, 2015

After some additional testing, it seems to have something to do with the offset value of the family. The problem first appears in gamboostLSS where offset values are written in the family objects.

library(gamboostLSS)
###generate data###


set.seed(15102015)
n = 1000
v1 <- rnorm(n, mean = 1)
v2 <- rnorm(n, mean = 1)
v3 <- rnorm(n, mean = 1)
v4 <- rnorm(n, mean = 1)
v5 <- rnorm(n, mean = 1)
v6 <- rnorm(n, mean = 1)


inf <- cbind(1, v1,v2,v3,v4,v5,v6)

mu_c <- c(1,2,1,5,1,2,8)
sigma_c <- c(2,1,1,5,1,12,6)

mu <- exp(inf %*% mu_c)
sigma <- exp(inf %*% sigma_c)


y <- rnbinom(n, size = sigma, mu = mu)

data <- data.frame(y, inf[,-1])


###models###


model <- glmboostLSS(y ~. , data = data, families = NBinomialLSS())

model[[2]] # broken model


model_sigma <- glmboost(y ~. , data = data, family = NBinomialSigma(stabilization = "none"))
model_sigma # works just fine




#calculate the fit as mu value for the sigma model
model_mu <- glmboost(y ~ ., data = data, family = NBinomialMu(stabilization = "none"),
                      control = boost_control(mstop = 1))


#sigma model with offset
model_sigma_offset <- glmboost(y ~. , data = data, 
                        family = NBinomialSigma(stabilization = "none", 
                                                mu = fitted(model_mu)))

model_sigma_offset # also broken, at least with warnings

In the second case a warning is given while calculating the model.

@hofnerb
Copy link
Member

@hofnerb hofnerb commented Dec 7, 2015

With gamboost we get an error. Yet, this error is not very informative (and actually seems to be a bug as well):

>  gamboost(y ~. , data = data, family = NBinomialSigma(stabilization = "none", mu = fitted(model_mu)))

Fehler in if (all(tsums < 0)) stop("could not fit base learner in boosting iteration ",  : 
  Fehlender Wert, wo TRUE/FALSE nötig ist
@hofnerb hofnerb closed this in f3c3401 Dec 7, 2015
hofnerb added a commit that referenced this issue Dec 10, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.