Predict from a cv_model

# S3 method for bmbstats_cv_model
predict(object, new_data = NULL, type = "numeric", ...)

Arguments

object

A cv_model object.

new_data

A data frame or matrix of new predictors.

type

A single character. The type of predictions to generate. Valid options are:

  • "numeric" for numeric predictions.

...

Not used, but required for extensibility.

Value

A tibble of predictions. The number of rows in the tibble is guaranteed to be the same as the number of rows in new_data.

Examples

m1 <- cv_model( Sepal.Length ~ . - Species, iris )
#> Cross-validating: 5 folds, 10 repeats
#> Done!
predict(m1, new_data = iris)
#> 1 2 3 4 5 6 7 8 #> 5.015416 4.689997 4.749251 4.825994 5.080499 5.377194 4.894684 5.021245 #> 9 10 11 12 13 14 15 16 #> 4.624913 4.881642 5.216496 5.092158 4.745645 4.532906 5.199008 5.560786 #> 17 18 19 20 21 22 23 24 #> 5.093541 4.959767 5.367758 5.225932 5.163072 5.105200 4.796847 4.931043 #> 25 26 27 28 29 30 31 32 #> 5.304898 4.831824 4.980862 5.086329 4.950332 4.961991 4.896907 4.909949 #> 33 34 35 36 37 38 39 40 #> 5.532480 5.471002 4.825994 4.678338 4.944503 5.136148 4.619084 5.021245 #> 41 42 43 44 45 46 47 48 #> 4.888854 4.107850 4.749251 4.934649 5.453936 4.634349 5.352493 4.820165 #> 49 50 51 52 53 54 55 56 #> 5.216496 4.885248 6.492521 6.295046 6.513615 5.466023 6.105625 6.146008 #> 57 58 59 60 61 62 63 64 #> 6.446308 5.201659 6.282005 5.599797 5.083151 5.952139 5.567884 6.297270 #> 65 66 67 68 69 70 71 72 #> 5.572873 6.214698 6.164879 5.964216 5.644209 5.636574 6.340841 5.791442 #> 73 74 75 76 77 78 79 80 #> 6.123113 6.343483 6.069265 6.149614 6.303099 6.408148 6.099795 5.473653 #> 81 82 83 84 85 86 87 88 #> 5.500577 5.485312 5.711093 6.339459 6.164879 6.369565 6.371789 5.749676 #> 89 90 91 92 93 94 95 96 #> 5.992523 5.596191 6.000576 6.291440 5.716923 5.136576 5.868185 6.119084 #> 97 98 99 100 101 102 103 104 #> 5.998352 6.069265 4.998355 5.862355 6.867345 6.172514 6.823774 6.712895 #> 105 106 107 108 109 110 111 112 #> 6.697212 7.320166 5.728164 7.209288 6.594387 7.133510 6.442284 6.314340 #> 113 114 115 116 117 118 119 120 #> 6.540121 5.915785 5.959356 6.417166 6.707066 7.856101 7.161275 5.998775 #> 121 122 123 124 125 126 127 128 #> 6.700818 6.040123 7.316560 6.086336 6.877199 7.191799 6.080506 6.281587 #> 129 130 131 132 133 134 135 136 #> 6.480867 7.031102 6.946729 7.754658 6.425219 6.460191 6.740237 6.854304 #> 137 138 139 140 141 142 143 144 #> 6.704424 6.772150 6.210674 6.534292 6.509173 6.210256 6.172514 6.842645 #> 145 146 147 148 149 150 #> 6.654606 6.216085 5.971433 6.383030 6.618246 6.423413