Calculates the logit or the inverse logit of a value
logit(prob, base = exp(1)) invlogit(alpha, base = exp(1))
prob | vector of probabilities |
---|---|
base | base of the logarithmic function to use |
alpha | vector of values to find the inverse logit of |
A numeric vector
logit(0.5)#> [1] 0#> [1] -4.59511985 -3.89182030 -3.47609869 -3.17805383 -2.94443898 -2.75153531 #> [7] -2.58668934 -2.44234704 -2.31363493 -2.19722458 -2.09074110 -1.99243016 #> [13] -1.90095876 -1.81528997 -1.73460106 -1.65822808 -1.58562726 -1.51634749 #> [19] -1.45001018 -1.38629436 -1.32492541 -1.26566637 -1.20831121 -1.15267951 #> [25] -1.09861229 -1.04596856 -0.99462258 -0.94446161 -0.89538405 -0.84729786 #> [31] -0.80011930 -0.75377180 -0.70818506 -0.66329422 -0.61903921 -0.57536414 #> [37] -0.53221681 -0.48954823 -0.44731222 -0.40546511 -0.36396538 -0.32277339 #> [43] -0.28185115 -0.24116206 -0.20067070 -0.16034265 -0.12014431 -0.08004271 #> [49] -0.04000533 0.00000000 0.04000533 0.08004271 0.12014431 0.16034265 #> [55] 0.20067070 0.24116206 0.28185115 0.32277339 0.36396538 0.40546511 #> [61] 0.44731222 0.48954823 0.53221681 0.57536414 0.61903921 0.66329422 #> [67] 0.70818506 0.75377180 0.80011930 0.84729786 0.89538405 0.94446161 #> [73] 0.99462258 1.04596856 1.09861229 1.15267951 1.20831121 1.26566637 #> [79] 1.32492541 1.38629436 1.45001018 1.51634749 1.58562726 1.65822808 #> [85] 1.73460106 1.81528997 1.90095876 1.99243016 2.09074110 2.19722458 #> [91] 2.31363493 2.44234704 2.58668934 2.75153531 2.94443898 3.17805383 #> [97] 3.47609869 3.89182030 4.59511985invlogit(-10:10)#> [1] 4.539787e-05 1.233946e-04 3.353501e-04 9.110512e-04 2.472623e-03 #> [6] 6.692851e-03 1.798621e-02 4.742587e-02 1.192029e-01 2.689414e-01 #> [11] 5.000000e-01 7.310586e-01 8.807971e-01 9.525741e-01 9.820138e-01 #> [16] 9.933071e-01 9.975274e-01 9.990889e-01 9.996646e-01 9.998766e-01 #> [21] 9.999546e-01