Skip to content

function of probability for normal distribution

4 messages · JClark, Charles C. Berry, David Winsemius +1 more

#
Dear Greg Snow,

I'm a biologist trying to write a mathematical formula for a doubly
truncated normal distribution to be used in the language "R". I realise this
is simple stuff for a mathematician but I'm stumped. 
Wikipedia gives what seems a fairly simple formula - with function = maths
with mean and standard deviation - but also phi - WHAT IS PHI !!?? -
especially how do I write this in "R" and why is the top "phi" in italics ??

Hoping you can help.

Yours sincerely,

Jeremy Clark
#
On Wed, 19 Jan 2011, JClark wrote:

            
On

 	http://en.wikipedia.org/wiki/Truncated_normal_distribution

it says (by copy-and-paste)

"The density function involves \scriptstyle{\phi(\cdot)} \ , which is the 
probability density function of the standard normal distribution and 
\scriptstyle{\Phi(\cdot)} \ , its cumulative distribution function."

There are some links there that you can follow to get up to speed.
Hmmm. Try the posting guide's suggestions. This seems to help:

 	?distribution
 	[stuff deleted]
 	For the normal distribution see dnorm.

and
 	?dnorm
 	[stuff deleted]
 	dnorm gives the density, pnorm gives the distribution function,
 	qnorm gives the quantile function, and rnorm generates random
 	deviates.

so match up 'density' and 'distribution function' in the ?dnorm page and 
the wiki page and you should be able to put it together.

(FWIW, ?density and ??density are not so helpful.)

BTW

 	 \frac{\frac{1}{\sigma}\phi(\frac{x - \mu}{\sigma})}

(copy and pasted from the wiki page) can be rendered as

 	dnorm(x , mu, sigma ) in R.

HTH,

Chuck
Charles C. Berry                            Dept of Family/Preventive Medicine
cberry at tajo.ucsd.edu			    UC San Diego
http://famprevmed.ucsd.edu/faculty/cberry/  La Jolla, San Diego 92093-0901
#
On Jan 19, 2011, at 6:03 PM, JClark wrote:

            
Capital phi is the cdf of the Normal distribution and lowercase phi is  
the density (the cdf's derivative). You can see fairly standard usage  
in the Definition and Cumulative distribution function sections of the  
Wikipedia page.
You will need these:

?pnrom
?dnorm
You are being unreasonably vague here. You are apparently looking at  
<something>. We are looking at a plaintext message.  Perhaps you are  
(mis)calling a lowercase phi as italic?

Maybe you should read the Posting Guide and the items it links to  
regarding how to ask a good question??

  
    
#
Jeremy,

I don't seem to remember signing up to have R-help be my personal e-mail :-)

It is common to use phi to represent the standard normal distribution (with mean 0, and variance 1), the "script/small/lower case" version is for the distribution (height of the bell curve) and the "block/capitol/upper case"  is for the cumulative distribution.

So for arbitrary mean and variance you get 1/sigma * phi( (x-mu)/sigma ).

The general idea for any truncated distribution is that it will have the same shape as the non-truncated version, it just needs to be scaled so that the area is 1, the proper scaling is just the area under the original.  So the formulas you see on that page start with the regular normal (phi) divided by the area under the curve between A and B which is just the difference in the cumulative distribution at those 2 points.

In R dnorm will correspond to phi and pnorm to PHI.  You could use the exact formulas on that page, but it would be simpler to use the arguments to dnorm and pnorm.