Docsity

Regression Analysis: Determining the Relationship between X and Y, Slides of Ecology and Environment

Partial preview of the text

Download Regression Analysis: Determining the Relationship between X and Y and more Slides Ecology and Environment in PDF only on Docsity!

Regression

  • For the purposes of this class:
    • Does Y depend on X?
    • Does a change in X cause a change in Y?
    • Can Y be predicted from X?
      • Y= mX + b

100

120

140

160

180

30 40 50 60 70 80 Independent Value

Dependent Value

Predicted values

Overall Mean

Actual values

When analyzing a regression-type data set, the first step

is to plot the data:

X Y

The next step is to determine the line that ‘best fits’

these points. It appears this line would be sloped

upward and linear (straight).

100

120

140

160

180

30 40 50 60 70 80

Dependent Value (Y)

Independent Value (X)

Testing the Regression Line for Significance

  • An F-test is used based on Model, Error, and Total SOS.
    • Very similar to ANOVA
  • Basically, we are testing if the regression line has a

significantly different slope than a line formed by using

just Y_avg.

  • If there is no difference, then that means that Y does not change as X changes (stays around the average value)
  • To begin, we must first find the regression line that has

the smallest Error SOS.

Independent Value

Dependent Value

Error SOS

The regression line should pass through the overall average with

a slope that has the smallest Error SOS (Error SOS = the distance

between each point and predicted line: gives an index of the

variability of the data points around the predicted line).

overall average is

the pivot point

Total SOS

  • Calculated as the sum of (Y – Yavg)^2
  • Gives us an index of how scattered our data set is around the

overall Y average.

Independent Value

Dependent Value

Overall Y average

Regression line not shown

X Y_Actual Y Average SOS (^) Total 35 114 138 576 45 120 138 324 55 150 138 144 65 140 138 4 75 166 138 784 1832

Total SOS gives us an index of how scattered the data

points are around the overall average. This is calculated

the same way for a single treatment in ANOVA.

What happens to Total SOS when all of the points are

close to the overall average? What happens when the

points form a non-horizontal linear trend?

Model SOS

• Gives us an index of how far away the predicted values are

from the overall average value

• What happens to Model SOS when all of the predicted

values are close to the average value?

X Y_Pred Y Average SOS (^) Model 35 113.2 138 615. 45 125.6 138 153. 55 138 138 0 65 150.4 138 153. 75 162.8 138 615.

All Together Now!!

X Y_Actual Y_Pred SOS (^) Error Y_Avg SOS (^) Total SOS (^) Model

35 114 113.2 0.64 138 576 615.

45 120 125.6 31.36 138 324 153.

55 150 138 144 138 144 0

65 140 150.4 108.16 138 4 153.

75 166 162.8 10.24 138 784 615.

294.4 1832 1537.

SOS (^) Error = Σ (Y_Actual – Y_Pred)^2 SOS (^) Total = Σ (Y_Actual –Y_ Avg) 2 SOS (^) Model = Σ (Y_Pred – Y_Avg) 2

Magic of the F-test

  • The ratio of Model SOS to Error SOS (Model SOS divided by Error SOS)

gives us an overall index (the F statistic) used to indicate the relative

‘difference’ between the regression line and a line with slope of zero

(all values = Y_avg.

  • A large Model SOS and small Error SOS = a large F statistic. Why does this

indicate a significant difference?

  • A small Model SOS and a large Error SOS = a small F statistic. Why does

this indicate no significant difference??

  • Based on sample size and alpha level (P-value), each F statistic has an

associated P-value.

  • P < 0.05 (Large F statistic) there is a significant difference between the

regression line a the Y_avg line.

  • P ≥ 0.05 (Small F statistic) there is NO significant difference between the

regression line a the Y_avg line.

100

120

140

160

180

30 40 50 60 70 80 Independent Value

Dependent Value

Mean Model SOS

Mean Error SOS

Independent Value

Dependent Value

Basically, this is an

index that tells us how

different the regression

line is from Y_avg, and

the scatter of the data

around the predicted

values.

= F

Sum of Mean

Source DF Squares Square F Value Pr > F

Model 1 1537.60000 1537.60000 15.67 0.

Error 3 294.40000 98.

Corrected Total 4 1832.

Root MSE 9.90623 R-Square 0. Dependent Mean 138.00000 Adj R-Sq 0. Coeff Var 7.

Parameter Estimates

Parameter Standard Variable DF Estimate Error t Value Pr > |t|

Intercept 1 69.80000 17.78988 3.92 0. X 1 1.24000 0.31326 3.96 0.

Y = [mX + b] = [(1.24)(X) + 69.8]

Correlation (r):

A nother measure of the mutual linear relationship between

two variables.

  • ‘r’ is a pure number without units or dimensions
  • ‘r’ is always between –1 and 1
  • Positive values indicate that y increases when x

does and negative values indicate that y decreases

when x increases.

  • What does r = 0 mean?
  • ‘r’ is a measure of intensity of association

observed between x and y.

  • ‘r’ does not predict – only describes associations between variables

SAS Code for Correlation

Proc corr; {Tells SAS to do the correlation procedure} var y x; (Tells SAS to determine the correlation between these variables) run;

The CORR Procedure 2 Variables: Y X Simple Statistics Variable N Mean Std Dev Sum Minimum Maximum Y 5 138.00000 21.40093 690.00000 114.00000 166. X 5 55.00000 15.81139 275.00000 35.00000 75. Pearson Correlation Coefficients, N = 5 Prob > |r| under H0: Rho=

Y X Y 1.00000 0. 0.

X 0.91613 1. 0.

Significant correlation

high correlation

R-square

• If we square r, we get rid of the negative value

if it is negative) and we get an index of how

close the data points are to the regression line.

• Allows us to decide how much confidence we

have in making a prediction based on our

model.

• Is calculated as Model SOS / Total SOS