Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to Linear and Logistic Regression. Basic Ideas Linear Transformation Finding the Regression Line Minimize sum of the quadratic residuals.

Similar presentations


Presentation on theme: "Introduction to Linear and Logistic Regression. Basic Ideas Linear Transformation Finding the Regression Line Minimize sum of the quadratic residuals."— Presentation transcript:

1 Introduction to Linear and Logistic Regression

2 Basic Ideas Linear Transformation Finding the Regression Line Minimize sum of the quadratic residuals Curve Fitting Logistic Regression Odds and Probability

3 Basic Ideas Jargon IV = X = Predictor (pl. predictors) DV = Y = Criterion (pl. criteria) Regression of Y on X Linear Model = relations between IV and DV represented by straight line. A score on Y has 2 parts – (1) linear function of X and (2) error. (population values)

4 Basic Ideas (2) Sample value: Intercept – place where X=0 Slope – change in Y if X changes 1 unit If error is removed, we have a predicted value for each person at X (the line): Suppose on average houses are worth about 50.00 Euro a square meter. Then the equation relating price to size would be Y’=0+50X. The predicted price for a 2000 square meter house would be 250,000 Euro

5 Linear Transformation 1 to 1 mapping of variables via line Permissible operations are addition and multiplication (interval data) Add a constantMultiply by a constant

6 Linear Transformation (2) Centigrade to Fahrenheit Note 1 to 1 map Intercept? Slope? 1209060300 Degrees C 240 200 160 120 80 40 0 Degrees F 32 degrees F, 0 degrees C 212 degrees F, 100 degrees C Intercept is 32. When X (Cent) is 0, Y (Fahr) is 32. Slope is 1.8. When Cent goes from 0 to 100 (run), Fahr goes from 32 to 212 (rise), and 212-32 = 180. Then 180/100 =1.8 is rise over run is the slope. Y = 32+1.8X. F=32+1.8C.

7 Standard Deviation and Variance Square root of the variance, which is the sum of squared distances between each value and the mean divided by population size (finite population) Example 1,2,15 Mean=6  =6.37

8 Correlation Analysis Correlation coefficient (also called Pearson’s product moment coefficient) If r X,Y > 0, X and Y are positively correlated (X ’ s values increase as Y ’ s). The higher, the stronger correlation. r X,Y = 0: independent; r X,Y < 0: negatively correlated

9 Regression of Weight on Height HtWt 61105 62120 63120 65160 65120 68145 69175 70160 72185 75210 N=10 mean=67mean=150  =4.57  = 33.99 Correlation (r) =.94. Regression equation: Y’=-316.86+6.97X

10 Predicted Values & Residuals NHtWtY'RS 161105108.19-3.19 262120115.164.84 363120122.13-2.13 465160136.0623.94 565120136.06-16.06 668145156.97-11.97 769175163.9411.06 870160170.91-10.91 972185184.840.16 1075210205.754.25 mean67150150.000.00  4.5733.9931.8511.89 V20.891155.561014.37141.32 Numbers for linear part and error. Y’ is called the predicted value Y-Y’ the residual (RS) The residual is the error Mean of Y’ and Y is the same Variance of Y is equal to the variance Y’ + RS

11 Finding the Regression Line Need to know the correlation, standard deviation and means of X and Y To find the intercept, use: Suppose r XY =.50,  X =.5, mean X = 10,  Y = 2, mean Y = 5. Slope Intercept

12 Line of Least Squares Assume linear relations is reasonable, so the 2 variables can be represented by a line. Where should the line go? Place the line so errors (residuals) are small The line we calculate has a sum of errors = 0 It has a sum of squared errors that are as small as possible; the line provides the smallest sum of squared errors or least squares

13 Minimize sum of the quadratic residuals Derivation equal 0

14

15

16 The coefficients a and b are found by solving the following system of linear equations

17 Curve Fitting Linear Regression Exponential Curve Logarithmic Curve Power Curve

18 The coefficients a and b are found by solving the following system of linear equations

19 with Linear Regression Exponential Curve Logarithmic Curve Power Curve

20 Multiple Linear Regression The coefficients a, b and c are found by solving the following system of linear equations

21 Polynomial Regression The coefficients a, b and c are found by solving the following system of linear equations

22 Logistic Regression Variable is binary (a categorical variable that has two values such as "yes" and "no") rather than continuous binary DV (Y) either 0 or 1 For example, we might code a successfully kicked field goal as 1 and a missed field goal as 0 or we might code yes as 1 and no as 0 or admitted as 1 and rejected as 0 or Cherry Garcia flavor ice cream as 1 and all other flavors as zero.

23 If we code like this, then the mean of the distribution is equal to the proportion of 1s in the distribution. For example if there are 100 people in the distribution and 30 of them are coded 1, then the mean of the distribution is.30, which is the proportion of 1s The mean of a binary distribution so coded is denoted as P, the proportion of 1s The proportion of zeros is (1-P), which is sometimes denoted as Q The variance of such a distribution is PQ, and the standard deviation is Sqrt(PQ)

24 Suppose we want to predict whether someone is male or female (DV, M=1, F=0) using height in inches (IV) We could plot the relations between the two variables as we customarily do in regression. The plot might look something like this

25 None of the observations (data points) fall on the regression line They are all zero or one

26 Predicted values (DV=Y)correspond to probabilities If linear regression is used, the predicted values will become greater than one and less than zero if one moves far enough on the X- axis Such values are theoretically inadmissible

27 Linear vs. Logistic regression

28 Odds and Probability Linear regression!

29

30 Basic Ideas Linear Transformation Finding the Regression Line Minimize sum of the quadratic residuals Curve Fitting Logistic Regression Odds and Probability


Download ppt "Introduction to Linear and Logistic Regression. Basic Ideas Linear Transformation Finding the Regression Line Minimize sum of the quadratic residuals."

Similar presentations


Ads by Google