# Re: constraints in xtgls and xtpcse [was: st: QUESTION]

 From Richard Williams To statalist@hsphsun2.harvard.edu, statalist@hsphsun2.harvard.edu Subject Re: constraints in xtgls and xtpcse [was: st: QUESTION] Date Tue, 29 Apr 2008 23:09:54 -0500

```At 05:33 PM 4/29/2008, Samira Bakhshi wrote:
```
```I am so thankful for your reply.
Actually, I have a system of panel data equations with 45 constraints.
So imposing these constraints in way you have described would be
difficult. Is not there any other way that Stata accpets the option ,
const () after xtgls?

Thanks,
Samira
```
I've never tried it with xtgls, but you might check out Jeroen Weesie's -linest- command (which he maintains on his own site; use -findit-). From the help file:

linest performs linear constrained estimation based on the results of an
unconstrained estimation command (e.g., regress, qreg, logit, stcox,
heckman, mvreg, ...). linest displays the table with the two-stage
constrained estimates and their confidence intervals, and a Wald test for
the hypothesis that the parameters satisfy the constraints...
The two-stage constrained estimator is asymptotically equivalent to the
one-stage constrained estimator (Gourieroux and Montfort 1995: Ch 10). This
result is based, however, on additional linearization. Thus, if a one-stage
constrained estimator is available (e.g., cnsreg, mlogit, reg3), I expect
this estimator and the associated inference procedures to be better behaved
in small samples.

In other words, it is nice when an estimation command directly supports constraints, but when it doesn't linest is often a decent alternative. A simple example:

. sysuse auto
(1978 Automobile Data)

. constraint 1 weight = length

. logit foreign weight length, nolog

Logistic regression Number of obs = 74
LR chi2(2) = 31.99
Prob > chi2 = 0.0000
Log likelihood = -29.040272 Pseudo R2 = 0.3551

------------------------------------------------------------------------------
foreign | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
weight | -.0028419 .0016763 -1.70 0.090 -.0061273 .0004436
length | .0089197 .0542959 0.16 0.870 -.0974983 .1153376
_cons | 5.366227 5.77534 0.93 0.353 -5.953232 16.68568
------------------------------------------------------------------------------

. linest, c(1)

Two-step constrained logit
Dim unrestricted model = 3
Dim restricted model = 2
# restrictions = 1
Wald X2 for restrictions = 0.0443
Prob > chi2(1) = 0.8332 ( 1) weight - length = 0
------------------------------------------------------------------------------
| Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
weight | -.0025117 .0005925 -4.24 0.000 -.003673 -.0013504
length | -.0025117 .0005925 -4.24 0.000 -.003673 -.0013504
_cons | 6.530763 1.662454 3.93 0.000 3.272413 9.789113
------------------------------------------------------------------------------

Constrained estimation results are not stored.
Post-estimation commands use the unconstrained model!

-------------------------------------------
Richard Williams, Notre Dame Dept of Sociology
OFFICE: (574)631-6668, (574)631-6463
HOME: (574)289-5227
EMAIL: Richard.A.Williams.5@ND.Edu
WWW: http://www.nd.edu/~rwilliam

*
* 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/