View source: R/performance_accuracy.R

performance_accuracy | R Documentation |

This function calculates the predictive accuracy of linear or logistic regression models.

```
performance_accuracy(
model,
method = c("cv", "boot"),
k = 5,
n = 1000,
ci = 0.95,
verbose = TRUE
)
```

`model` |
A linear or logistic regression model. A mixed-effects model is also accepted. |

`method` |
Character string, indicating whether cross-validation
( |

`k` |
The number of folds for the k-fold cross-validation. |

`n` |
Number of bootstrap-samples. |

`ci` |
The level of the confidence interval. |

`verbose` |
Toggle warnings. |

For linear models, the accuracy is the correlation coefficient
between the actual and the predicted value of the outcome. For
logistic regression models, the accuracy corresponds to the
AUC-value, calculated with the `bayestestR::auc()`

-function.

The accuracy is the mean value of multiple correlation resp.
AUC-values, which are either computed with cross-validation
or non-parametric bootstrapping (see argument `method`

).
The standard error is the standard deviation of the computed
correlation resp. AUC-values.

A list with three values: The `Accuracy`

of the model
predictions, i.e. the proportion of accurately predicted values from the
model, its standard error, `SE`

, and the `Method`

used to compute
the accuracy.

```
model <- lm(mpg ~ wt + cyl, data = mtcars)
performance_accuracy(model)
model <- glm(vs ~ wt + mpg, data = mtcars, family = "binomial")
performance_accuracy(model)
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.