[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

From |
Nicholas Winter <nw53@cornell.edu> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: New user...trying to use ADO file with SVR |

Date |
Tue, 26 Aug 2003 12:10:21 -0400 |

THat is rather odd. Could you email me privately (nw53@cornell.edu) your dataset and all syntax you've been running?

Nick Winter

At 08:03 AM 8/22/2003 -0700, you wrote:

--------------------------------------------------------Thanks for the help! I have tried running the model using both methods suggested in the email below by using the 2 different ways to call the model ~ svrest "ml_try2", mat(e(b)) ~ svrest "ml model lf mlcot (price=mpg weight)/sigma, robust search(quietly) max", mat(e(b)) And I got both methods to run & produce results. Now here's my next dilemma...should the standard errors be the same, regardless of how I call the model? The parameter estimates from these 2 methods are the same. However, I got very different standard errors when using these 2 different ways of calling the model. (8.21e-07 vs. .0484) I also tried using -nl- with SVR, since the model is non-linear in the parameters. (I had been using -ml- per a posting I had found in the FAQs on how to estimate a nonlinear model using -ml-) To try & see if using SVR would work with the -nl- model, I used the 2nd method to call the nonlinear model ~svrest "nl cot logcot", mat(e(b)) and I got results that were the same (both in the parameters & the standard errors) as when I called the -ml- model using the 2nd method [i.e. svrest "ml model lf mlcot (price=mpg weight)/sigma, robust search(quietly) max", mat(e(b))] (I hope my way of explaining things is making sense!) So my questions are: why do the ways of calling the -ml- model produce such different results? and which one is the better way to get the results? Thanks. -Kat --- Nicholas Winter <nw53@cornell.edu> wrote: > You need to set up two programs: -svrest- needs you > to call a program to > estimate your model. In turn, -ml- needs you to > call a program to > calculate the likelihood. > > So here's one approach (I've switched the model to > OLS for this example; > you should get your interactive ML program to work > without worrying about > the jackknife; then insert it in mlcot.ado): > > *------------- begin ml_try2.ado ----------------- > program define ml_try2 > version 8.1 > ml model lf mlcot (price = mpg weight) /sigma > ml search > ml maximize > end > *------------- end ml_try2.ado ------------------- > > *------------- begin mlcot.ado ----------------- > program define mlcot > version 8.1 > args lnf xb sigma > qui replace `lnf' > =-ln(sqrt(2*_pi*`sigma'^2))-1/(2*`sigma'^2)*($ML_y1-`xb')^2 > end > *------------- end mlcot.ado ------------------- > > THEN, you can submit your command to stata: > > . svrest "ml_try2" , mat(e(b)) > > > However, there is a slightly easier way. Because > the -ml- command lets you > specify your model and maximize it in one command > (ie, in non-interactive > mode), you could do this: > > (1) define mlcot.ado as above > (2) submit this single command: > > . svrest "ml model lf mlcot (price = mpg > weight) /sigma , robust > search(quietly) max" , mat(e(b)) > > > See -help ml- if this last doesn't make sense. > > Cheers, > Nick Winter > > > >I want to use an ado file to work with -svrest-, > >however I'm running into problems when it gets to > the > >ado file trying to run. > > > >I've been submitting the -svrset- part first. I > then > >try to submit the line > >svrest "ml_try2", mat(e(b)) > >and here is where I run into problems. > > > >Below you will find the code in my ado file. > >--------- begin ml_try2.ado ---------------- > > program define mlcot > > version 8.1 > > args lnf B0 B1 B2 sigma > > tempvar res > > quietly gen double `res' = logcot - > >(`B0'-`B1'*(exp(-`B2'*smd720))) > > quietly replace `lnf'=-0.5*ln(2*_pi) > -ln(`sigma') > >-0.5*`res'^2/`sigma'^2 > > end > > ml model lf mlcot (B0:) (B1:) (B2:) (sigma:), > robust > > ml search > > ml maximize > >--------- end ml_try2.ado ----------------- > > > >I get the following error: > > unrecognized command: mlcot > > program mlcot not found > > error when command executed on original dataset > > invalid syntax > > > > -------------------------------------------------------- > Nicholas Winter 308 White > Hall > Assistant Professor > t:607.255.8819 > Department of Government > f:607.255.4530 > Cornell University > nw53@cornell.edu > Ithaca, NY 14853-7901 > falcon.arts.cornell.edu/nw53 > > * > * For searches and help try: > * > http://www.stata.com/support/faqs/res/findit.html > * http://www.stata.com/support/statalist/faq > * http://www.ats.ucla.edu/stat/stata/ __________________________________ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com * * For searches and help try: * http://www.stata.com/support/faqs/res/findit.html * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

Nicholas Winter 308 White Hall

Assistant Professor t:607.255.8819

Department of Government f:607.255.4530

Cornell University nw53@cornell.edu

Ithaca, NY 14853-7901 falcon.arts.cornell.edu/nw53

*

* For searches and help try:

* http://www.stata.com/support/faqs/res/findit.html

* http://www.stata.com/support/statalist/faq

* http://www.ats.ucla.edu/stat/stata/

**References**:**Re: st: New user...trying to use ADO file with SVR***From:*kat jackson <kejstats@yahoo.com>

- Prev by Date:
**st: Inability to start up Stata under Windows XP** - Next by Date:
**st: newbie- syntax question** - Previous by thread:
**Re: st: New user...trying to use ADO file with SVR** - Next by thread:
**st: Stata's "Simulate" command and Stata v.8.1** - Index(es):

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