On Fri, Oct 31, 2003 at 02:40:15PM -0500, Marc Belisle wrote:> Howdee, > > One of my student spotted something I can't explain: a probability >1 vs a > normal probability density function.The integral has to be 1 --- but dnorm doesn't compute that. You were probably looking for pnorm(), and it will give you 0.5 for all those cases (where x==mean) as you'd expect. Hth, Dirk> > dnorm(x=1, mean=1, sd=0.4) > [1] 0.9973557 > > > dnorm(x=1, mean=1, sd=0.39) > [1] 1.022929 > > > dnorm(x=1, mean=1, sd=0.3) > [1] 1.329808 > > > dnorm(x=1, mean=1, sd=0.1) > [1] 3.989423 > > > dnorm(x=1, mean=1, sd=0.01) > [1] 39.89423 > > > dnorm(x=1, mean=1, sd=0.001) > [1] 398.9423 > > Is there a bug with the algorithm? > > Thanks, > > Marc > > =======================> Marc B?lisle > Professeur adjoint > D?partement de biologie > Universit? de Sherbrooke > 2500 boul. de l'Universit? > Sherbrooke, Qu?bec > J1K 2R1 CANADA > > T?l: +1-819-821-8000 poste 1313 > Fax: +1-819-821-8049 > Courri?l: Marc.M.Belisle at USherbrooke.ca > Site Web: > www.usherbrooke.ca/biologie/recherche/ecologie/Belisle/belisle.html > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help >-- Those are my principles, and if you don't like them... well, I have others. -- Groucho Marx
Howdee, One of my student spotted something I can't explain: a probability >1 vs a normal probability density function.> dnorm(x=1, mean=1, sd=0.4)[1] 0.9973557> dnorm(x=1, mean=1, sd=0.39)[1] 1.022929> dnorm(x=1, mean=1, sd=0.3)[1] 1.329808> dnorm(x=1, mean=1, sd=0.1)[1] 3.989423> dnorm(x=1, mean=1, sd=0.01)[1] 39.89423> dnorm(x=1, mean=1, sd=0.001)[1] 398.9423 Is there a bug with the algorithm? Thanks, Marc =======================Marc B?lisle Professeur adjoint D?partement de biologie Universit? de Sherbrooke 2500 boul. de l'Universit? Sherbrooke, Qu?bec J1K 2R1 CANADA T?l: +1-819-821-8000 poste 1313 Fax: +1-819-821-8049 Courri?l: Marc.M.Belisle at USherbrooke.ca Site Web: www.usherbrooke.ca/biologie/recherche/ecologie/Belisle/belisle.html
"Marc Belisle" <marc.m.belisle at usherbrooke.ca> writes:> One of my student spotted something I can't explain: a probability >1 vs a > normal probability density function. > > > dnorm(x=1, mean=1, sd=0.4) > [1] 0.9973557 > > > dnorm(x=1, mean=1, sd=0.39) > [1] 1.022929 > > > dnorm(x=1, mean=1, sd=0.3) > [1] 1.329808 > > > dnorm(x=1, mean=1, sd=0.1) > [1] 3.989423 > > > dnorm(x=1, mean=1, sd=0.01) > [1] 39.89423 > > > dnorm(x=1, mean=1, sd=0.001) > [1] 398.9423 > > Is there a bug with the algorithm?No. dnorm does not return probabilities - it returns a probability density which can be greater than 1.
Dnorm isn't the probability - it's the y-value on the density function. Try plotting it - it makes a nice normal plot. See ?dnorm for definition. Bob -----Original Message----- From: Marc Belisle [mailto:marc.m.belisle@usherbrooke.ca] Sent: Friday, October 31, 2003 2:40 PM To: R-Help Subject: [R] dnorm() lead to a probability >1 Howdee, One of my student spotted something I can't explain: a probability >1 vs a normal probability density function.> dnorm(x=1, mean=1, sd=0.4)[1] 0.9973557> dnorm(x=1, mean=1, sd=0.39)[1] 1.022929> dnorm(x=1, mean=1, sd=0.3)[1] 1.329808> dnorm(x=1, mean=1, sd=0.1)[1] 3.989423> dnorm(x=1, mean=1, sd=0.01)[1] 39.89423> dnorm(x=1, mean=1, sd=0.001)[1] 398.9423 Is there a bug with the algorithm? Thanks, Marc =======================Marc Bélisle Professeur adjoint Département de biologie Université de Sherbrooke 2500 boul. de l'Université Sherbrooke, Québec J1K 2R1 CANADA Tél: +1-819-821-8000 poste 1313 Fax: +1-819-821-8049 Courriél: Marc.M.Belisle@USherbrooke.ca Site Web: www.usherbrooke.ca/biologie/recherche/ecologie/Belisle/belisle.html ______________________________________________ R-help@stat.math.ethz.ch mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help [[alternative HTML version deleted]]
On Friday 31 October 2003 20:40, Marc Belisle wrote:> Howdee, > > One of my student spotted something I can't explain: a probability > >1 vs a normal probability density function. > > > dnorm(x=1, mean=1, sd=0.4) > > [1] 0.9973557 > > > dnorm(x=1, mean=1, sd=0.39) > > [1] 1.022929 > > > dnorm(x=1, mean=1, sd=0.3) > > [1] 1.329808 > > > dnorm(x=1, mean=1, sd=0.1) > > [1] 3.989423 > > > dnorm(x=1, mean=1, sd=0.01) > > [1] 39.89423 > > > dnorm(x=1, mean=1, sd=0.001) > > [1] 398.9423 > > Is there a bug with the algorithm?The *area* under the density curve corresponds to the probability in the corresponding interval...as you might have learned in a statistics course. So it's perfeclty alright for a density function to exceed 1 if the area under the whole curve still equals one. Immediately obvious for curve(dunif(x, min = 0, max = 0.5)) hth, Z> Thanks, > > Marc > > =======================> Marc B?lisle > Professeur adjoint > D?partement de biologie > Universit? de Sherbrooke > 2500 boul. de l'Universit? > Sherbrooke, Qu?bec > J1K 2R1 CANADA > > T?l: +1-819-821-8000 poste 1313 > Fax: +1-819-821-8049 > Courri?l: Marc.M.Belisle at USherbrooke.ca > Site Web: > www.usherbrooke.ca/biologie/recherche/ecologie/Belisle/belisle.html > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help