2. INTRODUCTION
• Predicting continuous variables is
crucial for understanding relationships
between different factors in data
analysis.
• R, a widely used statistical
programming language, provides
powerful tools for predictive modeling.
• Types
• 1.liner Models
• 2.Simple linear regression
• 3. Multiple Regression
Title : Predicting Continuous Variables Using R
3. LINEAR MODELS
• Linear models play a fundamental role
in predictive modeling.
• These models assume a linear
relationship between independent and
dependent variables.
• They are extensively utilized across
various disciplines including
economics, biology, and social
sciences for predictive analysis and
inference.
4. # Example dataset
data <- data.frame(x = c(1, 2, 3, 4, 5),
y = c(2, 4, 5, 4, 5))
# Fit linear model
linear_model <- lm(y ~ x, data)
# Summary of the linear model
summary(linear_model)
CODE
5. SIMPLE LINEAR REGRESSION
• Simple linear regression predicts the relationship between
two variables by fitting a straight line to the observed data
points.
• The mathematical equation for simple linear regression is
y=β0+β1x+ϵ, where:
⚬ y is the dependent variable,
⚬ x is the independent variable,
⚬ β0 is the intercept (the value of y when x is zero),
⚬ β1 is the slope (the change in y for a one-unit change
in x),
⚬ ϵ represents the error term.
• The goal of simple linear regression is to estimate the
values of β0 and β1 that minimize the sum of squared
differences between observed and predicted values.
6. # Example dataset
data <- data.frame(x = c(1, 2, 3, 4, 5),
y = c(2, 4, 5, 4, 5))
# Fit simple linear regression model
simple_linear_model <- lm(y ~ x, data)
# Summary of the simple linear regression model
summary(simple_linear_model)
CODE
7. MULTIPLE REGRESSION
• Multiple regression in R is a statistical technique used to
analyze the relationship between a dependent variable and
two or more independent variables. It extends simple linear
regression, which involves only one independent variable, to
handle situations where multiple predictors may influence the
outcome variable.
8. # Example dataset
data <- data.frame(x1 = c(1, 2, 3, 4, 5),
x2 = c(2, 3, 4, 5, 6),
y = c(2, 4, 5, 4, 5))
# Fit multiple regression model
multiple_regression_model <- lm(y ~ x1 + x2, data)
# Summary of the multiple regression model
summary(multiple_regression_model)
CODE