On Sun, Nov 18, 2012 at 1:37 PM, Allin Cottrell <cottrell@wfu.edu> wrote:
On Sun, 18 Nov 2012, Lee Adkins quoted Allin:

>> In this example the computed variance for the baths
>> coefficient is 2.15e-13, which seems on the big side to be
>> forced to zero. I think the only way to get this "right" would
>> be to somehow keep track of which coefficients, if any, are
>> assigned a definite numerical value by the restriction -- i.e.
>> look for rows of the R matrix that have only one non-zero
>> entry?

and wrote:

> Yes, I think so, too since the std errors (and coefficients) can always be
> changed by an arbitrary amount by rescaling y or x or both.

I've now put that into CVS. Here's a precise account of what's new:

When transcribing from the numerically computed variance matrix for
restricted OLS estimates, we examine the R matrix (as in R\beta =
q). For each row of R, if it contains a single non-zero element we
record the column position of that element, call it p. And we
override the calculated values for all elements in row p and column
p of the variance matrix with zeros.

If anyone can think of a way this could end up doing the wrong
thing, please let me know!


It's almost working.  Here is the example:

<hansl>

open "C:\Program Files (x86)\gretl\data\poe\br.gdt"
square sqft bedrooms
logs price sqft
series price = price/100
series y = price
list xlist = const l_sqft sq_bedrooms bedrooms baths age
matrix R = zeros(3,3)~I(3)
matrix r = {  -700 ; 700; -5 }

ols price xlist
restrict --full
    R = R
    q = r
end restrict
matrix s = $stderr
matrix v = $vcv
R
s
v
</hansl> 

produces

? R
R (3 x 6)

  0   0   0   1   0   0 
  0   0   0   0   1   0 
  0   0   0   0   0   1 

? s
s (6 x 1)

      625.86 
      87.986 
      7.2960 
 1.8334e-006 
      0.0000 
      0.0000 

? v
v (6 x 6)

 3.9170e+005      -54786.       2744.3  3.0797e-011  2.4730e-011 -1.1930e-012 
     -54786.       7741.5      -431.54 -2.0534e-012 -2.6880e-013 -5.0720e-014 
      2744.3      -431.54       53.232 -1.4314e-012 -1.2340e-014 -1.0910e-014 
 3.0797e-011 -2.0534e-012 -1.4314e-012  3.3613e-012  6.1714e-013  4.9556e-014 
 2.4730e-011 -2.6880e-013 -1.2340e-014  6.1714e-013       0.0000       0.0000 
-1.1930e-012 -5.0720e-014 -1.0910e-014  4.9556e-014       0.0000       0.0000 


Since row 1 of the restrict matrix R contains a single number in column 4, variance of b4 should be = 0.  Also, the off diagonal elements aren't zero, to the right of column 3 and below row 3.  The negative variances for variables 5 and 6 are now zero though.  
--
Lee Adkins
Professor of Economics
lee.adkins@okstate.edu

learneconometrics.com