0% found this document useful (0 votes)
196 views

R - How Dnorm Works? - Stack Overflow

Uploaded by

vaskore
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
196 views

R - How Dnorm Works? - Stack Overflow

Uploaded by

vaskore
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

4

Products Search… 1 1

Home
How dnorm works? Ask Question

PUBLIC Asked 2 years, 10 months ago Active 2 years, 10 months ago Viewed 2k times

Stack Overflow
I am very new to Statistics and R. Maybe this is a very trivial question, but I don't really understand
Tags The Overflow Blog
how this works.
Users 6 The semantic future of the web
Suppose I use dnorm(5, 0, 2.5) . What does that mean?
FIND A JOB Podcast 294: Cleaning up build systems
I saw some resources where they told that this function computes the height of the point in the and gathering computer history
Jobs
density curve.
Companies 3 Featured on Meta
Now again I read that the exact probability of a number is 0 in continuous distribution. So, my
TEAMS What’s this? question is if I can find out the height or probability of a certain value, then how come it is 0? New Feature: Table Support

Free 30 Day Trial


I know I have mixed up some concepts. But I'm unable to find where I'm wrong. It will be great if Hot Meta Posts
you spare your time to make me understand this. Thanks in advance.
9 Synonym proposal [opensoundcontrol] ->
[osc]
r statistics probability-distribution
6 Synonym Request: visual-studio-code-
extension to vscode-extensions
share edit follow asked Jan 28 '18 at 4:08
11 Was it correct to upvote this answer which
pratyay
didn't provide a solution?
2,336 1 21 35

add a comment 49 Why don't searches consider the tags?

1 Answer Active Oldest Votes

The density returns a number that in itself does not translate directly into a probability. But it gives
the height of a curve that, if drawn over the full range of possible numbers, has the area
7 underneath it that adds up to 1.

Consider this. If I make the vector x of evenly spaced numbers from -7.5 to 7.5, 0.1 apart, and get
the density of a normal variable with mean 0 and standard deviation 2.5 for each value of x .

x <- seq(from = -7.5, to = 7.55, by = 0.1)


y <- dnorm(x, 0, 2.5)
Report this ad

The approximate value of the area under the curve formed by those densities (which I have stored
as y ), multiplied by their distance apart (0.1) is nearly 1: Looking for a job?
Software Engineering - Core Java -
> sum(y * 0.1) Associate
[1] 0.9974739
JPMorgan Chase Bank, N.A.
Mumbai, India

If you did this properly with calculus rather than approximating it with numbers, it would be exactly java multithreading

one.
Software Engineering - Python
JPMorgan Chase Bank, N.A.
Why is this useful? The cumulative area under parts of the curve can be used to estimate the Mumbai, India
probability of the variable coming anywhere in a particular range, even though as one of your
python c++
sources points out, the chance of any precise number is technically zero for a continuous variable.
Software Engineering
Consider this graphic. The area of the shaded space shows the chance of a variable from your JPMorgan Chase Bank, N.A.
normal distribution (mean zero, standard deviation 2.5) being between -7.5 and 4. This leads to Mumbai, India
many useful applications. jenkins jira

Be one of the first applicants

Software Engineering
JPMorgan Chase Bank, N.A.
Mumbai, India
java oracle

Software Engineering - Python


JPMorgan Chase Bank, N.A.
Mumbai, India
python java

Software Engineering
JPMorgan Chase Bank, N.A.
Mumbai, India
python java

CT-RDT-Client-Java Developer-
Mumbai
JPMorgan Chase Bank, N.A.
Mumbai, India
design user-interface

Be one of the first applicants


Made with:
Software Architect
Decodify.me LLC No office location
library(ggplot2)
$50K - $70K REMOTE
d <- data.frame(x, y) django javascript

ggplot(d, aes(x = x, y = y)) +


geom_line() + View more jobs on Stack Overflow
geom_point() +
geom_ribbon(fill = "steelblue", aes(ymax = y), ymin = 0, alpha = 0.5, data = subset(d, x <= 4)) +
Linked
annotate("text", x= -4, y = 0.13, label = "Each point is an individual density\nestimate of dnorm(x, 0, 2.5)") +
annotate("text", x = -.3, y = 0.02, label = "Filled area under the curve shows the cumulative probability\nof getting a number as
ggtitle("Density of a random normal variable with mean zero and standard deviation 2.5")2 Best way to plot smooth normal distribution
in ggplot

share edit follow answered Jan 28 '18 at 4:38


Related
Peter Ellis
1363 How to sort a dataframe by multiple
4,620 23 39
column(s)

1 Wooow! Thanks a ton! This made things super clear.. :) – pratyay Jan 28 '18 at 4:41 1307 How to join (merge) data frames (inner,
outer, left, right)
What happens if the mean is a matrix? I have some code that has x as a vector (1x315) and the mean is a
matrix (315x315) and the standard deviation is a vector of size 1x99225 I can't figure out why that works. 2470 How to make a great R reproducible
It returns a matrix of size 315x315. – Math4Life Dec 27 '18 at 19:47 example

1 Hi @Math4Life that sounds like it needs a separate question – Peter Ellis Jan 21 '19 at 3:04 1 how to find upper limit of integral if area is
known in R?
Hi, @PeterEllis. Great answer. How do I interpret that dnorm(1.12, mean = 1.0888677, sd =
0.030749282) is equal to 7.771136 ? Shouldn't the output of dnorm be between 0 and 1? – Krantz 2 Having Trouble Visualizing a T-Distribution
Feb 13 '19 at 14:04 in Python

2 IQR and Quartiles are not generated as


add a comment
expected in R

2 Estimating probability density in a range


Your Answer between two x values on simulated data

Hot Network Questions


QA is at capacity, Development has room
Links Images Styling/Headers Lists Blockquotes Code HTML Tables Advanced help
what would be a fair and deterring disciplinary
sanction for a student who commited plagiarism?

Mimic the X11 Primary selection

Windows 10 - Which services and Windows


features and so on are unnecesary and can be
safely disabled?

Drawing automatically updating dashed arrows in


tikz

more hot questions

Question feed

Post Your Answer

Not the answer you're looking for? Browse other questions tagged r statistics probability-distribution or
ask your own question.

STACK OVERFLOW PRODUCTS COMPANY STACK EXCHANGE Blog Facebook Twitter LinkedIn Instagram
NETWORK
Questions Teams About
Technology
Jobs Talent Press
Life / Arts
Developer Jobs Directory Advertising Work Here
Culture / Recreation
Salary Calculator Enterprise Legal
Science
Help Privacy Policy
Other
Mobile Contact Us
site design / logo © 2020 Stack Exchange Inc; user contributions
Disable Responsiveness licensed under cc by-sa. rev 2020.12.10.38158

You might also like