hi i need someone proffecional with fire class homework?

profileص
77_linear_regression.docx

FSE 200

Adkins Page 1 of 10

Simple Linear Regression

Correlation only measures the strength and direction of the linear relationship between two quantitative variables. If the relationship is linear, then we would like to try to model that relationship with the equation of a line. We will use a regression line to describe the relationship between an explanatory variable and a response variable.

A regression line is a straight line that describes how a response variable y changes as an explanatory variable x changes. We often use a regression line to predict the value of y for a given value of x.

Ex. It has been suggested that there is a relationship between sleep deprivation of employees and the ability to complete simple tasks. To evaluate this hypothesis, 12 people were asked to solve simple tasks after having been without sleep for 15, 18, 21, and 24 hours. The sample data are shown below.

Subject

Hours without sleep, x

Tasks completed, y

1

15

13

2

15

9

3

15

15

4

18

8

5

18

12

6

18

10

7

21

5

8

21

8

9

21

7

10

24

3

11

24

5

12

24

4

Draw a scatterplot and describe the relationship. Lay a straight-edge on top of the plot and move it around until you find what you think might be a “line of best fit.” Then try to predict the number of tasks completed for someone having been without sleep 16 hours.

Was your line the same as that of the classmate sitting next to you? Probably not. We need a method that we can use to find the “best” regression line to use for prediction. The method we will use is called least-squares. No line will pass exactly through all the points in the scatterplot. When we use the line to predict a y for a given x value, if there is a data point with that same x value, we can compute the error (residual):

Our goal is going to be to make the vertical distances from the line as small as possible. The most commonly used method for doing this is the least-squares method.

The least-squares regression line of y on x is the line that makes the sum of the squares of the vertical distances of the data points from the line as small as possible.

Equation of the Least-Squares Regression Line

· Least-Squares Regression Line:

· Slope of the Regression Line:

· Intercept of the Regression Line:

Generally, regression is performed using statistical software. Clearly, given the appropriate information, the above formulas are simple to use.

Once we have the regression line, how do we interpret it, and what can we do with it?

The slope of a regression line is the rate of change, that amount of change in when x increases by 1.

The intercept of the regression line is the value of when x = 0. It is statistically meaningful only when x can take on values that are close to zero.

To make a prediction, just substitute an x-value into the equation and find .

To plot the line on a scatterplot, just find a couple of points on the regression line, one near each end of the range of x in the data. Plot the points and connect them with a line. Again, this is something that can be done using statistical software.

Ex. Use Excel to find the equation of the least-squares regression line for the sleep deprivation data in the previous example.

· Click Data -> Data Analysis -> Regression -> OK

· Input the cells of the response variable y in the Input Y Range box.

· Input the cells of the explanatory variable x in the Input X Range box.

· If you included variable names in the Input X and Y Range boxes, check the Labels box.

· Input the cells you would like to display the output in the Output Range box.

· Click OK.

a. State the equation of the least-squares regression line.

b. Identify and interpret the slope.

c. Identify and interpret the intercept.

d. Use the least-squares regression equation to predict the number of tasks completed for an employee that has been without sleep for 16 hours.

Facts About Least-Squares Regression

· In regression, the distinction between explanatory and response variables is very important. When we computed the correlation coefficient r, it did not matter which variable was x and which was y, r would be the same. However, if you perform a regression analysis on a data set and then swap x and y and perform another regression analysis, the results will not be the same.

· There is a connection between the correlation coefficient r and the slope of the least-squares line:

A change of one standard deviation in x corresponds to a change of r standard deviations in y.

· The least squares regression line always passes through the point () on the graph of y versus x.

· The square of the correlation, , known as the coefficient of determination, is the proportion of variation in y that can be explained by the least-squares regression of y on x.

Note that 0 < r2 < 1. The closer r2 is to 1, the better your regression line is at modeling the relationship between x and y. We usually state r2 as a percentage.

Note:

· A statistical analysis package can find r2 for you; if only r is given on the output, square it.

· If r2 is given on the output and you want to find r, take the square root of r2 and look at the slope of the regression line to determine the sign; r and b will have the same sign.

Ex. Refer to the Excel output from the sleep deprivation data. Find r2 and interpret it. Then find r.

We know that in practical applications, we are not going to be so lucky as to have all of our data points falling exactly on a line.

A residual is the difference between an observed value of the response variable and the value predicted by the regression line. That is,

Ex. Find the residual for Subject 1 in our sleep deprivation data.

We could compute a residual for each observation in the data. Note that the mean of the least-squares residuals is always zero. It is a good idea to examine the residuals because they can tell us something about how appropriate our linear model is.

A residual plot is a scatterplot of the regression residuals versus the explanatory variable, x. Residual plots help us to assess the fit of a regression line.

· If the regression line does a good job describing the overall relationship between x and y, the residuals should have no systematic pattern.

When you examine a residual plot, here are some things you should consider:

· Generally, a horizontal line is drawn at zero.

· A curved pattern tells you that the relationship is not linear; therefore, linear regression is not an appropriate method of analysis.

