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

From |
"Martin Weiss" <martin.weiss1@gmx.de> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
st: AW: RE: AW: Generating random numbers |

Date |
Wed, 25 Nov 2009 17:20:50 +0100 |

<> Just out of curiosity, does your call to -set seed- use ************* di `=clock("`=subinstr("`c(current_time)'",":","",.)'", "hms")' ************* then? HTH Martin -----Ursprüngliche Nachricht----- Von: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Barth Riley Gesendet: Mittwoch, 25. November 2009 17:09 An: statalist@hsphsun2.harvard.edu Betreff: st: RE: AW: Generating random numbers Hi Martin I took your advice and placed my set seed command at the top of my do file (which contains several nested loops). And I used the c(current_time) function, stripping the ":" out of the string and converting the resulting string into a number for my seed value. This did the trick! Thanks Barth -----Original Message----- From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Martin Weiss Sent: Wednesday, November 25, 2009 9:07 AM To: statalist@hsphsun2.harvard.edu Subject: st: AW: Generating random numbers <> Your "seed generating process" for "sd" also uses -uniform()-, i.e. your first line is itself dependent on a -seed-. Some Statalisters also use the current date, such as in -set seed `=date("`c(current_date)'", "DMY")'- to -set seed-... HTH Martin -----Ursprüngliche Nachricht----- Von: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Barth Riley Gesendet: Mittwoch, 25. November 2009 15:35 An: statalist@hsphsun2.harvard.edu Betreff: st: Generating random numbers Hello I have written a program in Stata to create several datasets containing simulated item response values, which are based on randomly generated item response theory parameters. I am finding that the randomly generated parameters for each dataset are following a predictable pattern (one set of parameter values for odd-numbered datasets; another set of values for even-numbered datasets). I have been using the set seed command to try to avoid this repetitive pattern, for example: local sd = `j' * int(uniform() * 1000) set seed `sd' ... local b = invnormal(uniform()) Where `j' is a forvalues counter variable. Is there a better way to do this? Thanks Barth * * 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/ * * 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/

**Follow-Ups**:**st: RE: AW: RE: AW: Generating random numbers***From:*"Barth Riley" <BarthRiley@comcast.net>

**References**:**st: Generating random numbers***From:*"Barth Riley" <BarthRiley@comcast.net>

**st: AW: Generating random numbers***From:*"Martin Weiss" <martin.weiss1@gmx.de>

**st: RE: AW: Generating random numbers***From:*"Barth Riley" <BarthRiley@comcast.net>

- Prev by Date:
**Re: st: how to estimate the impact of founding conditions in a panel of firms** - Next by Date:
**st: display all categories on pie chart for categorical variables (with some zero values)** - Previous by thread:
**st: RE: AW: Generating random numbers** - Next by thread:
**st: RE: AW: RE: AW: Generating random numbers** - Index(es):

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