# accuracy: Model accuracy In lvmisc: Veras Miscellaneous

## Description

Computes some common model accuracy indices, such as the R squared, mean absolute error, mean absolute percent error and root mean square error.

## Usage

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13``` ```accuracy(model, na.rm = FALSE) ## Default S3 method: accuracy(model, na.rm = FALSE) ## S3 method for class 'lvmisc_cv' accuracy(model, na.rm = FALSE) ## S3 method for class 'lm' accuracy(model, na.rm = FALSE) ## S3 method for class 'lmerMod' accuracy(model, na.rm = FALSE) ```

## Arguments

 `model` An object of class `lvmisc_cv` or an object containing a model. `na.rm` A logical value indicating whether or not to strip `NA` values to compute the indices. Defaults to `FALSE`.

## Details

The method for the `lm` class (or for the `lvmisc_cv` class of a `lm`) returns a data frame with the columns `AIC` (Akaike information criterion), `BIC` (Bayesian information criterion), `R2` (R squared), `R2_adj` (adjusted R squared), `MAE` (mean absolute error), `MAPE` (mean absolute percent error) and `RMSE` (root mean square error).

The method for the `lmerMod` (or for the `lvmisc_cv` class of a `lmerMod`) returns a data frame with the columns `R2_marg` and `R2_cond` instead of the columns `R2` and `R2_adj`. All the other columns are the same as the method for `lm`. `R2_marg` is the marginal R squared, which considers only the variance by the fixed effects of a mixed model, and `R2_cond` is the conditional R squared, which considers both fixed and random effects variance.

## Value

An object of class `lvmisc_accuracy`. See "Details" for more information.

## Examples

 ```1 2 3 4 5 6``` ```mtcars <- tibble::as_tibble(mtcars, rownames = "car") m <- stats::lm(disp ~ mpg, mtcars) cv <- loo_cv(m, mtcars, car, keep = "used") accuracy(m) accuracy(cv) ```

lvmisc documentation built on April 5, 2021, 5:06 p.m.