Skip to content

Error in .Object$initialize(...) : sigma estimate is NaN when p >= n - 1 #72

@szcf-weiya

Description

@szcf-weiya

Hi,

I am benchmarking various methods for tree regressions, including the dbarts implementation for BART. (https://github.com/szcf-weiya/benchmark.tree.regressions)

I found that when p >= n - 1, the dbarts::bart failed and threw that

Error in .Object$initialize(...) : sigma estimate is NaN

For example, (or check more details here szcf-weiya/benchmark.tree.regressions#15)

dbarts_fit = function(x, y, xtest, ntree = 200) {
  fit = dbarts::bart(x, y, ntree = ntree, keeptrees = TRUE, ndpost = 1000L, nskip = 100L)
  ypred = predict(fit, xtest)
  colMeans(ypred)
}
sim_friedman = function(n = 500, p = 200, sigma = 1, structure = "indep") {
  x = gen_x(n, p, structure = structure)
  y0 = 10 * sin(pi * x[, 1] * x[, 2]) + 20 * (x[, 3] - 0.5)^2 + 10 * x[, 4] + 5 * x[, 5]
  y = y0 + rnorm(n) * sigma
  list(x = x, y = y)
}

Image

it would be better to give a reasonable estimate for sigma when p is large

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions