Lecture 10 F-tests in MLR (continued) Coefficients of DeterminationF-tests continuedRecall earlier exampleSlide 4But, Global F is part of the “summary” output so no need for the additional calculationsPartial F testANOVA tables with 3 covariatesSlide 8Interpretation of ANOVA table with >1 covariateF-tests and p-values in ANOVA tableSlide 11Slide 12ImplicationsF-testsF-tests (continued)More on the partial F testTesting more than two covariatesSlide 18Using ANOVA table resultsR: simpler approachRTesting multiple coefficients simultaneouslyContinued…Recall previous exampleHow to test the interaction terms?Approach 1Approach 2Concluding remarks r.e. F-testCoefficient of DeterminationR2Use of R2SENIC exampleMisunderstandings r.e. R2What if we remove the ‘insignificant’ X’s?R2 decreased?“Solution”Coefficients of Partial DeterminationExample: X1 = ms, X2 = INFRISKSlide 39General CaseLecture 10F-tests in MLR (continued)Coefficients of DeterminationBMTRY 701Biostatistical Methods IIF-tests continuedTwo kinds of F-testsOverall F-test (or Global F-test)•tests whether or not there is a regression relation between Y and the set of covariates•For a regression with p covariates, the overall F-test compares•F* = MSR/MSE ~ F(p, n-p-1)0 oneleast at :0:k1210HHpRecall earlier example“Full” modelThe overall F-test tests if there is some associationiieNURSENURS EMSINFRISKLOS 2432100 oneleast at :0:k143210HH> reg1 <- lm(LOS ~ INFRISK + ms + NURSE + nurse2, data=data)> anova(reg1)Analysis of Variance TableResponse: LOS Df Sum Sq Mean Sq F value Pr(>F) INFRISK 1 116.446 116.446 45.4043 8.115e-10 ***ms 1 12.897 12.897 5.0288 0.02697 * NURSE 1 1.097 1.097 0.4277 0.51449 nurse2 1 1.789 1.789 0.6976 0.40543 Residuals 108 276.981 2.565 ---SSR <- 116.45 + 12.90 + 1.10 + 1.79SSE <- 276.98MSR <- SSR/4MSE <- SSE/108Fstar <- MSR/MSEFstar1 - pf(Fstar, 4, 108)But, Global F is part of the “summary” output so no need for the additional calculations> summary(reg1)Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 6.355e+00 5.266e-01 12.068 < 2e-16 ***INFRISK 6.289e-01 1.339e-01 4.696 7.86e-06 ***ms 7.829e-01 5.211e-01 1.502 0.136 NURSE 4.136e-03 4.093e-03 1.010 0.315 nurse2 -5.676e-06 6.796e-06 -0.835 0.405 ---Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Residual standard error: 1.601 on 108 degrees of freedomMultiple R-squared: 0.3231, Adjusted R-squared: 0.2981 F-statistic: 12.89 on 4 and 108 DF, p-value: 1.298e-08Partial F testpartial because it tests “part” of the model.tests one or more covariates simultaneouslyCan be done using the ANOVA table, if covariates are entered in the ‘correct’ orderOr, by comparing results from regression tablesExamples:0or 0 :0:431430HH0:0:4140HHANOVA tables with 3 covariatesSS df MSX1SS(X1) 1 SS(X1)/1X2|X1SS(X2|X1) 1 SS(X2|X1)/1X3|X2,X1SS(X3|X2,X1) 1 SS(X3|X2,X1)/1ErrorSSE n – 4 SSE/(n-4)TotalSST n - 1ANOVA tables with 3 covariatesSS df MSRegressionSS(X1,X2,X3) 3 SSR/3X1SS(X1) 1 SS(X1)/1X2|X1SS(X2|X1) 1 SS(X2|X1)/1X3|X2,X1SS(X3|X2,X1) 1 SS(X3|X2,X1)/1ErrorSSE n – 4 SSE/(n-4)TotalSST n - 1where SS(X1,X2,X3) = SS(X1) + SS(X2|X1) + SS(X3|X2,X1)Interpretation of ANOVA table with >1 covariate> anova(reg1)Analysis of Variance TableResponse: LOS Df Sum Sq Mean Sq F value Pr(>F) INFRISK 1 116.446 116.446 45.4043 8.115e-10 ***ms 1 12.897 12.897 5.0288 0.02697 * NURSE 1 1.097 1.097 0.4277 0.51449 nurse2 1 1.789 1.789 0.6976 0.40543 Residuals 108 276.981 2.565SSR(INFRISK) = 116.446SSR(ms | INFRISK) = 12.897SSR(NURSE| ms, INFRISK) = 1.097SSR(nurse2| nurse, ms, INFRISK) = 1.789What are these F-tests and pvalues testing?F-tests and p-values in ANOVA tableThey are tests for a covariate, conditional on what is above it in the table.Example: •F statistic for INFRISK tests•is it adjusted for other covariates?noit tests INFRISK in the presence of no other covariatesp < 0.00010:0:1110HHF-tests and p-values in ANOVA tableExample: •F statistic for ‘ms’ tests•is it adjusted for other covariates?yesit tests the significance of ms, after adjusting for INFRISK p = 0.03Example: F-statistic for nurse2 tests significance of β4, adjusting for INFRISK, ms, NURSE. p = 0.410:0:2120HHInterpretation of ANOVA table with >1 covariate> reg1a <- lm(LOS ~ ms + NURSE + nurse2 + INFRISK , data=data)> anova(reg1a)Analysis of Variance TableResponse: LOS Df Sum Sq Mean Sq F value Pr(>F) ms 1 36.084 36.084 14.0699 0.0002852 ***NURSE 1 17.178 17.178 6.6980 0.0109794 * nurse2 1 22.421 22.421 8.7425 0.0038187 ** INFRISK 1 56.546 56.546 22.0481 7.857e-06 ***Residuals 108 276.981 2.565 ---SSR(ms) = 36.084SSR(NURSE| ms) = 17.178SSR(nurse2| ms, NURSE) = 22.421SSR(INFRISK| ms, NURSE, nurse2 ) = 56.546ImplicationsANOVA table results depends on the order in which the covariates appearIf you want to use ANOVA table to test one or more covariates, they should come at the endreg1: •we can see if INFRISK is significant without any adjustments•we can see if nurse2 is significant adjusting for everything elsereg1a: •we can see if INFRISK is significant adjusting for everything else•we can see if nurse2 is significant, adjusting for NURSE and ms, but not adjusting for INFRISKF-testsGlobal F-testPartial F-test for ONE covariateMSEMSRpnXXSSEpXXSSRFpp),,(),,(*11MSEXXXMSRpnXXSSEXXXSSRFppppp),,|(),,(1),,|(*11111F-tests (continued)Partial F-test for >1 covariateImplications: •The denominator is always the MSE from the full model•The numerator can always be determined by entering the covariates in the order in which you want to test them•Recall: additivity of sums of squaresMSEXXXXMSRpnXXSSEqpXXXXSSRFqpqpqpq),,|,(),,(),,|,(*11111More on the partial F testTest whether an individual βk = 0Test whether a set of βk = 0Model 1:Model 2:Model 3:iieNURSENURS EMSINFRISKLOS
View Full Document