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

From |
Quang Nguyen <quangn@gmail.com> |

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

Subject |
st: nl in which the nonlinear functional form is conditional on x |

Date |
Tue, 14 Apr 2009 09:19:53 -1000 |

Dear All: I have the model as follows: y = F(x; lamda) for x>0 and y= G(x: lamda) for x<0. Both F and G are nonlinear. Do you think we can use _nl_ to estimate this model? Is there a way we can write like this: nl {( y = F(x; lamda) if x>0 ) (y= G(x: lamda) if x<0)} Many thanks! On Tue, Apr 14, 2009 at 6:54 AM, Martin Weiss <martin.weiss1@gmx.de> wrote: > <> > > Rudy may also want to take a cue from the MUS book datasets at > http://www.stata-press.com/data/mus.html > File mus04p1sim.do shows how the pros use -simulate- with the -seed- set... > > > HTH > Martin > _______________________ > ----- Original Message ----- From: "Eva Poen" <eva.poen@gmail.com> > To: <statalist@hsphsun2.harvard.edu> > Sent: Tuesday, April 14, 2009 6:10 PM > Subject: Re: st: question about monte carlo study > > >> <> >> >> I don't think this is a good idea. Setting the random seed inside the >> simulation program leads to the same random numbers being drawn at >> every replication. >> >> Instead, use >> >> program olssim >> ... >> end >> >> set seed 123 >> simulate ... >> >> >> Eva >> >> >> 2009/4/14 Joao Ricardo F. Lima <jricardofl@gmail.com>: >>> >>> Rudy, >>> >>> another option: >>> >>> capture program drop olssim >>> program olssim >>> version 10.0 >>> drop _all >>> set obs 100 >>> set seed 123 >>> generate e = invnorm(uniform())*2 >>> generate x = uniform()*10 >>> generate y = 1 + 0.5 * x + e >>> regress y x >>> end >>> simulate, reps(1000) : olssim >>> >>> HTH, >>> >>> Joao Lima >>> >>> 2009/4/14 Rudy Fichtenbaum <rudy.fichtenbaum@wright.edu>: >>>> >>>> I am running a monte carlo simulation using the following program: >>>> >>>> capture program drop olssim >>>> program olssim, rclass >>>> version 10.0 >>>> drop _all >>>> set obs 100 >>>> generate e = invnorm(uniform())*2 >>>> generate x = uniform()*10 >>>> generate y = 1 + 0.5 * x + e >>>> regress y x >>>> return scalar b0 = _coef[_cons] >>>> return scalar b1 = _coef[x] >>>> end >>>> >>>> simulate "olssim" b0 = r(b0) b1 = r(b1), reps(1000) >>>> >>>> sum b0 b1, detail >>>> >>>> The problem I am having is that each time I run the program I get a >>>> slightly >>>> different result. I know this is because I have not set the seed for the >>>> random number generator but I can't figure out how to set the seed in >>>> this >>>> program. >>>> >>>> Rudy >>>> >>>> -- >>>> Rudy Fichtenbaum >>>> Professor of Economics >>>> Chief Negotiator AAUP-WSU >>>> Wright State University >>>> Dayton, OH 45435-0001 >>>> 937-775-3085 >>>> >>>> * >>>> * 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/ >>>> >>> >>> >>> >>> -- >>> ---------------------------------------- >>> Joao Ricardo Lima, D.Sc. >>> Professor >>> UFPB-CCA-DCFS >>> Fone: +5538387264913 >>> Skype: joao_ricardo_lima >>> ---------------------------------------- >>> >>> * >>> * 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/ > -- "My father gave me the greatest gift anyone could give another person, he believed in me." - Jim Valvano * * 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**:**Re: st: nl in which the nonlinear functional form is conditional on x***From:*Eva Poen <eva.poen@gmail.com>

- Prev by Date:
**Re: st: controlling the table header with estout** - Next by Date:
**Re: st: transparent background with graph for powerpoint** - Previous by thread:
**st: nl in which the nonlinear functional form is conditional on x** - Next by thread:
**Re: st: nl in which the nonlinear functional form is conditional on x** - Index(es):

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