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 |
Maximiliano Méndez Parra <mm273@sussex.ac.uk> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
st: getting results in simulate with loop |

Date |
Tue, 2 Mar 2010 12:36:38 +0000 |

Here is my problem. I am performing a Monte Carlo experiment. Inside each replication (5000) set by the simulate command, there exists a loop that performs 100 regressions using different model definitions. The program was designed to choose the minimum t-stat/F-values of each of the 100 regressions. Therefore, at the end, I will have a distribution with 5000 minimum values of t-stat/F-values. I am interested in knowing for each of the 5000 replication in which of the 100 regressions the minimum t-stat was found. I am evaluating two alternatives 1. Get at the end of the simulation for each minimum t and associated value for the regression in each of the 5000 replications (Do not know how). This will be ideal but I have tried to capture that using scalars trying to identify that moment. The problem is that if statements do not work with scalars. 2. Save the intermediate results of each of the sets of 100 regressions for later analysis. I am using the postfile command to get the minimum t-stats/F-stats. The problem is that after running the 5000 simulations, I am getting just the intermediate results of the last replication. It is replacing the values obtained in the previous. So I only get the 100 t-stats of the last replication. There is no possibility of using append in postfiles. Can anybody help me? Maybe you have an alternative way of doing what I want. Thanks in advance. My program looks like this program seascrit1, rclass version 10.0 drop _all tempname sim postfile `sim' timeb1 results,replace More commands... forvalues i=1/100{ More commands... reg XXX YYY ZZZ TTT.... test YYY TTT scalar Fa`i'=r(F) scalar ba`i' = (_coef[YYY])/_se[YYY] scalar bb`i' = (_coef[l.z2t])/_se[l.z2t] scalar timeb`i'=_n post `sim' (tb) (timeb`i') (ba`i') (shift) } *end of loop postclose `sim' return scalar b1 = min(ba1-ba100) scalar drop _all end simulate b1=r(b1), reps(5000) : seascrit1 -- Maximiliano Méndez Parra maximilianomp@gmail.com * * 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: AW: getting results in simulate with loop***From:*"Martin Weiss" <martin.weiss1@gmx.de>

- Prev by Date:
**st: AW: AW: Graph** - Next by Date:
**st: RE: Question on survey data analysis** - Previous by thread:
**[no subject]** - Next by thread:
**st: AW: getting results in simulate with loop** - Index(es):