· Increasing or decreasing spread about the line (at zero) as x increases may indicate that the prediction of y for certain values of x will be less accurate.

· Individual points with large residuals or outliers in the y direction can greatly affect your analysis. (Check data entry, etc.)

· Individual points that are extreme in the x direction may not have large residuals, but they may still have quite an impact on the analysis.

The last two points above lead us to a discussion of outliers and influential points.

An outlier is an observation that lies outside the overall pattern of the other observations.

An observation is influential for a statistical calculation if removing it would significantly change the result of the calculation. Points that are outliers in the x direction are often influential for the least-squares regression line.

Ex. Use Excel to obtain the residual plot for the sleep deprivation data. Analyze the output.

· In the Regression dialog box, check the Residual Plots box.

Cautions about Correlation and Regression

Some things to remember:

· Always plot your data first!

· The correlation and regression we have been studying should be used only to describe linear relationships.

· The correlation coefficient r and least-squares regression are not resistant; just one influential observation can greatly affect your analysis.

Let’s discuss a few more things of which you should be aware with regard to correlation and regression.

Extrapolation is the use of a regression line for prediction far outside the range of values of the explanatory variable x that you used to obtain the line. Such predictions may not be accurate!

Extrapolation can be dangerous!

Ex. Refer to the sleep-deprivation example. Do you think it would be appropriate to use our least-squares regression equation to make predictions for a person who has gone without sleep for 40 hours?

Generally two variables won’t exist by themselves in a vacuum, so to speak. Often we may be interested in more than two variables. Sometimes there are variables floating around in the background that are influencing the variables of interest, but we may not even have considered these background variables.

A lurking variable (or extraneous variable) is a variable that has an important effect on the relationship among the variables in a study but is not included among the variables studied.

A lurking variable could make it falsely appear that two other variables have a strong relationship. A lurking variable could also mask or hide a relationship that is really there.

Ex. Suppose that someone notices that as the number of churches in town increases, the liquor sales also go up. Is there a lurking variable that might explain this relationship?

ASSOCIATION DOES NOT IMPLY CAUSATION!

An association between an explanatory variable x and a response variable y, even if it is very strong, is not by itself good evidence that changes in x actually cause changes in y.

While our goal may often be to show that changes in the explanatory variable cause changes in the response variable, sometimes an observed association really is due to cause and effect, but many times it is not. There may be a lurking variable that is causing a common response in x and y, or maybe both the lurking variable and x are causing changes in y so that their effects are confounded.

Ex. Does having more cars make you live longer? A serious study once found that people with two cars live longer than people who own only one car. Owning three cars is even better, and so on. There is a substantial positive correlation between number of cars x and length of life y.

A basic meaning of causation is that by changing x we can bring about a change in y. Could we lengthen our lives by buying more cars?

How can we tell, then, if we have a cause-and-effect relationship? A well-designed experiment is the best way to determine causation; we will discuss experiments later. Many times it is not possible to do an experiment. In the absence of an experiment, what should we examine to determine causation?

· The association is strong.

· The association is consistent.

· Higher doses are associated with stronger responses.

· The alleged cause precedes the effect in time.

· The alleged cause is plausible.

Ex. Does smoking cause lung cancer? Despite the difficulties, it is sometimes possible to build a strong case for causation in the absence of experiments. The evidence that smoking causes lung cancer is about as strong as nonexperimental evidence can be. Doctors have long observed that most lung cancer patients were smokers. Comparison of smokers and “similar” nonsmokers showed a very strong association between smoking and death from lung cancer. Could the association be explained by lurking variables? Might there be, for example, a genetic factor that predisposes people to both nicotine addiction and to lung cancer? Smoking and lung cancer would then be positively associated even if smoking had no direct effect on the lungs. How do we overcome these objections?

· The association is strong. The association between smoking and lung cancer is very strong.

· The association is consistent. Many studies of different kinds of people in many countries link smoking to lung cancer. That reduces the chances that a lurking variable specific to one group or one study explains the association.

· Higher doses are associated with stronger responses. People who smoke more cigarettes per day or who smoke over a longer period of time get lung cancer more often. People who stop smoking reduce their risk.

· The alleged cause precedes the effect in time. Lung cancer develops after years of smoking. The number of men dying of lung cancer rose as smoking became more common, with a lag of about 30 years. Lung cancer kills more men than any other form of cancer. Lung cancer was rare among women until women began to smoke. Lung cancer in women rose along with smoking again with a lag of about 30 years.

· The alleged cause is plausible. Experiments with animals show that tars from cigarette smoke do cause cancer.

The evidence for causation is overwhelming-but it is still not as strong as the evidence provided by well-designed experiments.

Hours without sleep, x Residual Plot

15.0 15.0 15.0 18.0 18.0 18.0 21.0 21.0 21.0 24.0 24.0 24.0 0.499999999999998 -3.500000000000002 2.499999999999998 -1.666666666666668 2.333333333333332 0.333333333333332 -1.833 333333333336 1.166666666666664 0.166666666666664 -1.000000000000004 0.999999999999996 -3.5527136788005E-15

Hours without sleep, x

Residuals