0% found this document useful (0 votes)
16 views

Linear Regression

Uploaded by

gamer31411
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

Linear Regression

Uploaded by

gamer31411
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 23

LINEAR REGRESSION

• Linear regression is the next step up after correlation. It


is used when we want to predict the value of a variable
based on the value of another variable. The variable we
want to predict is called the dependent variable (or
sometimes, the outcome variable). The variable we are
using to predict the other variable's value is called the
independent variable (or sometimes, the predictor
variable).
WHAT IS SIMPLE LINEAR REGRESSION?
• You’re probably familiar with plotting line graphs with one X axis and
one Y axis. The X variable is sometimes called the independent
variable and the Y variable is called the dependent variable. Simple
linear regression plots one independent variable X against one
dependent variable Y. Technically, in regression analysis, the
independent variable is usually called the predictor variable and the
dependent variable is called the criterion variable.
However, many people just call them the independent
and dependent variables. More advanced regression
techniques (like multiple regression) use multiple
independent variables.
Regression analysis can result
in linear or nonlinear graphs. A linear regression is
where the relationships between your variables can
be described with a straight line. Non-linear
regressions produce curved lines
HOW TO FIND A LINEAR REGRESSION EQUATION
Regression analysis is used to find equations that fit data. Once
we have the regression equation, we can use the model to
make predictions. One type of regression analysis is linear
analysis. When a correlation coefficient shows that data is
likely to be able to predict future outcomes and a scatter
plot of the data appears to form a straight line, you can
use simple linear regression to find a predictive function.
If you recall from elementary algebra, the equation for a line
is y = mx + b. This article shows you how to take data,
calculate linear regression, and find the equation y’ = a +
bx. Note: if you’re taking AP statistics, you may see the
equation written as b0 + b1x, which is the same thing (you’re
just using the variables b0 + b1 instead of a + b.
THE LINEAR REGRESSION EQUATION

• Linear regression is a way to model the relationship


between two variables. You might also recognize the
equation as the slope formula. The equation has the
form Y= a + bX, where Y is the dependent variable
(that’s the variable that goes on the Y axis), X is the
independent variable (i.e. it is plotted on the X axis),
b is the slope of the line and a is the y-intercept.
FORMULA
Other formula for the value of Slope formula
a:

σ𝑦 𝑏σ𝑥
• 𝑎 = 𝑦ത − 𝑏𝑥ҧ = −
𝑛 𝑛
The first step in finding a linear regression equation is
to determine if there is a relationship between the
two variables.
This is often a judgment call for the researcher. You’ll
also need a list of your data in x-y format (i.E. Two
columns of data—independent and dependent
variables).
HOW TO FIND LINEAR
REGRESSION
Step 1: Make a chart of your data, filling in the columns in the same way
as you would fill in the chart if you were finding the Pearson’s Correlation
Coefficient.
Step 2: use the following equations to find a and b.

σ𝑦 𝑏σ𝑥
𝑎 = 𝑦ത − 𝑏𝑥ҧ = −
𝑛 𝑛

486 0.385225 247


𝑎= −
6 6
𝑎 = 81 − 15.8584
𝑎 = 65.1416
𝑛 σ 𝑥𝑦 − (σ 𝑥)(σ 𝑦)
𝑏=
𝑛 σ 𝑥2 − σ 𝑥 2
6(20485) − (247)(486) σ 𝑦 σ 𝑥 2 − (σ 𝑥)(σ 𝑥𝑦)
𝑏= 𝑎=
𝑛 σ 𝑥2 − σ 𝑥 2
6 11409 − (247)2 486 11409 − (247)(20485)
122910 − 120042 𝑎=
𝑏= 6 11409 − 247 2
68454 − 61009 5544774 − 5059795
2868 𝑎=
𝑏= 𝑜𝑟 0.385225 68454 − 61009
7445 484979
𝑎= 𝑜𝑟 65.1416
7445
Step 3: insert the values into the equation.

•y’ = a + bx
y’ = 65.14 + .385225x
ANOTHER EXAMPLE
Compute the regression line for the given data
below.
𝑛 = 14
σ 𝑥 = 1,076
σ 𝑦 = 1,019
σ 𝑥𝑦 = 81,296
σ 𝑥 2 = 85, 626
use the following equations to find a and b.

σ𝑦 𝑏σ𝑥
𝑎 = 𝑦ത − 𝑏𝑥ҧ = − =
𝑛 𝑛

σ 𝑦 σ 𝑥 2 − (σ 𝑥)(σ 𝑥𝑦)
𝑎=
𝑛 σ 𝑥2 − σ 𝑥 2
𝑛 σ 𝑥𝑦 − (σ 𝑥)(σ 𝑦) 𝑎=
𝑏=
𝑛 σ 𝑥2 − σ 𝑥 2
14 81,296 − (1076)(1019)
𝑏=
14 85,626 1076 2
𝑏 =1.02
Judge x Judge y xy X^2 Y^2

9 10 90 81 100

8 8 64 64 64
• Compute the
regression line for the 8 9 72 64 81
given data beside
5 6 30 25 36
regarding the
correlation of ratings 7 9 63 49 81
of Judge x and Judge
y. Write the regression 5 10 50 25 100
line equation.
෍ 𝑥 = 42 ෍ 𝑥 = 52 ෍ 𝑥𝑦 = 369 ෍ 𝑥 2 = 308 ෍ 𝑦 2 = 462
use the following equations to find a and b.

σ𝑦 𝑏σ𝑥
𝑎 = 𝑦ത − 𝑏𝑥ҧ = −
𝑛 𝑛

σ 𝑦 σ 𝑥 2 − (σ 𝑥)(σ 𝑥𝑦)
𝑎=
𝑛 σ 𝑥2 − σ 𝑥 2
𝑛 σ 𝑥𝑦 − (σ 𝑥)(σ 𝑦) 𝑎=
𝑏=
𝑛 σ 𝑥2 − σ 𝑥 2
Compute the regression line for the given data beside
regarding the correlation of student’s time spent in
studying and their test scores. Write the regression line
equation.
Time spent
in studying
x Test score y xy x^2 y^2
1 5 5 1 25
2 10 20 4 100
3 10 30 9 100
4 15 60 16 225
5 25 125 25 625
6 30 180 36 900
෍=
21 95 420 91 1975
LINEAR REGRESSION EQUATION MICROSOFT
EXCEL: STEPS

• Step 1: Install the Data Analysis Toolpak, if it isn’t already


installed. For instructions on how to load the Data Analysis Toolpak,
click here.
• Step 2: Type your data into two columns in Excel. For example, type
your “x” data into column A and your “y” data into column b. Do not
leave any blank cells between your entries.
• Step 3: Click the “Data Analysis” tab on the Excel toolbar.
• Step 4: Click “regression” in the pop up window and then click “OK.”
Step 5: Select your input Y range. You can do this two ways: either select the
data in the worksheet or type the location of your data into the “Input Y
Range box.” For example, if your Y data is in A2 through A10 then type
“A2:A10” into the Input Y Range box.
Step 6: Select your input X range by selecting the data in the worksheet or
typing the location of your data into the “Input X Range box.”
Step 7: Select the location where you want your output range to go by
selecting a blank area in the worksheet or typing the location of where you
want your data to go in the “Output Range” box.
Step 8: Click “OK”. Excel will calculate the linear regression and populate
your worksheet with the results.
Tip: The linear regression equation information is given in the last output
set (the coefficients column). The first entry in the “Intercept” row is “a” (the
y-intercept) and the first entry in the “X” column is “b” (the slope).
EXAMPLE:

Time spent in
studying x Test score y xy x^2 y^2
1 5 5 1 25
2 10 20 4 100
3 10 30 9 100
4 15 60 16 225
5 25 125 25 625
6 30 180 36 900
21 95 420 91 1975

You might also like