Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

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


From   "Steve Martin" <stephen.martin@york.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: How to use elements of a matrix as constraints in cnsreg
Date   Thu, 11 Aug 2011 17:53:34 +0100

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/


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