kapelner / bartMachine

An R-Java Bayesian Additive Regression Trees implementation
MIT License
62 stars 27 forks source link

Fixed off-by-1 bug in get_sigsqs(after_burn_in=T) #3

Closed moserware closed 10 years ago

moserware commented 10 years ago

get_sigsqs(after_burn_in=T) was returning the sigsqs for the last burn-in forest in addition to all after burn-in forests.

Imagine that you had 250 burn-ins and 1000 after burn-ins (1250 total samples)

Before this change you'd get:

(length(sigsqs) - num_iterations_after_burn_in) : length(sigsqs)

which is equivalent to

(1250 - 1000) : 1250
250:1250
250, 251, ..., 1249, 1250

which has length (1250 - 250) + 1 = 1001.

After this change you'd get:

251:1250
251, 252, ... , 1249, 1250

which has length (1250 - 251) + 1 = 1000

which I believe is the expected behavior.

Thanks for all your work on this interesting package!

kapelner commented 10 years ago

Thanks man!