2024-11-17

Introduction

I will be discussing linear regression,which is a statistical function that is fundamental to analytics, and shows how it may be applied in R.

Practical Use

If we have the data on individuals’ heights and weights linear regression can model the relationship between height (independent variable) and weight (dependent variable), allowing weight prediction based on a person’s height.

Formula Used

Linear regression establishes a linear relationship between a dependent variable (what we’re predicting) and one or more independent variables (used to predict). The equation governing this relationship is:

\(y = \beta0 + \beta1x + \epsilon\)

Variables

y is the dependent variable

\(\beta0\) is the intercept (y-intercept)

\(\beta1\) is the slope

x is the independent variable

\(\epsilon\) is the error term

Plotly Graphic in the Howell

Above is the representation of the Howell people on their heights and weights.

GGPlot 1

ggplot(data = howell, aes(x = height, y = weight)) +
  geom_point() +
  labs(title = "Weight vs. Height", x = "Height (cm)", y = "Weight (kg)")

GGPlot 2

ggplot(howell, aes(x = height, y = weight, color = sex)) +
  geom_line() +
  labs(title = "Height vs. Weight (Men vs Women)", x = "Height", y = "Weight")

In this multi line plot you will see the height vs weight and the comparisons between the sexes.