Closed rpruim closed 6 years ago
I've added both cnorm()
and xcnorm()
.
library(mosaic)
cnorm(.95)
#> lower upper
#> [1,] -1.959964 1.959964
xcnorm(.95, mean = 100, sd = 10, alpha = 0.6)
#>
#> If X ~ N(100, 10), then
#> P(X <= 80.40036) = 0.025 P(X <= 119.59964) = 0.975
#> P(X > 80.40036) = 0.975 P(X > 119.59964) = 0.025
#>
#> [1] 80.40036 119.59964
Created on 2018-03-18 by the reprex package (v0.2.0).
I've been experimenting with how to do these displays and I'm currently leaning to this instead. Among other things, this does a better job of making sure everything fits and tallies the probability for both tails together rather than separately.
library(mosaic)
options(digits = 3)
cnorm(.95)
#> lower upper
#> [1,] -1.96 1.96
xcnorm(.95, mean = 100, sd = 10, alpha = 0.6)
#>
#> If X ~ N(100, 10), then
#> P(X <= 80.4) = 0.025 P(X <= 119.6) = 0.975
#> P(X > 80.4) = 0.975 P(X > 119.6) = 0.025
#>
#> [1] 80.4 119.6
Created on 2018-03-20 by the reprex package (v0.2.0).
Long ago, this was #290. At that time we introduced
cdist()
.I had mostly forgotten about it, but today in class a student was complaining about having to convert probabilities from "central" to "tail" when it seemed clear that R could easily do this for her. While
cdist()
exists -- I had completely forgotten about it -- there is perhaps still a place forcnorm()
which would look more likepnorm()
,qnorm()
, etc.I suppose if I do this, I should do
ct()
as well.