Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201894

Why doesn't "dnorm" sum up to one as a probability?

$
0
0

This may be some basic/fundamental question on 'dnorm' function in R. Let's say I create some z scores through z transformation and try to get the sum out of 'dnorm'.

 data=c(232323,4444,22,2220929,22323,13)
 z=(data-mean(data))/sd(data)
 result=dnorm(z,0,1)
 sum(result)
 [1] 1.879131

As above, the sum of 'dnorm' is not 1 nor 0.

Then let's say I use zero mean and one standard deviation even in my z transformation.

 data=c(232323,4444,22,2220929,22323,13)
 z=(data-0)/1
 result=dnorm(z,0,1)
 sum(result)
 [1] 7.998828e-38

I still do not get either 0 or 1 in sum.

If my purpose is to get sum of the probability equal to one as I will need for my further usage, what method do you recommend using 'dnorm' or even using other PDF functions?


Viewing all articles
Browse latest Browse all 201894

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>