[R] Finding points with equal probability between normal distributions
Uwe Ligges
ligges at statistik.uni-dortmund.de
Mon Aug 7 13:01:52 CEST 2006
Eleni Rapsomaniki wrote:
> Dear mailing list,
>
> For two normal distributions, e.g:
>
> r1 =rnorm(20,5.2,2.1)
> r2 =rnorm(20,4.2,1.1)
> plot(density(r2), col="blue")
> lines(density(r1), col="red")
dr1 <- density(r1, from=-3, to=14)
dr2 <- density(r2, from=-3, to=14)
w <- which(diff(sign(dr2$y - dr1$y)) != 0)
dr1$x[w]
plot(dr1, ylim = c(0, 0.33))
lines(dr2, col = "red")
abline(v = dr1$x[w], col = "blue")
Uwe Ligges
> Is there a way in R to compute/estimate the point(s) x where the density of the
> two distributions cross (ie where x has equal probability of belonging to
> either of the two distributions)?
>
> Many Thanks
>
> Eleni Rapsomaniki
> PhD student
> Birkbeck College, UK
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list