- Linear Regression: What is it?
- Mathematical Foundation
- Linear Regression and its Applications
- Example 2: Analysing Customer Purchasing Patterns
2024-02-04
. Regression analysis is a statistical method that allows us to determine the strength and relationship of two variables.
. When there is a single input variable, the regression is referred to as Simple Linear Regression. We use the single independent variable to model a linear relationship with the dependent target variable.
In linear regression we usually have many different values of the explanatory variable, and we usually assume that values between the observed values of the explanatory variables are also possible values of the explanatory variables. We postulate a linear relationship between the population mean of the outcome and the value of the explanatory variable.(Chapter 9 simple linear regression - Carnegie Mellon University) \[ E(Y|x) = \beta_0 + \beta_1 x\] Where,
\(E(Y|x)\)is the expected value of \(Y\) given \(x\)
\(\beta_0\) is the intercept parameter
\(\beta_1\) is the slope parameter
*Predicting house prices based on size and other factors.
*Analyzing customer buying behavior based on demographics and purchase history.
*Forecasting sales based on advertising spend and market trends.
*Evaluating the impact of smoking on life expectancy.
*Understanding the relationship between education level and income.
Using the Formula: \(Price = \beta_0 +\beta_1(Square footage) +\epsilon\)
Using the Formula: \(Purchaseamount = \beta_0 +\beta_1(Age) +\beta_2(income)+\epsilon\)
Using the Formula: \(CropProduction = \beta_0 +\beta_1(Fertilizer)+\epsilon\)
Creating Example Data Frames
set.seed(42) n_data <- 200 fertilizer <- runif(n_data, min = 50, max = 200) beta0 <- 2000 beta1 <- 5 error <- rnorm(n_data, mean = 0, sd = 50) crop_yield <- beta0 + beta1 * fertilizer + error data <- data.frame( fertilizer = fertilizer, crop_yield = crop_yield )
Chapter 9 simple linear regression - Carnegie Mellon University. (n.d.). https://www.stat.cmu.edu/~hseltman/309/Book/chapter9.pdf