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

st: mata error function name already exists

From   Carl Nelson <>
Subject   st: mata error function name already exists
Date   Wed, 10 Dec 2008 17:56:25 -0600 (CST)

I am trying to bootstrap a gmm estimator with generated explanatory variables defined by the following mata function
	mata set matastrict on
	void gmmrsk(string scalar yname, string scalar hname, string scalar xname)
	real colvector y, r, coeff, c1, c2, c
	real matrix h, x, b11, b12, b21, b22, b
	real scalar samvar, lambda
	y = st_data(.,yname)
	h = st_data(.,tokens(hname))
	x = st_data(., tokens(xname))
	r = h[.,1] \ h[.,2]
	samvar = variance(r)
	lambda = 0.526/samvar

// construct matrices for parameter estimation
// pieces are constructed and put together
// coefficient estimated
b11 = h'h
b12 = x'x
b21 = lambda*(x'h)
b22 = x'x
c1 = h'y
c2 = x'y
c = c1 \ c2
b = (b11 , b12) \ (b21, b22)
coeff = luinv(b)*c

// return coefficient to stata to bootstrap standard errors


When it runs I get the error gmmrsk() already exists r(3000).
With stata programs I know you avoid this with the capture program drop prefix.
Is there an analogous mata prefix or am I doing something else wrong?

Carl Nelson

*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index