Learn R Programming

olsrr (version 0.6.0)

ols_plot_reg_line: Simple linear regression line

Description

Plot to demonstrate that the regression line always passes through mean of the response and predictor variables.

Usage

ols_plot_reg_line(response, predictor, print_plot = TRUE)

Arguments

response

Response variable.

predictor

Predictor variable.

print_plot

logical; if TRUE, prints the plot else returns a plot object.

Examples

Run this code
ols_plot_reg_line(mtcars$mpg, mtcars$disp)

Run the code above in your browser using DataLab