# Re: [R] difference between lrm's "Model L.R." and anova's "Chi-Square"

From: Frank E Harrell Jr <f.harrell_at_vanderbilt.edu>
Date: Sat, 01 Mar 2008 22:15:26 -0600

johnson4_at_babel.ling.upenn.edu wrote:
> I am running lrm() with a single factor. I then run anova() on the fitted
> model to obtain a p-value associated with having that factor in the model.
>
> I am noticing that the "Model L.R." in the lrm results is almost the same
> as the "Chi-Square" in the anova results, but not quite; the latter value
> is always slightly smaller.
>
> anova() calculates the p-value based on "Chi-Square", but I have
> independent evidence that "Model L.R." is the actual -2*log(LR), so should
> I be using that?
>
> Why are the values different?

>
> prob_a <- inv.logit(rnorm(1,0,1))
> prob_b <- inv.logit(rnorm(1,0,1))
> data <- data.frame(
> factor=c(rep("a",500),rep("b",500)),
> outcome=c(sample(c(1,0),100,replace=T,prob=c(prob_a,1-prob_a)),
> sample(c(1,0),100,replace=T,prob=c(prob_b,1-prob_b))))
> fit <- lrm(outcome~factor,data)
>
> fit # gives "Model L.R." e.g. 8.23, 11.76, 6.89...
> anova(fit) # gives "Chi-Square" e.g. 8.19, 11.69, 6.85...
>
> Previous Next | Save | Delete | Reply |
>
> ______________________________________________
> R-help_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> and provide commented, minimal, self-contained, reproducible code.
>

```--
Frank E Harrell Jr   Professor and Chair           School of Medicine
Department of Biostatistics   Vanderbilt University

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help