0
$\begingroup$

there is this thing that bothers me so much about the likelihood ratio test application in GLMs.

Suppose we want to test whether we can drop some of the covariates for the model. Than we expect the difference in deviances to behave like a chi-squared random variable and we can test this by using a LRT and based on its p-value say whether we want to discard or assume the null hypothesis.

The following is an R-code which uses this test:

1-pchisq(bw.glm2$deviance-bw.glm$deviance,2)

[1] 0.002490797

The question is: Why do we have the 1- bit in the beginning in order to calculate the p-value?

Thanks a lot

$\endgroup$
  • 5
    $\begingroup$ The default in R is to return the lower tail probability of the $\chi^2$ distribution (or just about any other distribution for that matter). If you don't want to include 1- add the argument lower.tail=F to your pchisq() function. $\endgroup$ – Matt Barstead Jan 18 '18 at 19:53
  • $\begingroup$ I see, so removing the $-1$ results in giving the probability that the value of the variable having this distribution is less extreme than the observed value, is that so? $\endgroup$ – asdf Jan 18 '18 at 19:55
  • 1
    $\begingroup$ Yep, which is why you can subtract it from 1 to obtain the right tail probability (which is typically the probability of interest when using the $\chi^2$ distribution). Like a lot of programs, R cannot know what probability you are interested in when using these built-in distribution functions. So, it has to choose some default, which for these sorts of distribution functions is to return the lower tail probability. $\endgroup$ – Matt Barstead Jan 18 '18 at 20:01
  • $\begingroup$ Thanks a lot, you are the best! If you write it as an answer, I'll accept it and upvote it! $\endgroup$ – asdf Jan 18 '18 at 20:02
  • $\begingroup$ Hey @MattBarstead just a quick question, how did you edited the question in such a way? I mean, to avoid the latex stuff? $\endgroup$ – asdf Jan 19 '18 at 11:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.