For Jam007
Simple Regression Years with Midwest and Shelf Space Winter 2016 Page 1
Lecture Notes for Simple Linear Regression
Problem Definition: Midwest Insurance wants to develop a model able to predict sales according to time with the company.
Results for: MIDWEST.MTW Data Display Row Sales Years with Midwest xy y2 x2
1 487 3 1461 237169 9
2 445 5 2225 198025 25
3 272 2 544 73984 4
4 641 8 5128 410881 64
5 187 2 374 34969 4
6 440 6 2640 193600 36
7 346 7 2422 119716 49
8 238 1 238 56644 1
9 312 4 1248 97344 16
10 269 2 538 72361 4
11 655 9 5895 429025 81
12 563 6 3378 316969 36
y=4855 x=55 xy=26,091 y 2 =2,240,687 x
2 =329
(x) 2 = 3025
(y) 2 = 23571025
Scatterplot of Midwest Data Graphs>Scatterplot
Years with Midwest
S a
le s
9876543210
700
600
500
400
300
200
Scatterplot of Sales vs Years with Midwest
Evaluate the bivariate graph to determine whether a linear relationship exists and the nature of the relationship. What happens to y as x increases? What type of relationship do you see?
Simple Regression Years with Midwest and Shelf Space Winter 2016 Page 2
Dialog box for developing correlation coefficient Explore Linearity of Relationship for significance using t distribution
Pearson Product Moment Correlation Coefficient Stat>Basic Stat>Correlation
Correlations: Sales, Years with Midwest – Minitab readout Pearson correlation of Sales and Years with Midwest = 0.833
P-Value = 0.001
Formula for computing correlation coefficient
2222
yynxxn
yxxyn r
Hypothesis for t test for significant correlation
H0: =0
H1: ≠0 Decision Rule: Pvalue and critical ratio/critical value technique Critical Ratio of t
t= r
r
n
1
2
2
Conclusion: Interpretation:
Simple Regression Years with Midwest and Shelf Space Winter 2016 Page 3
Simple linear regression assumes that the relationship between the dependent, y and independent variable, x can be approximated by a straight line. Population or Deterministic Model – For each x there is an exact value for y.
y = 0 + 1(x) + y - value of independent variable (x) - value of independent variable
0 - Value of population y intercept
1 - Slope of population regression line
- Epsilon represents the difference between y and y’. Epsilon also accounts for the independent variables that affect y but are not in the model. (The difference between Y observed and y predicted).
STAT>Regression>Fitted Line Plot Least squares method is a mathematical technique that results in a regression equation with the smallest SSE. Completing the least squares techniques provides the values for b0 and b1, which minimizes the sum of the squared differences between observed and predicted values. Any values other than those determined by the least squares method result in greater sum of squared differences than those determined by the least squares method.
Years with Midwest
S a
le s
9876543210
700
600
500
400
300
200
S 92.1055
R-Sq 69.3%
R-Sq(adj) 66.2%
Fitted Line Plot Sales = 175.8 + 49.91 Years with Midwest
Least Squares Regression Properties
1. The sum of the residuals from the least squares regression line is 0. The total underprediction by the regression model is exactly offset by the total
overprediction. The probability distribution of is normal
2. The sum of the squared residuals is a minimum (residuals are error
measurements) (y-y’) 2
3. The simple regression line always passes through the mean of the y variable and
the mean of the x variable.
4. The least squares coefficients b0 and b1 are unbiased estimators of their
corresponding population parameters 0 and 1
Simple Regression Years with Midwest and Shelf Space Winter 2016 Page 4
Regression Dialog Box Commands for Regression: Enter data into Minitab worksheet STAT>Regression> Regression
Graphs Dialog Box Graphs> NP Plot of residuals, Residuals vs Fits, go to bottom of dialog box place cursor in box Residuals vs the variables, and select x variable so it shows in box) hit OK to return to original window
OLS Ordinary Least Squares - Least squares method of graphing line that produces the smallest possible sum of squared residuals. Minimizes the squared vertical deviations between the regression line and the observed values of Y.
Simple Regression Years with Midwest and Shelf Space Winter 2016 Page 5
Results Dialog Box Select boxes as shown
NOTE: The following output is the result of commands demonstrated in the screen captures previously presented in this handout.
Regression Analysis: Sales versus YearswMidwest Analysis of Variance
Source DF Adj SS Adj MS F-Value P-Value
Regression 1 191601 191601 22.59 0.001
YearswMidwest 1 191601 191601 22.59 0.001
Error 10 84834 8483
Lack-of-Fit 7 72617 10374 2.55 0.238
Pure Error 3 12217 4072
Total 11 276435
Model Summary
S R-sq R-sq(adj) R-sq(pred)
92.1055 69.31% 66.24% 57.83%
Coefficients
Term Coef SE Coef T-Value P-Value VIF
Constant 175.8 55.0 3.20 0.010
YearswMidwest 49.9 10.5 4.75 0.001 1.00
Regression Equation
Sales = 175.8 + 49.9 YearswMidwest
Fits and Diagnostics for Unusual Observations
Obs Sales Fit Resid Std Resid
7 346.0 525.2 -179.2 -2.12 R
R Large residual
Durbin-Watson Statistic
Durbin-Watson Statistic = 1.45254
Simple Regression Years with Midwest and Shelf Space Winter 2016 Page 6
Computing the least square regression equation with calculator: Optional Equations
Slope of line =
22
1
xxn
yxxyn b
Intercept =
n
x b
n
y bo 1
Compute b1 and b0 in the area provided
Stat>Regression>Regression> Predict>Type 7 for years to predict fit value of y (sales) The relevant range or experimental region - Make predictions only for values that fall within the relevant range of the independent variable. This range consists of all values that fall between the smallest x and the largest x in the data used to compute the regression model.
Predict: Options
Use regression equation to compute y when x=7:
Simple Regression Years with Midwest and Shelf Space Winter 2016 Page 7
Prediction for Sales Regression Equation
Sales = 175.8 + 49.9 YearswMidwest
Variable Setting
YearswMidwest 7
Fit SE Fit 95% CI 95% PI
525.199 36.7573 (443.299, 607.100) (304.237, 746.162)
Confidence Interval –We are 95% confident the population average for a given value for x=7 will be within this interval (443.299, 607.100) Prediction Interval – Determines the likelihood that a randomly selected individual value for Y given a value for x = 7 will be within the interval. (304.237, 746.162) with 95% confidence.
Regression Assumptions: Read definition of residuals
Assumption 1: The mean of the distribution of y values for a given value of x is equal to 0. Each error term has a 50%percent chance if being either positive or negative.
Assumption 2: Constant variance assumption Residual vs. Fitted values assumes that the distribution of all possible y observed values for each value of x have constant variances (Homoscedasticity). One way to satisfy this assumption is to graph residuals on y and fits (predicted y for given values of x) on x as in the next plot. You can instruct Minitab to develop the plot by selecting the graph command when you are performing simple regression. Stat>Regression>Graphs>Select Residual vs Fits.
Fitted Value
R e
s id
u a
l
600500400300200
200
100
0
-100
-200
Residuals Versus the Fitted Values (response is Sales)
Graph analysis. Examine the graph for patterns about the mean line 0.0. If the dots are not randomly distributed above and below the line the homoscedasticity assumption is violated. You can instruct Minitab to develop the plot by selecting the graph command when you are performing simple regression. Connect the dots in sequence as you move from left to right across x axis. Minitab provides an alert when eight consecutive dots fall above or below 0.
Simple Regression Years with Midwest and Shelf Space Winter 2016 Page 8
Graph analysis. Residual versus the Variables is used to examine the effect the properties of a specific variable Examine the graph for patterns about the mean line 0.0. If the dots are not randomly distributed above and below the line the homoscedasticity assumption is violated. You can instruct Minitab to develop the plot by selecting the graph command when you are performing simple regression. Connect the dots in sequence as you move from left to right across x axis. Minitab provides an alert when eight consecutive dots fall above or below 0.
9876543210
200
100
0
-100
-200
Years W Midwest
R e
s id
u a
l
Residuals Versus Years W Midwest (response is Sales)
Assumption 3: Error distributions of possible y values are normal for each value of x. To satisfy this assumption you have Minitab graph an NP Plot of residuals. You can instruct Minitab to develop the plot by selecting the graph command when you are performing simple regression.
Graph analysis: The residual values cluster tightly about the line indicating the residuals for each value of x are normally distributed.
Residual
P e
r c e
n t
2001000-100-200
99
95
90
80
70
60
50
40
30
20
10
5
1
Normal Probability Plot of the Residuals (response is Sales)
Assumption 4: Independence of errors. Residuals collected in one time period cannot influence residuals collected in another time period. Durbin Watson is used to detect autocorrelation. We do not want patterns of positive error terms followed in time by other positive error terms or patterns of negative error terms followed by other negative error terms. Df = P and n. P is the number of independent variables (x’s) in the equation. Durbin Watson test for autocorrelation DW Table Page 810 H0: Errors are nonautocorrelated H1: Errors are autocorrelated
DW< 2 suggests positive autocorrelation DW≈ 2 suggests no autocorrelation DW> 2 suggests negative autocorrelation
Compare value to DW located below Minitab readout. Critical range = 1.08 – 1.36 from DW table not in this text Durbin-Watson statistic = 1.45254
Simple Regression Years with Midwest and Shelf Space Winter 2016 Page 9
Test Model for Significance: The standard error of the estimate- The spread or scatter of the observed y values about the regression line. Syx is measured in the same units as the predicted value for y. This value is the standard deviation of the population of error terms or residuals. The variance of the population is MSE from the ANOVA table. The least squares method produces the b0 and b1 estimate that
most greatly minimizes SSE or (y-y’) 2 .
The standard error is the square root of MSE or the square root of SSE/n-k-1. Both of these values are derived from the ANOVA table. SSE is the amount of variability unexplained by the independent variable in the model. Otherwise stated, the standard error of the estimate measures the dispersion of the dependant variable about its mean value at each value of the dependent variable in the original units of the dependant variable. The Coefficient of Simple Determination (R-sq in Minitab) is a percentage measure of how much variability (squared distance between (y-‘y) that was explained by the independent variable in the regression model. Computed as 1-(SSE/SST) or SSR/SST. Note the square root of r-squared is called the correlation coefficient and measures the strength of the linear relationship between x and y. SSR = The sum of squares residual – the amount of variation explained by the independent variable. SSE = Sum of squares of error – the amount of variation unexplained by the independent variable. Testing the validity of the regression model- p is the number of categories of independent variables p is years with midwest in the model. F test for slope num df = p and denominator df = n-p-1 (p is number of categories of predictor variables in equation).
2 =0 The model explains 0% of variability in y
2 0 The model explains a significant amount of variability in y.
T – Test for Slope Used to determine if there is a significant relationship between y and x. Rejection of the null indicates a significant relationship. Failure to reject means the model has no predictive value or x contributes to the model. df = n-p-1
H0: 1=0
H!: 10 Confidence Interval of the Slope (does β1=0 lie within the interval?) The true slope is estimated with 95% confidence to lie within the interval b1± tn-p-1 Sb1. If the interval contains zero there is not linear relationship between the variables.
sb =
n
x x
S yx
2
2
Simple Regression Years with Midwest and Shelf Space Winter 2016 Page 10
Simple Regression Study Guide Not Assigned…Use as a guide for preparing for final exam
Store ID
Shelf Space Allocated
to Pet Food =X
Weekly Pet Food Sales in Hundreds of Dollars
=Y
1 5 1.6
2 5 2.2
3 5 1.4
4 10 1.9
5 10 2.4
6 10 2.6
7 15 2.3
8 15 2.7
9 15 2.8
10 20 2.6
11 20 2.9
12 20 3.1
13 25 3.3
14 25 3.5
15 25 3.4
Review the example study provided in this handout to become familiar with Minitab commands and statistical testing needed to complete the Aslin Finch pet food problem. Research Objective: The marketing manager of Aslin Finch would like to determine the effect of shelf space on the weekly sales of pet food. A random sample of 15 stores is selected with the following results. Set alpha at .01. Practice by entering the data into Minitab and analyzing the model. When you can address each of the “Label” items for multiple regression you are ready to take the final. Simple regression is used to build your confidence and because the data is limited and therefore easier to study. The final exam is largely based on multiple regression but some of the calculations are required. These calculations will be identified during lecture.
Label: Problem Definition (why are you doing this analysis?) Begin with Problem Definition Label: Scatterplot Use Minitab Scatterplot with description of relationship between x and y. Describe scatterplot to determine whether positive or negative and explain how you made this determination in your graph description? Neither? Label: Correlation Coefficient Hypothesis test of correlation coefficient to determine if a linear relationship exists between Feet of Shelf Space and Weekly Pet Food Sales– Use six step process
Simple Regression Years with Midwest and Shelf Space Winter 2016 Page 11
Label: Regression Equation (show only the equation not the entire table or output) Use Minitab to develop the regression equation-In your report, paste the Minitab output of regression equation and define regression coefficients b0 and b1 as learned during lecture. bo = and is defined as… b1= and is defined as…. Be sure to include the quantitative assessment of each in terms of pet food sales. Label: Significance Testing (Regression Coefficient) Is x a significant predictor of y? T test for significance of regression coefficient Use six step process in interpretation step discuss average amount of change in y for one unit change in x. Label: Significance Testing (ANOVA) What percentage of error or variation is … F Test to test R-sqd – Use six step process and in interpretation step discusses percentage of variability in y explained by x. Use six step process Label: Satisfying Regression Assumptions (Normality and constant variance) Minitab plots to include in report: Size graphs to fit neatly within report and place each description with the graph you are discussing.
NP Plot for residuals -Minitab graph with description addressing to assumption(s) Residuals vs. Fits-Minitab graph with description addressing to assumption(s) Residuals and x variable-Minitab graph with description addressing to assumption(s)
Graphical analyses must describe residuals plotted on graphs. Each graph must speak to the assumption and how the graphed residuals support or violate the assumption. Label: Confidence Interval for Regression Coefficient Develop confidence interval for regression coefficient and interpret –Calculations to be done by hand and typed neatly onto report. Discuss whether 0 lies in interval and interpret interval in terms of pet food sales and shelf space. Label: Prediction and Confidence Interval for Fit value of Y Use Minitab to develop prediction interval and confidence interval for y for a value of x you select and enter into Minitab – Interpret both intervals as they relate to y