On Wed, 5 Aug 2009, Allin Cottrell wrote:

>> If the original model was estimated via OLS, the restricted one
>> could be estimated via NLS.

An alternative which does away with NLS and the associated potential 
convergence problems is a Wald-type test, that is, a simple application 
of the delta method (see section 5.9 of the manual). Example:

<script>
function nlWald(matrix coeff, matrix vcv, string funcstring)

     lc = coeff
     string s = funcstring~"(&lc)"
     matrix bread = @s
     df = cols(bread)

     matrix J = fdjac(lc, @s)
     matrix ham = invpd(qform(J, vcv))
     scalar WT = qform(bread, ham)

     printf "Nonlinear Wald Test: %12.6f (%d df, p-value = %g)\n", \
       WT, df, pvalue(x, df, WT)

     return scalar WT

end function

# ----------------------------------------------

# constraint function

function somestupidfunction(matrix *coeff)
     scalar b1 = coeff[1]
     scalar b2 = coeff[2]
     matrix ret = (sqrt(b1)-b2*50) ~ (b1*b2 - 7)
     return matrix ret
end function

# ----------------------------------------------

# main script

open data3-1.gdt
ols price const sqft
nlWald($coeff, $vcv, "somestupidfunction")
</script>

Basically, all you have to do is write a constraint function returning a 
_row_ vector, which must be 0 under H0 and nonzero under H1. Then, you 
feed it into the nlWald function and you're all set.

The example above tests the (silly) joint hypothesis

\sqrt{\beta_1} = 50 \beta_2
and
\beta_1 \beta_2 = 7


Riccardo (Jack) Lucchetti
Dipartimento di Economia
Università Politecnica delle Marche

r.lucchetti(a)univpm.it
http://www.econ.univpm.it/lucchetti

Reply via email to