Docsity

Testing Logistic Regression Parameters - Lecture Slides | STAT 572, Exams of Statistics

Toggle sidebar
bg1
1
4/5/04 1
Testing Logistic
Regression Parameters
Chapter 14
Part 2
4/5/04 2
Tests in Logistic Regression
lRecall that in linear models, standard
software output includes
•An ANOVA F-test on all model parameters
•Partial tests on each model parameter
lAnd in addition, we can obtain
•Full vs reduced model tests
•Extra sum of squares tests
4/5/04 3
Logistic Regression
lThe same ideas –full model test, partial
tests, full vs reduced model tests –
pertain in logistic regression.
lOnly the details (test statistics,
terminology) differ.
lRefer to the data in Table 14.1, about
success at a task as a function of month
of experience.
4/5/04 4
Modeling the Odds of Success
Intercept
months
Term
-3.0596954
0.1614859
Estimate
1.2593518
0.0649801
Std Error
5.90
6.18
ChiSquare
0.0151
0.0129
Prob>ChiSq
For log odds of 1/2
Parameter Estimates
months
Source 1
Nparm 1
DF 6.17601678
Wald ChiSquare 0.0129
Prob>ChiSq
Effect Wald Tests
4/5/04 5
Tests on a Single Coefficient
lFor reasonably large samples,
lor equivalently,
lThis is the Wald test of H0: βk= 0
)1,0(~
}{ Nz
bs
b
k
kk =
−
β
2
1
2~χz
4/5/04 6
Test on Several Coefficients
lIn a multiple logistic regression, we may
desire a simultaneous test of several
regression coefficients:
H0: reduced model
H1: full model
lAnalogous to the general linear test
procedure for linear models is the
likelihood ratio test for nonlinear models.
pf3
pf4
pf5
pf8

Partial preview of the text

Download Testing Logistic Regression Parameters - Lecture Slides | STAT 572 and more Exams Statistics in PDF only on Docsity!

4/5/04 1

Testing Logistic

Regression Parameters

Chapter 14

Part 2

4/5/04 2

Tests in Logistic Regression

l Recall that in linear models, standard

software output includes

• An ANOVA F -test on all model parameters

• Partial tests on each model parameter

l And in addition, we can obtain

• Full vs reduced model tests

• Extra sum of squares tests

4/5/04 3

Logistic Regression

l The same ideas – full model test, partial

tests, full vs reduced model tests –

pertain in logistic regression.

l Only the details (test statistics,

terminology) differ.

l Refer to the data in Table 14.1, about

success at a task as a function of month

of experience.

4/5/04 4

Modeling the Odds of Success

Intercept months

Term -3.

Estimate

Std Error

ChiSquare

Prob>ChiSq

For log odds of 1/

Parameter Estimates

months

Source 1

Nparm 1

DF

Wald ChiSquare

Prob>ChiSq

Effect Wald Tests

4/5/04 5

Tests on a Single Coefficient

l For reasonably large samples,

l or equivalently,

l This is the Wald test of H 0 : βk = 0

z N

sb

b

k

k −^ βk =

z ~ χ

4/5/04 6

Test on Several Coefficients

l In a multiple logistic regression, we may

desire a simultaneous test of several

regression coefficients:

H 0 : reduced model

H 1 : full model

l Analogous to the general linear test

procedure for linear models is the

likelihood ratio test for nonlinear models.

4/5/04 7

Fit Full and Reduced Models

l Fit the full model, find maximum

likelihood estimates of parameters, b f,

and evaluate the likelihood function L ( β )

when β f = b f.

l Call this value L ( F ).

l Then fit the reduced model and obtain

L ( R ).

l Note that L ( R ) = L ( F ).

4/5/04 8

Test Statistic

l The likelihood ratio test statistic is

l where p - q is the number of coefficients

being tested.

l Note that if L(R)/L(F) is small, indicating

that H 0 is false, then G^2 will be large

2 2

2 log e pq

LF

LR

G  −

4/5/04 9

Example

l Refer to the example that begins on page 581.

l In Table 14.3 are the first half of the cases ( cases) from Appendix C10: the Disease Outbreak data set.

l Data are from a study to investigate the epidemic outbreak of a disease that is spread by mosquitoes. l Response is the presence of disease in an individual (1 = yes, 0 = no).

4/5/04 10

Example, continued

l Predictors:

  • Age (numerical)
  • SES (upper = 1, middle = 2, lower = 3 recoded into 0 –1 indicators of middle and lower)
  • Sector of the city (1, 2 recoded to an indicator of sector 2)

l Multiple logistic regression is performed.

4/5/04 11

Select First 96 Cases

l In order to use only the first 98 cases in

the data set,

  • From the Rows menu, select Select , then Where.
  • Fill in the blanks in the box (next slide)
  • The first 98 cases will be highlighted.
  • Then in the Tables menu, select Subset and a new data set will be formed which contains only the selected rows.

4/5/04 12

4/5/04 19

Reduced Model

l Let us show how the partial test for age

is obtained.

l Fit a multiple logistic regression without

age, but with the other three terms.

l The Whole Model Test for the reduced

model is shown on the next slide.

4/5/04 20

Converged by Gradient Whole-Model Test Model Difference Full Reduced

-LogLikelihood

DF 3

ChiSquare

Prob>ChiSq

RSquare (U) Observations (or Sum Wgts)

98

As on slide 16.

4/5/04 21

Partial Test on Age

l Here. The full model contains four regressors and the reduced model contains 3. The chi- square statistic will thus have 4 – 3 = 1 d.f. l Its value is 2(53.1018 – 50.5271) = 5.1494, as is found on slide #18. l Since p = 0.0233, we would conclude that age should be retained in the model.

4/5/04 22

Effect Tests

l Note that the Effect Test box looks almost identical to the Likelihood Ratio Tests box (see next slide). l The difference is that the Effect Test uses the Wald Chi-Square instead of the L-R Chi- Square.

  • Wald tests are generally viewed as approximations to L-R tests, which are generally preferred.
  • Note that p -values in the Parameter Estimates and Effect Tests are the same.

4/5/04 23

Effect Test

Source age middle lower sector

Nparm 1 1 1 1

DF 1 1 1 1

Wald ChiSquare

Prob>ChiSq

4/5/04 24

Testing SES

l Our results indicate that neither the middle SES nor the lower SES differs significantly from the upper SES in terms of disease incidence. l Does that mean that there is no effect of SES? l We can test H0: βmid = βlow = 0|βage, βsec in two ways:

4/5/04 25

1. Full vs Reduced Model

l If we fit the model with only age and the sector 2 indicator, the –LogLikelihood value for the reduced model is 51.129665. l Twice the difference between this and the – logL for the model including SES is only χ 2 =1.205, with 2 d.f. l This is (according to the tables in the book) not even close to being significant at 0.10. l Note: the value 1.205 can also be found on slide #27.

4/5/04 26

2. Designate SES as Nominal

l We can also get this simultaneous test by allowing JMP to code the SES levels. l Designate SES and Sector as nominal and let JMP take care of the coding. l We see under Effect Test the same Chi- Square value as from fitting the reduced model.

4/5/04 27

Effect Likelihood-Ratio Tests

Source age ses sector

Nparm 1 2 1

DF 1 2 1

L-R ChiSquare

Prob>ChiSq

4/5/04 28

Confidence Intervals on the

Coefficients

l If the sample size is large, then

for j = 1, 2, …, k. l Thus, an approximate 100(1 – α)% confidence interval on βj is given by

l JMP has a selection for these confidence intervals in the drop down menu.

b (^) j ± z (^) ( 1 − α / 2 (^) ) s b { (^) j }

b

s b

z

j j

j

4/5/04 29

RSquare

l From slide #11, we have that

= =

R LogLikelihood reduced^ LogLikelihood full LogLIkelihood reduced

2 = −^ − −

( ) [ ( )]

4/5/04 30

Prediction

l The fitted logistic regression equation gives predicted probabilities of success, given values of the regressors. l Based on these probabilities, we can classify an individual as a success or a failure:

  • If the predicted probability of success is high, classify the case as a success; otherwise not.
  • Question: how high is “high”?

4/5/04 37

Other Cutoffs

l Table 14.12 on page 605 shows error

rates for other choices of the cutoff

probability.

l Note that 0.316 = 31/98 is the overall

fraction of successes in the sample.

4/5/04 38

“Optimal” Cutoff Rate

l In Table 14.12, the overall error rate seems to be minimized when the cutoff is 0.325.

  • At this point, the false positive and false negative rates are pretty close.
  • The farther the cutoff point is from “optimal”, the less balanced are the error rates. You’d take this into consideration if one type of error is more serious than the other.

4/5/04 39

Verification on a Holdout

Sample

l The parameter estimates, and thus predicted probabilities, are optimal for the data from which they were derived.

l You would not expect this equation to perform as well on new data.

l If you have a holdout sample, you can apply these results and see how well your fitted model performs.

4/5/04 40

Holdout Sample

l We used the first half of the cases in the data set to fit the model. Now let’s use it on the other half and see how well it does. l Select the last 98 cases from the data file. l Define a column of predicted probabilities using the equation in slide #9. l Define a column defining “success” and “failure” based on the predicted probabilities.

4/5/04 41

Error Rate Summary (1 = disease)

predicted

status

Count 0 1

Contingency Table

4/5/04 42

Surprising Result

l False positive rate = 62/72 = 0.

l False negative rate = 11/26 = 0.

l Overall error rate = 73/98 = 0.

4/5/04 43

Conclusion

l Assuming that the error rate in the

holdout sample is not a lot different from

the error rate in the test sample, we

could conclude that we have a

reasonable estimate of what the error

rate might be when applied to new data.

4/5/04 44

Homework

l Problems 14.13, 14.

l Due: __________________