[R] Finding points with equal probability between normaldistributions
Dimitris Rizopoulos
dimitris.rizopoulos at med.kuleuven.be
Mon Aug 7 13:18:50 CEST 2006
if you want to base it on Normality, then you can use:
prob <- function(x){
dnorm((x - 5.2) / 2.1) / 2.1 - dnorm((x - 4.2) / 1.1) / 1.1
}
uniroot(prob, c(-3, 3))
otherwise if you want to estimate it you can use Uwe's solution.
I hope it helps.
Best,
Dimitris
----
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http://med.kuleuven.be/biostat/
http://www.student.kuleuven.be/~m0390867/dimitris.htm
----- Original Message -----
From: "Eleni Rapsomaniki" <e.rapsomaniki at mail.cryst.bbk.ac.uk>
To: <r-help at stat.math.ethz.ch>
Sent: Monday, August 07, 2006 12:35 PM
Subject: [R] Finding points with equal probability between
normaldistributions
> 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")
>
> 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.
>
Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm
More information about the R-help
mailing list