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]

From |
John Antonakis <John.Antonakis@unil.ch> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: Input data from keyboard combined with Monte Carlo |

Date |
Thu, 20 Jun 2013 12:22:03 +0200 |

Thanks for this Joseph. Very useful. Best, J. __________________________________________ John Antonakis Professor of Organizational Behavior Director, Ph.D. Program in Management Faculty of Business and Economics University of Lausanne Internef #618 CH-1015 Lausanne-Dorigny Switzerland Tel ++41 (0)21 692-3438 Fax ++41 (0)21 692-3305 http://www.hec.unil.ch/people/jantonakis Associate Editor The Leadership Quarterly __________________________________________ On 20.06.2013 04:24, Joseph Coveney wrote: > John Antonakis wrote: > > Thanks for the idea. Thread closed--hope this solutions helps others > (actually I did not look at your paper yet, Nick, but I will). > > So, I basically used mkmat to save the data to a matrix, then I > retrieved the data with svmat and it works, like this: >

>

> steps if you're saving the file, anyway--you can just have your simulator > program -use- the file, itself. (And if you're not concerned about

> name and then omit the file-name option from the simulator program.) >

> each time, but rather from a memory cache, just like the Stata matrix.

> faster, as seen consistently in repeated runs' timing results. > > Joseph Coveney > > . do "F:\comparem.do" > > . *! comparem.do > . > . version 12.1 > > . > . clear * > > . set more off > > . set seed `=date("2013-06-20", "YMD")' > > . > . quietly set obs 111 > > . generate double y = runiform() > > . tempfile tmpfil0 > > . quietly save `tmpfil0' > > . > . tempname Y > > . mkmat y, matrix(`Y') > > . > . program define regressem > 1. version 12.1 > 2. syntax > 3. > . foreach var of newlist x1-x17 { > 4. generate double `var' = rnormal() > 5. } > 6. > . regress y x* > 7. end > > . > . program define usem > 1. version 12.1 > 2. syntax , file(string) > 3. > . drop _all > 4. use `file' > 5. > . regressem > 6. end > > . > . program define svmatem > 1. version 12.1 > 2. syntax , MATrix(name) > 3. > . drop _all > 4. svmat `matrix', names(y) > 5. > . regressem > 6. end > > . > . forvalues i = 1/3 { > 2. timer clear > 3. > . timer on 1 > 4. quietly simulate e(r2) e(F), reps(5000) seed(123): usem , > file(`tmpfil0') > 5. timer off 1 > 6. > . timer on 2

> 8. timer off 2 > 9. > . timer list > 10. } > 1: 24.83 / 1 = 24.8300 > 2: 25.03 / 1 = 25.0320 > 1: 24.72 / 1 = 24.7200 > 2: 25.00 / 1 = 25.0010 > 1: 24.72 / 1 = 24.7200 > 2: 25.00 / 1 = 25.0020 > > . > . exit > > end of do-file > > * > * 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/ * * 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/

**References**:**st: test for appropriateness of logit models***From:*Andreas Chouliaras <adhoul@gmail.com>

**Re: st: test for appropriateness of logit models***From:*Maarten Buis <maartenlbuis@gmail.com>

**Re: st: test for appropriateness of logit models***From:*Richard Williams <richardwilliams.ndu@gmail.com>

**Re: st: FW: Mediation with endogenous mediator and endogenous independent variables***From:*"A.M. Aranda Gutierrez" <A.M.Aranda@uvt.nl>

**Re: st: FW: Mediation with endogenous mediator and endogenous independent variables***From:*John Antonakis <John.Antonakis@unil.ch>

**st: Input data from keyboard combined with Monte Carlo***From:*John Antonakis <John.Antonakis@unil.ch>

**Re: st: Input data from keyboard combined with Monte Carlo***From:*Nick Cox <njcoxstata@gmail.com>

**Re: st: Input data from keyboard combined with Monte Carlo***From:*John Antonakis <John.Antonakis@unil.ch>

**Re: st: Input data from keyboard combined with Monte Carlo***From:*Nick Cox <njcoxstata@gmail.com>

**Re: st: Input data from keyboard combined with Monte Carlo***From:*Austin Nichols <austinnichols@gmail.com>

**Re: st: Input data from keyboard combined with Monte Carlo***From:*Nick Cox <njcoxstata@gmail.com>

**Re: st: Input data from keyboard combined with Monte Carlo***From:*John Antonakis <John.Antonakis@unil.ch>

**Re: st: Input data from keyboard combined with Monte Carlo***From:*"Joseph Coveney" <stajc2@gmail.com>

- Prev by Date:
**st: Missing observations** - Next by Date:
**Re: st: Missing observations** - Previous by thread:
**Re: st: Input data from keyboard combined with Monte Carlo** - Next by thread:
**st: Re: Input data from keyboard combined with Monte Carlo** - Index(es):