The goal of lmPlot is to fit two variables from a given data frame into a linear model and visualize it.
The function plot_lm()
takes in two arguments from the provided tibble
column variables and creates a graph based on the linear model from the
variables.
lmPlot is not yet on CRAN. You can install the development version from GitHub with:
# install.packages("devtools")
devtools::install_github("stat545ubc-2021/lmPlot")
This is a basic example which shows you how to plot the linear model of
two variables: cyl
- Number of cylinders and mpg
- Miles/(US) gallon
from the mtcars
data:
library(lmPlot)
plot_lm(mtcars, cyl, mpg, na.rm = T)
#> `geom_smooth()` using formula 'y ~ x'