[go: up one dir, main page]

Menu

[749e29]: / man / logit.Rd  Maximize  Restore  History

Download this file

54 lines (42 with data), 1.1 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
\name{logit}
\alias{logit}
\alias{inv.logit}
\title{Generalized logit and inverse logit function}
\description{
Compute generalized logit and generalized inverse logit functions.
}
\usage{
logit(x, min = 0, max = 1)
inv.logit(x, min = 0, max = 1)
}
\arguments{
\item{x}{value(s) to be transformed}
\item{min}{Lower end of logit interval}
\item{max}{Upper end of logit interval}
}
\details{
The generalized logit function takes values on [min, max] and
transforms them to span [-Inf,Inf] it is defined as:
\deqn{y = log(\frac{p}{(1-p)})}{y = log(p/(1-p))}
where
\deqn{p=\frac{(x-min)}{(max-min)}}{p=(x-min)/(max-min)}
The generized inverse logit function provides the inverse
transformation:
\deqn{x = p' (max-min) + min}{x = p * (max-min) + min}
where
\deqn{p'=\frac{exp(y)}{(1+exp(y))}}{exp(y)/(1+exp(y))}
}
\value{
Transformed value(s).
}
\author{Gregory R. Warnes <greg@warnes.net>}
\examples{
\dontrun{
x <- seq(0,10, by=0.25)
xt <- logit(x, min=0, max=10)
cbind(x,xt)
y <- inv.logit(xt, min=0, max=10)
cbind(x,xt,y)
}
}
\keyword{math}