Skip to content

Error: Incorrect number of probabilities #2

@bakaburg1

Description

@bakaburg1

Hello!

Many compliments for the package! I was exactly looking for a Bayesian tree model with linear models at terminal nodes.
I ran your example and it worked but then I rewrote it to run with only one feature and I got the following error:

This is the code I used:

Error in sample.int(x, size, replace, prob) :
incorrect number of probabilities
local({
    friedman_data = function(n, num_cov, sd_error){
        x = runif(n)
        y = 10*sin(pi*x*x) + 20*(x-.5)^2+10*x+5*x + rnorm(n, sd=sd_error)
        
        return(list(y = y,
                    x = x))
    }
    # Training data
    data = friedman_data(200, 10, 1)
    y = data$y
    x = data$x
    
    # Test data
    data_test = friedman_data(100, 10, 1)
    y.test = data_test$y
    x.test = data_test$x

    # Run MOTR-BART
    set.seed(99)
    fit.motr.bart = motr_bart(x, y, ntrees = 10, nburn = 100, npost = 100)
})

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