Skip to content

Error when predicting with large N #57

@bryorsnef

Description

@bryorsnef

I'm getting an error when trying to predict using gamboost, but the error only appears for me when the N becomes large.

E.g. running this code with 10000 rows of data is fine.

try with 10000 obs

p <- 10
n <- 10000

x <- matrix(runif(np), nrow = n, ncol = p)
coefs <- ifelse(runif(p) < 0.5, rnorm(p), 0)
y <- x %
% coefs + rnorm(n)
x[,10] <- ifelse(runif(n) < 0.5, x[,10], NA)

xy <- data.frame(x,y)

forms <- list(mu = as.formula(X10 ~ .), phi = as.formula(X10 ~ .))

mod <- gamboostLSS(forms, data = xy[!is.na(xy[,10]),], families = BetaLSS())

preds <- predict(mod, newdata = xy[is.na(xy$X10),], type = "response")

no error

try with 50000 obs, error

p <- 10
n <- 50000

x <- matrix(runif(np), nrow = n, ncol = p)
coefs <- ifelse(runif(p) < 0.5, rnorm(p), 0)
y <- x %
% coefs + rnorm(n)
x[,10] <- ifelse(runif(n) < 0.5, x[,10], NA)

xy <- data.frame(x,y)

forms <- list(mu = as.formula(X10 ~ .), phi = as.formula(X10 ~ .))

mod <- gamboostLSS(forms, data = xy[!is.na(xy[,10]),], families = BetaLSS())

preds <- predict(mod, newdata = xy[is.na(xy$X10),], type = "response")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions