Learn R Programming

SALTSampler (version 1.1.0)

Logit: Logit of a Probability Vector

Description

Returns the logit of a vector of probabilities, \(p\). When logp is set to TRUE, the second argument contains natural logs of probabilities.

Usage

Logit(p, logp = FALSE)

Arguments

p

Vector of probabilities or log probabilities

logp

Boolean which is FALSE when the first argument contains probabilities and TRUE when the first argument contains log probabilities

Examples

Run this code
# NOT RUN {
#Find logit on natural scale
a <- c(0.4, 0.4, 0.1, 0.1)
Logit(p = a)

#Find logit on log scale
b <- c(log(1e-4), log(1e-6), log(1 - 1e-6))
b <- b/sum(b)
Logit(p = b, logp = FALSE)
# }

Run the code above in your browser using DataLab