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

From |
jpitblado@stata.com (Jeff Pitblado, StataCorp LP) |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: mysureg with constraints |

Date |
Tue, 20 Sep 2005 14:17:38 -0500 |

Federica Maiorano <federica_maiorano@yahoo.it> seems to be having some trouble with constraints: > I am estimating a translog cost function + 1 input > share cost equation using mysureg. > > When I attempt to estimate a constrained model, then I > get an error message from mysureg. As an example, I > copy below what happens with one constraint only. > > Please note that there do not seem to be any problems > when the same commands are performed using sureg. > > I am obviously doing something wrong, but I cannot > work out what it is. Any suggestions? > > ----------------------------------------------- > constraint define 1 [sl]_cons = [lnvc]lnpl > > mysureg (lnvc lnk lnpl lnpm lnaccess lncalls time k2 > pl2 pm2 acc2 call2 t2 kpl kpm kacc kcalls kt plpm > placc plcalls plt pmacc pmcalls pmt acccalls acct > callt) (sl lnpl lnpm lnaccess lncalls lnk time), > constraint(1) cluster(idcomp) > > Fitting constant-only model: > Constraints invalid: > [lnpl] not found > > ----------------------------------------------- Aside from being an example estimation command in the Stata Press book "Maximum Likelihood Estimation with Stata, 2nd Edition", there does not seem to be a publicly available user-written estimation command called -mysureg-. So I'll assume that Federica is using -mysureg- introduced on pg. 238 (the ado-file for -mysureg- is given on pg. 286). Federica discovered a bug in -ml model- that was fixed for Stata 9 in the ado-file update on 15sep2005. If Federica is using Stata 9, she should use -update- to get Stata up-to-date, and the problem will go away. For Stata 8, Federica can change -mysureg- to parse the -constraints()- option as a "passthru", and add `constraints' back to the `mlopts' macro after -mysureg- fits the constant-only model. Here are the lines that will be affected (look for !!): ***** BEGIN: mysureg.ado program mysureg, sortpreserve ... syntax anything(id="equations" equalok) /// [if] [in] [fweight pweight] [, /// noLOg /// -ml model- options Robust CLuster(varname) /// noLRTEST svy noSVYadjust /// Level(integer `c(level)') /// -Replay- options corr /// CONSTraints(passthru) /// !! NEW LINE * /// -mlopts/svyopts- options ] ... mlopts mlopts, `options' local cns `constraints' // !! LINE MODIFIED ... `qui' di as txt _n "Fitting constant-only model:" ml model d2 mysuregc_d2 `eqns0' /// ... nocnsnotes missing maximize local initopt continue search(off) if "`lrtest'" == "" { local lf0 lf0(`k_eq' `e(ll)') } local mlopts `"`mlopts' `constraints'"' // !! NEW LINE ... end ... ***** END: mysureg.ado So, you ask: "What's going on? I want details." As originally developed, -mysureg- passes constraints to each call of -ml model-, even when fitting the constant-only model. Under version 8.1 (and 8.2 for Stata 8), -ml model- does not use -makecns- to tolerantly construct the constraint matrix; it stops with an error message instead of just noting when there was a problem with a constraint then move on. Thus -ml model- exits with an error if any of the constraints involve predictors that are not present in the constant-only model fit. As mentioned above, this bug was fixed in Stata 9. --Jeff jpitblado@stata.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/

- Prev by Date:
**RE: st: Years to dates** - Next by Date:
**st: [Fwd: Comparing dummy categories – logistic]** - Previous by thread:
**st: mysureg with constraints** - Next by thread:
**st: ivreg question** - Index(es):

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