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, statalist.org is already up and running.

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

 From Jeph Herrin To statalist@hsphsun2.harvard.edu Subject Re: st: how to find the integral for a portion of a normal distribution. Date Tue, 04 May 2010 14:49:59 -0400

So you want to integrate xf(x), so to speak; let's try to
integrate using centiliters (cls):

drawnorm x , means(2.02) sds(1.75) n(100000) clear
gen cl=round(x,0.01)              // integrate over centiliters
bys cl: gen cls=_N*cl/100000      // expected cls in this cl

egen liters=sum(cls*(x<=1)/100)   // total liters over x < = 1 liter
// the 100 is cl->l factor
replace liters=liters*10          // 10 cows!
sum liters

hth,
Jeph

Buzz Burhans wrote:
Let me try again, I am sorry I am so dense here.

Suppose I have an intervention applied to cows with a demonstrated mean milk
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 proportion
of responses at or above the one liter response.  This is what you are doing
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 1
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 the
total liters, not the fraction of the total population either above or below
the cutpoint.

This is not the same as the proportion of responders in either category; it
is the total accumulated response above and below my cut point.

I am off to a meeting, so thanks for any further responses - I won't be able
to see them until this evening.

Buzz

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-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Jeph Herrin
Sent: Tuesday, May 04, 2010 10:15 AM
To: statalist@hsphsun2.harvard.edu
Subject: Re: st: how to find the integral for a portion of a normal
distribution.

The total area under any normal curve is always 1, so you just need
to count obs:

drawnorm x , means(2.02) sds(1.75) n(100000) clear
gen byte lessthan1=x<=1
sum lessthan1

The mean value of -lessthan1- is the area under the curve
to the left of 1.

hth,
Jeph

Buzz Burhans wrote:
My weak math skills are showing up here -
For demonstration purposes, I have generated a set of 100,000 observations
with a normal distribution, mean 2.02, SD 1.74 and visualized this data
and
the portion of observations above 1  with a histogram

drawnorm x , means(2.02) sds(1.75) n(100,000) clear
hist, xline(1)

I also computed the proportion of the observations <=1 from the Z score.

What I don't know how to do in Stata is find the integral for the
proportions of the distribution above and below 1.
How can I determine those two integrals in Stata?

Thanks

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

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/