Learn R Programming

car (version 3.1-3)

logit: Logit Transformation

Description

Compute the logit transformation of proportions or percentages.

Usage

logit(p, percents, adjust)

Value

a numeric vector or array of the same shape and size as p.

Arguments

p

numeric vector or array of proportions or percentages.

percents

TRUE for percentages, FALSE for proportions. If the argument is missing and the largest value of p > 1, percents is set to TRUE, otherwise to FALSE.

adjust

adjustment factor to avoid proportions of 0 or 1; defaults to 0 if there are no such proportions in the data, and to .025 if there are.

Author

John Fox jfox@mcmaster.ca

Details

Computes the logit transformation logit \(=\log [p/(1-p)]\) for the proportion \(p\).

If \(p=0\) or \(1\), then the logit is undefined. logit can remap the proportions to the interval (adjust, 1 - adjust) prior to the transformation. If it adjusts the data automatically, logit will print a warning message.

References

Fox, J. and Weisberg, S. (2019) An R Companion to Applied Regression, Third Edition, Sage.

See Also

probabilityAxis

Examples

Run this code
save.opt <- options(digits=4)
logit(.1*0:10)
logit(.1*0:10, adjust=0)
options(save.opt)

Run the code above in your browser using DataLab