Presentation is loading. Please wait.

Presentation is loading. Please wait.

Probability & Statistical Inference Lecture 9 MSc in Computing (Data Analytics)

Similar presentations


Presentation on theme: "Probability & Statistical Inference Lecture 9 MSc in Computing (Data Analytics)"— Presentation transcript:

1 Probability & Statistical Inference Lecture 9 MSc in Computing (Data Analytics)

2 Lecture Outline  Simple Linear Regression  Multiple Regression

3 AVOVA vs Simple Linear Regression Type of Analysis ExplanatoryResponseContinuous CategoricalANOVA Continuous Simple Linear Regression

4 AVOVA vs Simple Linear Regression

5 Scatter Plot A scatter plot or scattergraph is a type of chart using Cartesian coordinates to display values for two continuous variables for a set of data

6 Describe Linear Relationship  Correlation – You can quantify the relationship between two variables with correlation statistics. Two variables are correlated if there is a linear relationship between them.  You can classify correlated variables according to the type of correlation:  Positive: One variable tends to increase in value as the other increases in value.  Negative: One variable tends to decrease in value as the other increases in value.  Zero: No linear relationship between the two variables (uncorrelated)

7 Pearson Correlation Coefficient

8 Caution using correlation Four sets of data with the same correlation of 0.816

9 Demo

10 Regression Analysis Introduction  Many problems in engineering and science involve exploring the relationships between two or more variables.  Regression analysis is a statistical technique that is very useful for these types of problems.  For example, in a chemical process, suppose that the yield of the product is related to the process-operating temperature.  Regression analysis can be used to build a model to predict yield at a given temperature level.

11 Example

12 Scatter Plot

13 Regression Model  Based on the scatter diagram, it is probably reasonable to assume that the random variable Y is related to x by a straight-line relationship. We use the equation of a line to model the relationship. The simple linear regression model is given by: where the slope and intercept of the line are called regression coefficients and where  is the random error term.

14 Regression Model β1β1 One unit change in x

15 Regression Model The true regression model is a line of mean values: where  1 can be interpreted as the change in the mean of Y for a unit change in x. Also, the variability of Y at a particular value of x is determined by the error variance,  2. This implies there is a distribution of Y-values at each x and that the variance of this distribution is the same at each x.

16 Regression Model

17 Simple Linear Regression The case of simple linear regression considers a single regressor or predictor x and a dependent or response variable Y. The expected value of Y at each level of x is a random variable: We assume that each observation, Y, can be described by the model

18 Suppose that we have n pairs of observations (x 1, y 1 ), (x 2, y 2 ), …, (x n, y n ). Deviations of the data from the estimated regression model. Simple Linear Regression

19 The method of least squares is used to estimate the parameters,  0 and  1 by minimizing the sum of the squares of the vertical deviations in diagram below Deviations of the data from the estimated regression model. Simple Linear Regression

20 Least Squares Estimator

21 Model Estimates

22 Notation

23 Example

24

25 Scatter plot of oxygen purity y versus hydrocarbon level x and regression model ŷ = x. Example

26 Demo

27 Model Assumptions  Fitting a regression model requires several assumptions. 1. Errors are uncorrelated random variables with mean zero; 2. Errors have constant variance; and, 3. Errors be normally distributed.  The analyst should always consider the validity of these assumptions to be doubtful and conduct analyses to examine the adequacy of the model

28 The residuals from a regression model are e i = y i - ŷ i, where y i is an actual observation and ŷ i is the corresponding fitted value from the regression model. Analysis of the residuals is frequently helpful in checking the assumption that the errors are approximately normally distributed with constant variance, and in determining whether additional terms in the model would be useful. Testing Assumptions – Residual Analysis

29 Patterns for residual plots. (a) satisfactory, (b) funnel, (c) double bow, (d) nonlinear. [Adapted from Montgomery, Peck, and Vining (2001).] Residual Analysis

30 Example - Residual Analysis

31 Normal probability plot of residuals Example - Residual Analysis

32 Plot of residuals versus predicted oxygen purity, ŷ Example - Residual Analysis

33 Adequacy of the Regression Model The quantity is called the coefficient of determination and is often used to judge the adequacy of a regression model. 0  R 2  1; We often refer (loosely) to R 2 as the amount of variability in the data explained or accounted for by the regression model.

34 Adequacy of the Regression Model For the oxygen purity regression model, R 2 = SS R /SS T = / = Thus, the model accounts for 87.7% of the variability in the data.

35 Multiple Linear Regression

36 Introduction  Many applications of regression analysis involve situations in which there are more than one regressor variable.  A regression model that contains more than one regressor variable is called a multiple regression model.

37 Introduction  For example, suppose that the effective life of a cutting tool depends on the cutting speed and the tool angle. A possible multiple regression model could be: where: Y – tool life x 1 – cutting speed x 2 – tool angle

38 Introduction The regression plane for the model: E(Y) = x 1 + 7x 2 The contour plot

39 Introduction

40 Demo

41 Regression & Variable Selection  How do we select the best variable for use in a regression model  Perform a search to see which variable are the most effective  Three search schemes:  Forward sequential selection  Backward sequential selection  Stepwise sequential selection

42 Sequential Selection – Forward Entry Cutoff Input p -value

43 Sequential Selection – Forward Entry Cutoff Input p -value

44 Sequential Selection – Forward Entry Cutoff Input p -value

45 Sequential Selection – Forward Entry Cutoff Input p -value

46 Sequential Selection – Backward Stay Cutoff Input p -value

47 Sequential Selection – Backward Stay Cutoff Input p -value

48 Sequential Selection – Backward Stay Cutoff Input p -value

49 Sequential Selection – Backward Stay Cutoff Input p -value

50 Sequential Selection – Backward Stay Cutoff Input p -value

51 Sequential Selection – Backward Stay Cutoff Input p -value

52 Sequential Selection – Backward Stay Cutoff Input p -value

53 Sequential Selection – Backward Stay Cutoff Input p -value

54 Sequential Selection – Stepwise Input p -value Entry Cutoff Stay Cutoff

55 Sequential Selection – Stepwise Input p -value Entry Cutoff Stay Cutoff

56 Sequential Selection – Stepwise Input p -value Entry Cutoff Stay Cutoff

57 Sequential Selection – Stepwise Input p -value Entry Cutoff Stay Cutoff

58 Sequential Selection – Stepwise Input p -value Entry Cutoff Stay Cutoff

59 Sequential Selection – Stepwise Input p -value Entry Cutoff Stay Cutoff

60 Sequential Selection – Stepwise Input p -value Entry Cutoff Stay Cutoff

61 Demo

62 Multi-Collinearity  Multi-Collinearity exists when two or more independent variables are used in regression are correlated. XX3XX3 Y X2X2 X1X1X1X1

63 Demo


Download ppt "Probability & Statistical Inference Lecture 9 MSc in Computing (Data Analytics)"

Similar presentations


Ads by Google