{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# notes14 - Chapter 9 Model Selection and Validation Timothy...

This preview shows pages 1–6. Sign up to view the full content.

Chapter 9 Model Selection and Validation Timothy Hanson Department of Statistics, University of South Carolina Stat 704: Data Analysis I 1 / 40

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Salary example in proc glm Model salary (\$1000) as function of age in years, years post-high school education (educ), & political affiliation (pol), pol = D for Democrat, pol = R for Republican, and pol = O for other. data salary; input salary age educ pol\$ @@; datalines; 38 25 4 D 45 27 4 R 28 26 4 O 55 39 4 D 74 42 4 R 43 41 4 O 47 25 6 D 55 26 6 R 40 29 6 O 65 40 6 D 89 41 6 R 56 42 6 O 56 32 8 D 65 33 8 R 45 35 9 O 75 39 8 D 95 65 9 R 67 69 10 O ; options nocenter; proc glm; class pol; model salary=age educ pol / solution; run; ------------------------------------------------------------- Standard Parameter Estimate Error t Value Pr > |t| Intercept 26.19002631 B 7.89909191 3.32 0.0056 age 0.89834968 0.19677236 4.57 0.0005 educ 1.50394642 1.18414843 1.27 0.2263 pol D -9.15869409 B 4.84816554 -1.89 0.0814 pol O -25.69911504 B 4.75120999 -5.41 0.0001 pol R 0.00000000 B . . . The model is Y i = β 0 + β 1 age i + β 2 educ i | {z } 2 continuous + β 31 I { pol i = D } + β 32 I { pol i = O } + β 33 I { pol i = R } | {z } 1 categorical + i and the coefficient vector is β 0 = ( β 0 , β 1 , β 2 , β 31 , β 32 , β 33 |{z} =0 ). 2 / 40
General linear test in SAS The contrast statement in SAS PROC GLM lets you test whether one or more linear combinations of regression effects are (simultaneously) zero. To test no difference between Democrats and Republicans, H 0 : β 31 = β 33 equivalent to H 0 : β 31 - β 33 = 0, use contrast "Dem=Rep" pol 1 0 -1; . Need to include the - 1” even though SAS sets β 33 = 0! To test no difference among all political affiliations, use H 0 : β 31 - β 32 = 0 and H 0 : β 32 - β 33 = 0, given by contrast "Dem=Rep=Other" pol 1 -1 0, pol 0 1 -1; . proc glm; class pol; model salary=age educ pol / solution; contrast "Dem=Rep" pol 1 0 -1; contrast "Dem=Rep=Other" pol 1 -1 0, pol 0 1 -1; ------------------------------------------------------------- Contrast DF Contrast SS Mean Square F Value Pr > F Dem=Rep 1 240.483581 240.483581 3.57 0.0814 Dem=Rep=Other 2 2017.608871 1008.804436 14.97 0.0004 3 / 40

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
General linear test in SAS We can also test quadratic effects and interactions. From the initial fit, educ is not needed with age and pol in the model. Let’s refit: proc glm; class pol; model salary=age pol / solution; run; ------------------------------------------------------------- Source DF Type III SS Mean Square F Value Pr > F age 1 2648.275862 2648.275862 37.65 <.0001 pol 2 1982.208197 991.104098 14.09 0.0004 Standard Parameter Estimate Error t Value Pr > |t| Intercept 30.15517241 B 7.41311553 4.07 0.0012 age 1.03448276 0.16859121 6.14 <.0001 pol D -8.63793103 B 4.93543380 -1.75 0.1020 pol O -25.37931034 B 4.84730261 -5.24 0.0001 pol R 0.00000000 B . . . The Type III SS test H 0 : β 1 = 0 and H 0 : β 21 = β 22 = β 23 = 0 in Y i = β 0 + β 1 age i + β 21 I { pol i = D } + β 22 I { pol i = O } + β 23 I { pol i = R } + i 4 / 40
Drop quadratic effects? A test of the main effects model versus the quadratic model proc glm; class pol; model salary=age pol age*pol age*age / solution; contrast "drop quadratic effects?" age*age 1, age*pol 1 -1 0, age*pol 1 0 -1; ------------------------------------------------------------- Contrast DF Contrast SS Mean Square F Value Pr > F drop quadratic effects? 3 376.8443881 125.6147960 2.27 0.1369 Standard Parameter Estimate Error t Value Pr > |t| Intercept -22.13053948 B 25.12432158 -0.88 0.3972 age 3.46694474 B 1.16442934 2.98 0.0126 pol D 1.18699006 B 21.44129001 0.06 0.9568 pol O -15.72146564 B 13.51918833 -1.16 0.2695 pol R 0.00000000 B . . . age*pol D -0.28943698 B 0.61955938 -0.47 0.6495 age*pol O -0.23843048 B 0.32387727 -0.74 0.4770 age*pol R 0.00000000 B . . . age*age -0.02513595 0.01254539 -2.00 0.0704 We’ll work this out on the board. We can drop the quadratic effects (p=0.137), although there’s some indication in the table of regression effects that age 2 i might be needed.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern