10
1 G89.2229 Lect 6W • Polynomial example • Orthogonal polynomials • Statistical power for regression G89.2229 Multiple Regression Week 6 (Wednesday)

1 G89.2229 Lect 6W Polynomial example Orthogonal polynomials Statistical power for regression G89.2229 Multiple Regression Week 6 (Wednesday)

Embed Size (px)

Citation preview

Page 1: 1 G89.2229 Lect 6W Polynomial example Orthogonal polynomials Statistical power for regression G89.2229 Multiple Regression Week 6 (Wednesday)

1G89.2229 Lect 6W

• Polynomial example

• Orthogonal polynomials

• Statistical power for regression

G89.2229 Multiple Regression Week 6 (Wednesday)

Page 2: 1 G89.2229 Lect 6W Polynomial example Orthogonal polynomials Statistical power for regression G89.2229 Multiple Regression Week 6 (Wednesday)

2G89.2229 Lect 6W

Constructing polynomial fits

• Two approaches for constructing polynomial fits» Simply create squared, cubed

versions of X» Center first: Create squared,

cubed versions of (X-C)

• Xc=(X-X)

• Xc and Xc2 will have little or no

correlation

• Both approach yield identical fits

• Centered polynomials are easier to interpret.

Page 3: 1 G89.2229 Lect 6W Polynomial example Orthogonal polynomials Statistical power for regression G89.2229 Multiple Regression Week 6 (Wednesday)

3G89.2229 Lect 6W

Example from Cohen

• Interest in minor subject as a function of credits in minor

0 5 10 15 20

x1

5.0000

10.0000

15.0000

20.0000

25.0000

ybr

Y: Interest in further coursework in minor subject.

X: Number of credits in minor subject

Cohen Ch 6 Ex 1

R Sq Quadratic =0.673

Page 4: 1 G89.2229 Lect 6W Polynomial example Orthogonal polynomials Statistical power for regression G89.2229 Multiple Regression Week 6 (Wednesday)

4G89.2229 Lect 6W

Interpreting polynomial regression

• Suppose we have the model» Y=b0+b1X1+b2X2+e

» b1 is interpreted as the effect of X1 when X2 is adjusted

• Suppose X1=W, X2=W2

• What does it mean to "hold constant" X2 in this context?

• When the zero point is interpretable» Linear term is slope at point 0» Quadratic is acceleration

at point 0» Cubic is change in acceleration at

point 0

Page 5: 1 G89.2229 Lect 6W Polynomial example Orthogonal polynomials Statistical power for regression G89.2229 Multiple Regression Week 6 (Wednesday)

5G89.2229 Lect 6W

Orthogonal Polynomials

• In experiments, one might have three or four levels of treatment with equal spacing.» 0, 1, 2» 0, 1, 2, 3

• These levels can be used with polynomial models to fit» Linear, quadratic or cubic trends» We would simply construct

squared and cubic forms.

27931

8421

1111

0001

Page 6: 1 G89.2229 Lect 6W Polynomial example Orthogonal polynomials Statistical power for regression G89.2229 Multiple Regression Week 6 (Wednesday)

6G89.2229 Lect 6W

Making polynomials orthogonal

• The linear, quadratic and cubic trends are all going up in the same way.

• The curve for the quadratic is like the one for cubic.

• Orthogonal polynomials eliminate this redundancy hierarchically.» The constant is removed from the linear

trend» The const and linear are removed from

quadratic» The const, lin and quad are removed

from the cubic.

0.50 -0.67 0.50 -0.220.50 -0.22 -0.50 0.670.50 0.22 -0.50 -0.670.50 0.67 0.50 0.22

Page 7: 1 G89.2229 Lect 6W Polynomial example Orthogonal polynomials Statistical power for regression G89.2229 Multiple Regression Week 6 (Wednesday)

7G89.2229 Lect 6W

Analysis with Orthogonal polynomials

• If we substitute orthogonal polynomials for the usual linear, squared, and cubic terms, we» Recover the same polynomial fit» Obtain effects that are useful in

determining the polynomial order

• Even when cubic effects are included, with orthogonal effects» The linear is the average effect» The quadratic is adjusted for the

linear, but not adjusted for cubic» The cubic is adjusted for all

before

• The regression coefficients, however are difficult to interpret.

Page 8: 1 G89.2229 Lect 6W Polynomial example Orthogonal polynomials Statistical power for regression G89.2229 Multiple Regression Week 6 (Wednesday)

8G89.2229 Lect 6W

Computing Orthogonal Polynomials

• Can copy values from Cohen et al or other tables» Substitute original polynomial values for

orthogonal version

• Can use the matrix routine of SPSS to implement a special Transformation.» Read the polynomial data into Matrix.» Use program provided that essentially

does four things• Computes the polynomial sums or

squares/cross products• Finds a Cholesky factor• Inverts the Cholesky factor• Transforms the polynomial values to

be orthogonal

Page 9: 1 G89.2229 Lect 6W Polynomial example Orthogonal polynomials Statistical power for regression G89.2229 Multiple Regression Week 6 (Wednesday)

9G89.2229 Lect 6W

The Matrix programMATRIX.

GET X

/VARIABLES = X, XSQ, XCUB.

COMPUTE XFULL={MAKE(100,1,1),X}.

COMPUTE XX=T(XFULL)*XFULL.

COMPUTE XCHOL=CHOL(XX).

PRINT XCHOL.

COMPUTE ICHOL=INV(XCHOL).

PRINT ICHOL.

COMPUTE XORTH=XFULL*ICHOL.

SAVE XORTH

/OUTFILE=*

/VARIABLES= OTH0 ORTH1 ORTH2 ORTH3.

END MATRIX.

MATCH FILES /FILE=*

/FILE='C:\My Documents\Pat\Courses\G89.2229 Regression\Examples\Reg06W.sav'.

EXECUTE.

Page 10: 1 G89.2229 Lect 6W Polynomial example Orthogonal polynomials Statistical power for regression G89.2229 Multiple Regression Week 6 (Wednesday)

10G89.2229 Lect 6W

The transformed variables

0.00 5.00 10.00 15.00 20.00

-0.60

-0.40

-0.20

0.00

0.20

0.40

0.60ORTH1X

ORTH2X

ORTH3X