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


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

st: Create new distribution under certain criteria


From   Nikolaos Kanellopoulos <nkkanel@yahoo.gr>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   st: Create new distribution under certain criteria
Date   Sun, 24 Jun 2012 20:09:09 +0100 (BST)

Dear all,
This is
more of a statistical rather than a Stata specific question.
I have two
series. One is constantly positive (y) and the other can be negative but with a
positive mean (x). I want to create a third series (newx) which will be a
transformation of x but it must always be positive and its sum must be the same
as this of x. To do this I assume that the distribution of the y and x is the
same and thus multiply the sum of x with the shares of y. An example:
*------------------------------------------------------

sysuse abdata , clear
keep wL1 nL1
drop if missing(wL1,
nL1)
ren wL1 y
ren nL1 x
egen t_y=total(y)
gen y_share=y/t_y
egen t_x=total(x)
gen newx = y_share*t_x
egen
t_newx=total(newx)
 
su t_x t_newx
*------------------------------------------------------

In addition,
I want to take into account whether x is positive (more important) or negative
(less important) and my question is how I can do this.
Thank you
in advance.
Nikos

*
*   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/


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