Docsity

Regression Analysis: Simple Linear Regression and Correlation, Study notes of Data Analysis & Statistical Methods

Toggle sidebar
bg1
STAT 515 -- Chapter 11: Regression
• Mostly we have studied the behavior of a single
random variable.
• Often, however, we gather data on two random
variables.
• We wish to determine: Is there a relationship between
the two r.v.’s?
• Can we use the values of one r.v. to predict the other
r.v.?
• Often we assume a straight-line relationship between
two variables.
• This is known as simple linear regression.
Probabilistic vs. Deterministic Models
If there is an exact relationship between two (or more)
variables that can be predicted with certainty, without
any random error, this is known as a deterministic
relationship.
Examples:
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14

Partial preview of the text

Download Regression Analysis: Simple Linear Regression and Correlation and more Study notes Data Analysis & Statistical Methods in PDF only on Docsity!

STAT 515 -- Chapter 11: Regression

  • Mostly we have studied the behavior of a single random variable.
  • Often, however, we gather data on two random variables.
  • We wish to determine: Is there a relationship between the two r.v.’s?
  • Can we use the values of one r.v. to predict the other r.v.?
  • Often we assume a straight-line relationship between two variables.
  • This is known as simple linear regression. Probabilistic vs. Deterministic Models If there is an exact relationship between two (or more) variables that can be predicted with certainty, without any random error, this is known as a deterministic relationship. Examples:

In statistics, we usually deal with situations having random error, so exact predictions are not possible. This implies a probabilistic relationship between the 2 variables. Example: Y = breathalyzer reading X = amount of alcohol consumed (fl. oz.)

If we gather data ( X , Y ) for several individuals, we can use these data to estimate  0 and  1 and thus estimate the linear relationship between Y and X. First step: Decide if a straight-line relationship between Y and X makes sense. Plot the bivariate data using a scattergram (scatterplot). Once we settle on the “best-fitting” regression line, its equation gives a predicted Y-value for any new X-value. How do we decide, given a data set, which line is the best-fitting line?

Note that usually, no line will go through all the points in the data set. For each point, the error = (Some positive errors, some negative errors) We want the line that makes these errors as small as possible (so that the line is “close” to the points). Least-squares method: We choose the line that minimizes the sum of all the squared errors (SSE). Least squares regression line: Y ˆ  ˆ 0  ˆ 1 X where 0 ^ ˆ and 1 ^ ˆ are the estimates of  0 and  1 that produce the best-fitting line in the least squares sense. Formulas for 0 ^ ˆ and ^ ˆ 1 : Estimated slope and intercept:

Example: Avoid extrapolation: predicting/interpreting the regression line for X-values outside the range of X in the data set. Model Assumptions Recall model equation: Y^ ^ ^0 ^ ^1 X ^  To perform inference about our regression line, we need to make certain assumptions about the random error component, . We assume:

(1) The mean of the probability distribution of  is 0. (In the long run, the values of the random error part average zero.) (2) The variance of the probability distribution of  is constant for all values of X. We denote the variance of  by  2 . (3) The probability distribution of  is normal. (4) The values of  for any two observed Y-values are independent – the value of  for one Y-value has no effect on the value of  for another Y- value. Picture: Estimating  2 Typically the error variance  2 is unknown. An unbiased estimate of  2 is the mean squared error (MSE), also denoted s 2 sometimes. MSE = SSE

If we reject H 0 and conclude Ha is true, then we conclude that X does provide information for the prediction of Y. Picture: Recall that the estimate 1 ^ ˆ is a statistic that depends on the sample data. This ^ ˆ 1 has a sampling distribution. If our four SLR assumptions hold, the sampling distribution of ^ ˆ^1 is normal with mean  1 and standard deviation which we estimate by

Under H 0 :  1 = 0, the statistic s / SSxx ˆ  1 has a t-distribution with n – 2 d.f. Test for Model Usefulness One-Tailed Tests Two-Tailed Test H 0 :  1 = 0 H 0 :  1 = 0 H 0 :  1 = 0 H 0 :  1 < 0 H 0 :  1 > 0 H 0 :  1 ≠ 0 Test statistic: t = s / SSxx ˆ  1 Rejection region: t < -t t > t t > t/2 or t < -t/ P-value: left tail area right tail area 2*(tail area outside t ) outside t outside t Example: In the drug reaction example, recall 1 ^ ˆ = 0.7. Is the real  1 significantly different from 0? (Use  = .05.)

Correlation The scatterplot gives us a general idea about whether there is a linear relationship between two variables. More precise: The coefficient of correlation (denoted r ) is a numerical measure of the strength and direction of the linear relationship between two variables. Formula for r (the correlation coefficient between two variables X and Y ): xx yy xy SS SS SS r

Most computer packages will also calculate the correlation coefficient. Interpreting the correlation coefficient:

  • Positive r => The two variables are positively associated (large values of one variable correspond to large values of the other variable)
  • Negative r => The two variables are negatively associated (large values of one variable correspond to small values of the other variable)
  • r = 0 => No linear association between the two variables. Note: -1 ≤ r ≤ 1 always. How far r is from 0 measures the strength of the linear relationship:
  • r nearly 1 => Strong positive relationship between the two variables
  • r nearly -1 => Strong negative relationship between the two variables
  • r near 0 => Weak relationship between the two variables Pictures:

Scatterplot of these data: Calculation will show that r = 0 for these data. Are the two variables related? Another caution: Correlation between two variables does not automatically imply that there is a cause-effect relationship between them. Note: The population correlation coefficient between two variables is denoted . To test H 0 :  = 0, we simply use the equivalent test of H 0 :  1 = 0 in the SLR model. If this null hypothesis is rejected, we conclude there is a significant correlation between the two variables. The square of the correlation coefficient is called the coefficient of determination, r 2 .

Interpretation: r 2 represents the proportion of sample variability in Y that is explained by its linear relationship with X. SS yy SSE r^2  1  ( r^2 always between 0 and 1) For the drug/reaction time example, r 2 = Interpretation: Estimation and Prediction with the Regression Model Major goals in using the regression model: (1) Determining the linear relationship between Y and X (accomplished through inferences about  1 ) (2) Estimating the mean value of Y , denoted E( Y ), for a particular value of X. Example: Among all people with drug amount 3.5%, what is the estimated mean reaction time? (3) Predicting the value of Y for a particular value of X. Example: For a “new” individual having drug amount 3.5%, what is the predicted reaction time?

where t/2 based on n – 2 d.f. The extra “1” inside the square root shows the prediction interval is wider than the CI, although they have the same center. Note: A “Prediction Interval” attempts to contain a random quantity, while a confidence interval attempts to contain a (fixed) parameter value. The variability in our estimate of E( Y ) reflects the fact that we are merely estimating the unknown  0 and  1. The variability in our prediction of the new Y includes that variability, plus the natural variation in the Y- values. Example (drug/reaction time data): 95% CI for E( Y ) with X = 3.5:

95% PI for a new Y having X = 3.5: