[R] logit in "car" package

John Fox jfox at mcmaster.ca
Tue Mar 10 14:31:49 CET 2015


Dear Kathryn,

On Tue, 10 Mar 2015 03:24:03 -0700 (PDT)
 kat123 <kathryn.harrold at northampton.ac.uk> wrote:
> I have run a logit data transformation in R using the logit function in the
> package car.
> 
> http://cran.r-project.org/web/packages/car/car.pdf
> 
> If i run logit on a column of data that contains a 0 value it makes and
> adjustment according to the literature of 0.025.
> 
> I thought this meant that it was running the transformation as 
> 
> log((p+0.025)/ (1-(p+0.025)))

It's not that simple -- think what would happen if there were both 0s and 1s in the data:

> p <- 0:1

> log((p+0.025)/ (1-(p+0.025)))
[1] -3.663562       NaN
Warning message:
In log((p + 0.025)/(1 - (p + 0.025))) : NaNs produced

> logit(p)
[1] -3.663562  3.663562
Warning message:
In logit(p) : proportions remapped to (0.025, 0.975)

> log(c(0.025, 0.975)/(1 - c(0.025, 0.975)))
[1] -3.663562  3.663562


To see what logit() does simply print it by typing logit at the command prompt.

I hope this helps,
 John

------------------------------------------------
John Fox, Professor
McMaster University
Hamilton, Ontario, Canada
http://socserv.mcmaster.ca/jfox/
	
> 
> However, if I run individual values through this equation they do not match
> up to the output of the logit function.
> 
> Any suggestions?
> 
>  
> 
> 
> 
> --
> View this message in context: http://r.789695.n4.nabble.com/logit-in-car-package-tp4704408.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list