Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

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

From |
"Steve Martin" <[email protected]> |

To |
<[email protected]> |

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

Date |
Thu, 11 Aug 2011 18:08:08 +0100 |

```
For anyone interested...one solution is to define a scalar as the relevant
element of the matrix
scalar define S1=D[1,1]
scalar define S2=D[2,1]
and then this works
constraint 1 llonepenhx=S1
constraint 2 lIMD2007=S2.
S.
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Steve Martin
Sent: 11 August 2011 17:54
To: [email protected]
Subject: st: How to use elements of a matrix as constraints in cnsreg
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))
Suggestions please. Thanks.
Steve
*
* 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/
```

**References**:**st: How to use elements of a matrix as constraints in cnsreg***From:*"Steve Martin" <[email protected]>

- 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: Stata with MacVim** - Previous by thread:
**st: How to use elements of a matrix as constraints in cnsreg** - Next by thread:
**Re: st: How to use elements of a matrix as constraints in cnsreg** - Index(es):