Linear regression solved examples
Answers
Answer:
Linear regression is the most basic and commonly used predictive analysis. One variable is considered to be an explanatory variable, and the other is considered to be a dependent variable. For example, a modeler might want to relate the weights of individuals to their heights using a linear regression model.
There are several linear regression analyses available to the researcher.
Simple linear regression
One dependent variable (interval or ratio)
One independent variable (interval or ratio or dichotomous)
Formula for linear regression equation is given by:
y=a+bx
a and b are given by the following formulas:
a(intercept)=∑y∑x2–∑x∑xy(∑x2)–(∑x)2
b(slope)=n∑xy−(∑x)(∑y)n∑x2−(∑x)2
Where,
x and y are two variables on the regression line.
b = Slope of the line.
a = y-intercept of the line.
x = Values of the first data set.
y = Values of the second data set
Solved Examples
Question: Find linear regression equation for the following two sets of data:
x 2 4 6 8
y 3 7 5 10
Solution:
Construct the following table:
x y x2 xy
2 3 4 6
4 7 16 28
6 5 36 30
8 10 64 80
∑x = 20 ∑y = 25 ∑x2 = 120 ∑xy = 144
b = n∑xy−(∑x)(∑y)n∑x2−(∑x)2
b = 4×144–20×254×120–400
b = 0.95
a=∑y∑x2–∑x∑xyn(∑x2)–(∑x)2
a=25×120–20×1444(120)–400
a = 1.5
Linear regression is given by:
y = a + bx
y = 1.5 + 0.95 x