Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: how does one automatically calculate the age in years by subtracting the system date from the date of birth?
From
Gwinyai Masukume <[email protected]>
To
[email protected]
Subject
Re: st: how does one automatically calculate the age in years by subtracting the system date from the date of birth?
Date
Mon, 11 Mar 2013 06:10:14 +0200
hi. lets say I wanted to have more people born during a certain
specific time period rather than having people born at generally
uniform rates during the entire time period (drawing from a uniform
distribution):
*version 12
scalar start = mdy(1,1,1964)
scalar end = mdy(12,31,1998)
gen date_of_birth = int(start+(end-start)*runiform())
say I wanted the majority of my synthetic cohort (1964-1998) to be
born between 1983 and 1993 with peak births in 1986. essentially a
negatively skewed distribution I suspect.
a beta distribution appears to be able to give the desired pattern of
births I’m after?
how would one implement such a scenario of having more births during a
specific time period?
thanks for your consideration
G
On 3/11/13, Gwinyai Masukume <[email protected]> wrote:
> Rebecca
>
> Thanks again. Apologies, I didn’t mean to say I obtained the exact
> same results – I meant to say that one still obtains pseudo-random
> dates by omitting that particular code (without setting the seed).
>
> (My understanding is that Stata uses a pseudo-random number generator
> which can pass for a true random number generator – but I digress).
>
> Thank you Rebecca for your help.
> Kind regards,
> G.
>
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/