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: drawnorm for discrete variables
From
Tyler Frazier <[email protected]>
To
[email protected]
Subject
Re: st: drawnorm for discrete variables
Date
Fri, 30 Apr 2010 16:44:34 +0200
thank you for all your responses and suggestions, now I need to look
into these possibilities
best regards,
Ty
On Fri, Apr 30, 2010 at 4:30 PM, Maarten buis <[email protected]> wrote:
> --- On Fri, 30/4/10, Tyler Frazier wrote:
>> The data will be used in an urban simulation which incorporates a
>> number of location choice models, regression, and other simple models.
>> For now I would like to establish a method for synthetically
>> generating the data, for use in the larger spatial, framework. At
>> this point, I am seeking a plausible solution for running the urban
>> simulation in order to observe its behavior.
>
> I would build such a simulation sequentially, so start by assigning
> "people" charactericstics that are (largely) exogenous like tribe
> and sex, and than assign them other characteristics that depend on
> these, than assign further characteristics based on the prevous ones,
> etc. For example:
>
> *---------------------- begin example ---------------------
> clear
> set obs 1000
> gen u = runiform()
>
> // tribe 1: 15%, tribe 2: 25%, tribe 3: 60%
> gen byte tribe = cond(u < .15, 1, ///
> cond(u < .4, 2, 3))
> drop u
>
> // 50% women regardless of tribe
> gen byte female = runiform() < .5
>
> // we might have run a regression finding that
> // log(inc) = .5 + .4*tribe2 -.2*tribe3 -1.5*female * e
> // the standard error of e (which you can find in e(rmse))
> // is .5
> tab tribe, gen(tr)
> gen log_inc = .5 + .4*tr2 -.2*tr3 - 1.5*female + .5*rnormal()
>
> // we might know that the probability of owning a motorcycle
> // is 0 for women, and that we ran a logistic regression for
> // the men with the result: log(odds) = -.5 + 1.3*log_inc
>
> gen byte own_motor = cond(female == 1, 0, ///
> runiform() > invlogit(-.5 + 1.3*log_inc))
> *--------------------- end example --------------------------
> (For more on examples I sent to the Statalist see:
> http://www.maartenbuis.nl/example_faq )
>
> Hope this helps,
> Maarten
>
> --------------------------
> Maarten L. Buis
> Institut fuer Soziologie
> Universitaet Tuebingen
> Wilhelmstrasse 36
> 72074 Tuebingen
> Germany
>
> http://www.maartenbuis.nl
> --------------------------
>
>
>
>
> *
> * 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/