knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "README-" )
The olsrr package provides following tools for building OLS regression models using R:
# Install release version from CRAN install.packages("olsrr") # Install development version from GitHub # install.packages("pak") pak::pak("rsquaredacademy/olsrr")
library(olsrr) library(dplyr) library(ggplot2) library(gridExtra) library(nortest) library(goftest)
olsrr uses consistent prefix ols_
for easy tab completion. If you know how to write a formula
or build models using lm
, you will find olsrr very useful. Most of the functions use an object of class lm
as input. So you just need to build a model using lm
and then pass it onto the functions in olsrr. Below is
a quick demo:
model <- lm(mpg ~ disp + hp + wt + qsec, data = mtcars) ols_regress(model)
If you encounter a bug, please file a minimal reproducible example using reprex on github. For questions and clarifications, use StackOverflow.
Please note that the olsrr project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.