Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: converting densities into values


From   "Wolney Conde" <[email protected]>
To   "statalist" <[email protected]>
Subject   st: converting densities into values
Date   Tue, 4 May 2004 16:29:23 -0300 (Hora padr�o leste da Am. Sul)

Dear listers,
I have a probably very simple question:
I want to demonstrate a book example with two variables:
the n range is 0 to 3000;
the first variable has mean 1200 and sd 180;
the second variable has mean 1600 and sd 450.

I used the below commands to generate the densities of variables. The
question is: how can I translate the densities into values? Or, better, can
I generate the values variables directly?
Any help?
Many thanks in advance,
Wolney. 


range x 0 3000 3000
la var x "nutrient distribution"
local var1 = 180^2 /* variance of requirement m=1200;sd=180 */
local m1 = 1200
local var2 = 450^2 /* variance of usual intake m=1600;sd=450 */
local m2 = 1600
gen r = (1/sqrt(2*_pi*`var1'))*exp(-1*(x-`m1')^2/(2*`var1'))
la var r "DRA m=1200;dp=180"
gen u = (1/sqrt(2*_pi*`var2'))*exp(-1*(x-`m2')^2/(2*`var2'))
la var u "usual intake m=1600;dp=450"
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index