This function uses the out-of-bag predictions to calculate overall performance metrics and returns the observed and predicted data.

resampleSummary(obs, resampled, index = NULL, keepData = TRUE)

Arguments

obs

A vector (numeric or factor) of the outcome data

resampled

For bootstrapping, this is either a matrix (for numeric outcomes) or a data frame (for factors). For cross-validation, a vector is produced.

index

The list to index of samples in each cross-validation fold (only used for cross-validation).

keepData

A logical for returning the observed and predicted data.

Value

A list with:

metrics

A vector of values describing the bootstrap distribution.

data

A data frame or NULL. Columns include obs, pred and group (for tracking cross-validation folds or bootstrap samples)

Details

The mean and standard deviation of the values produced by postResample are calculated.

See also

Examples

resampleSummary(rnorm(10), matrix(rnorm(50), ncol = 5))
#> $metrics #> RMSE Rsquared MAE RMSE Rsquared MAE #> 0.9045944 0.2121159 0.7735747 0.2667396 0.2489411 0.2315838 #> #> $data #> obs pred group #> 1 0.71266631 0.291446236 Resample 1 #> 2 -0.07356440 -0.443291873 Resample 1 #> 3 -0.03763417 0.001105352 Resample 1 #> 4 -0.68166048 0.074341324 Resample 1 #> 5 -0.32427027 -0.589520946 Resample 1 #> 6 0.06016044 -0.568668733 Resample 1 #> 7 -0.58889449 -0.135178615 Resample 1 #> 8 0.53149619 1.178086997 Resample 1 #> 9 -1.51839408 -1.523566800 Resample 1 #> 10 0.30655786 0.593946188 Resample 1 #> 11 0.71266631 0.332950371 Resample 2 #> 12 -0.07356440 1.063099837 Resample 2 #> 13 -0.03763417 -0.304183924 Resample 2 #> 14 -0.68166048 0.370018810 Resample 2 #> 15 -0.32427027 0.267098791 Resample 2 #> 16 0.06016044 -0.542520031 Resample 2 #> 17 -0.58889449 1.207867806 Resample 2 #> 18 0.53149619 1.160402616 Resample 2 #> 19 -1.51839408 0.700213650 Resample 2 #> 20 0.30655786 1.586833455 Resample 2 #> 21 0.71266631 0.558486426 Resample 3 #> 22 -0.07356440 -1.276592208 Resample 3 #> 23 -0.03763417 -0.573265414 Resample 3 #> 24 -0.68166048 -1.224612615 Resample 3 #> 25 -0.32427027 -0.473400636 Resample 3 #> 26 0.06016044 -0.620366677 Resample 3 #> 27 -0.58889449 0.042115873 Resample 3 #> 28 0.53149619 -0.910921649 Resample 3 #> 29 -1.51839408 0.158028772 Resample 3 #> 30 0.30655786 -0.654584644 Resample 3 #> 31 0.71266631 1.767287269 Resample 4 #> 32 -0.07356440 0.716707476 Resample 4 #> 33 -0.03763417 0.910174229 Resample 4 #> 34 -0.68166048 0.384185358 Resample 4 #> 35 -0.32427027 1.682176081 Resample 4 #> 36 0.06016044 -0.635736454 Resample 4 #> 37 -0.58889449 -0.461644730 Resample 4 #> 38 0.53149619 1.432282239 Resample 4 #> 39 -1.51839408 -0.650696353 Resample 4 #> 40 0.30655786 -0.207380744 Resample 4 #> 41 0.71266631 -0.392807929 Resample 5 #> 42 -0.07356440 -0.319992869 Resample 5 #> 43 -0.03763417 -0.279113303 Resample 5 #> 44 -0.68166048 0.494188331 Resample 5 #> 45 -0.32427027 -0.177330482 Resample 5 #> 46 0.06016044 -0.505957462 Resample 5 #> 47 -0.58889449 1.343038825 Resample 5 #> 48 0.53149619 -0.214579409 Resample 5 #> 49 -1.51839408 -0.179556530 Resample 5 #> 50 0.30655786 -0.100190741 Resample 5 #>