Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down at the end of May, and its replacement, **statalist.org** is already up and running.

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

From |
Nick Cox <njcoxstata@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: How to use elements of a matrix as constraints in cnsreg |

Date |
Thu, 11 Aug 2011 18:42:44 +0100 |

At a guess, you must evaluate the elements of D, not just refer to them. Something like constraint 1 llonepenhx = `= D[1,1]' constraint 2 lIMD2007 = `= D[2,1]' cnsreg yvar x1var x2var llonepenhx lIMD2007, constraints(1-2) should mean that -constraint- and thus -cnsreg- just see the evaluated expressions. Warning: speculative code; completely untested. Nick On Thu, Aug 11, 2011 at 5:53 PM, Steve Martin <stephen.martin@york.ac.uk> wrote: > I am using Stata 11. I have a matrix D > > . matrix list D > > D[2,1] > random > llonepenhx -.43352401 > lIMD2007 -.19335928 > > I want to estimate a constrained regression where the values of certain > elements of the matrix D serve as constraints in a regression. In > particular, I would like to constrain the coefficient on llonepenhx to be > equal to -0.43352401 and the coefficient on lIMD2007 to be -0.19335928. > > Trying > > constraint 1 llonepenhx=D[1,1] > constraint 2 lIMD2007=D[2,1] > cnsreg yvar x1var x2var llonepenhx lIMD2007, constraints(1-2) > > results in > > (note: constraint number 1 caused error r(131)) > (note: constraint number 2 caused error r(131)) > * * 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/

- Prev by Date:
**Re: st: How do I produce a dataset based on all possible *triplets* of identifiers within each group?** - Next by Date:
**RE: st: warning: variable has embedded blanks** - Previous by thread:
**st: RE: How to use elements of a matrix as constraints in cnsreg** - Next by thread:
**st: margins option in Stata10?** - Index(es):