This assumes a continuous response, so that the out-of-sample MSE can be used to estimate the outcome variability \(\sigma\).
Arguments
- fits
The fitted RF model from which to draw samples.
- newdata
A data.frame containing new inputs from which to sample responses. If NULL, defaults to the data used to estimate fit.
- indices
The coordinates of the response from which to draw samples.
- ...
Additional parameters passed to rf_model's predict method.
Examples
m <- rf_model()
fit <- estimator(m)(mpg ~ hp + wt, data = mtcars)
rf_sampler(fit, mtcars)
#> # A tibble: 32 × 1
#> mpg
#> <dbl>
#> 1 23.2
#> 2 22.1
#> 3 31.0
#> 4 24.7
#> 5 19.8
#> 6 18.7
#> 7 13.2
#> 8 25.1
#> 9 12.7
#> 10 21.1
#> # ℹ 22 more rows
prf <- parallelize(ranger::ranger)
fit <- prf(mpg + disp ~ hp + wt, data = mtcars)
rf_sampler(fit, mtcars)
#> # A tibble: 32 × 2
#> mpg disp
#> <dbl> <dbl>
#> 1 26.3 -1669.
#> 2 24.5 -3926.
#> 3 22.4 -286.
#> 4 21.2 652.
#> 5 21.9 3801.
#> 6 13.8 2633.
#> 7 12.0 1532.
#> 8 30.1 737.
#> 9 22.6 4710.
#> 10 9.44 160.
#> # ℹ 22 more rows