[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: RE: -generate- and run time contingencies
At 11:07 AM 1/30/2006, Steichen, Thomas J. wrote:
. gen x = uniform()
That was my first thought too - but it doesn't work. The problem is
that the replacement value may also be less than 0.8. So, you need
to be able to repeat the process until all x values are greater than .8.
. replace x = uniform() if x < 0.8
accomplishes what you want.
The above says replace x only if the currrent (run time) value of x
is less than 0.8.
I believe Mike's second approach would work, but only for data sets
that are smaller than 11,000 cases (Stata SE's limit for a matrix -
other versions of Stata have even smaller limits.)
Mike's solution of
gen x = 0.8 + 0.2*uniform()
seems to be the best for this example, but perhaps it won't always be
so easy. (But then again, maybe it will?)
It is an interesting question - could Mata maybe handle it with large
Richard Williams, Notre Dame Dept of Sociology
OFFICE: (574)631-6668, (574)631-6463
WWW (personal): http://www.nd.edu/~rwilliam
WWW (department): http://www.nd.edu/~soc
* For searches and help try: