Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: st: how to find the integral for a portion of a normal distribution.

From   "Buzz Burhans" <>
To   <>
Subject   RE: st: how to find the integral for a portion of a normal distribution.
Date   Thu, 6 May 2010 08:58:34 -0600

Thanks to all who responded to my question.  Your help is most appreciated.

Many of the responses essentially involved using drawnorm to simulate the
quantity desired, which is useful, and it was interesting to see a couple of
minor variations on doing this.  

My particular interest was in calculating (as opposed to simulating) this
quantity based on knowledge of the information I had at hand about the mean,
standard deviation, and expected normality of the response.  

In regards to this, Brian Poi's response was what I was specifically looking
for. Because he laid it out so nicely in steps, following through his
response not only gave me the answer, but allowed me to think through what
it represented. I appreciate it.

I am most appreciative of all the responses, thanks again to all who took
the time to respond and put up with my initially inarticulate description of
my question.


Buzz Burhans, Ph.D. 

Dairy-Tech Group
So. Albany, VT / Twin Falls ID

Phone: 802-755-6842
Cell: 208-320-0829
Fax VT: 802-755-6842
Fax ID: 208-735-1289

-----Original Message-----
[] On Behalf Of Brian P. Poi
Sent: Tuesday, May 04, 2010 12:44 PM
Subject: RE: st: how to find the integral for a portion of a normal

On Tue, 4 May 2010, Buzz Burhans wrote:

> Suppose I have an intervention applied to cows with a demonstrated mean
> yield response of +2.05 liters, sd 1.74.
> Suppose I am interested a 1 liter cut point.  I know how to find the
> proportion of responses at or below the 1 liter response; and the
> of responses at or above the one liter response.  This is what you are
> here, or it can be done with a z score.
> My question is, if the response is normally distributed, given n cows, how
> many total liters were included or accumulated in the only responses below
> liter, and how many total liters were accumulated in only the responses at
> or above 1 liter.  (Negative responses are possible). My interest is in
> total liters, not the fraction of the total population either above or
> the cutpoint.

Assuming I understand the question correctly, I think this does what you 

For a random variable distributed N(mu, sigma),

    E[X | X < 1] = mu + sigma*lambda(alpha)


    alpha = (1 - mu) / sigma
    lambda(alpha) = -phi(alpha) / Phi(alpha)

Given a sample of size n, the number of observations less than 1 is

    numltone = n*Phi(alpha)

so the total amount of milk given that X < 1 is

    milk = numltone*E[X | X < 1]

In Stata,

. clear all
. set mem 200m
. set seed 1
. drawnorm x, means(2.05) sds(1.74) n(10000000) clear
(obs 10000000)
. summ x if x < 1, mean
. di r(sum)

. scalar alpha = (1 - 2.05) / 1.74
. scalar lambda = -1*normalden(alpha) / normal(alpha)
. scalar condmean = 2.05 + 1.74*lambda
. scalar numltone = 10000000*normal(alpha)
. scalar condtotal = condmean*numltone
. di condtotal


    E[X | X > 1] = mu + sigma*lambda'(alpha)


    lambda' = phi(alpha) / (1 - Phi(alpha))

In Stata,

. scalar lambda2 = normalden(alpha) / (1 - normal(alpha))
. scalar condmean2 = 2.05 + 1.74*lambda2
. scalar condtotal2 = condmean2*(10000000 - numltone)
. di condtotal2

. sum x if x > 1, mean
. di r(sum)

   -- Brian Poi
*   For searches and help try:

*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index