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

st: Moment evaluator programs with K equations

From   Christopher Kodongo <>
Subject   st: Moment evaluator programs with K equations
Date   Wed, 17 Feb 2010 16:43:28 +0200

Dear statalisters

Something appears to be fundamentally wrong with the following program. Trouble is - I can't spot it. Can you?

program tryagain2, eclass
version 11
syntax varlist [if], at(name) depvars(varlist) indvars(varlist)
quietly {
    tempvar xb
    generate double `xb' = 0 `if'
    local k = 1
    local i = 1
    foreach var of varlist `depvars' {
        foreach var of varlist `indvars' {
            replace `xb' = `xb' + `at'[`k',`i']*`var' `if'
            local `++i'
        local `++k'
    replace `xb' = `xb' + `at'[`k',`i'] `if'   
    replace `varlist' = `depvars' - `xb' `if'               

gmm tryagain2, nequations(3) parameters(wldemr usaemr _cons) ///
    depvars(kenemr moremr zaremr) indvars(wldemr usaemr) ///
    instruments(nigemr empemr zaremr) wmatrix(robust) vce(hac bartlett 2) igmm

The output when I run it: INVALID MOREMR. (moremr is one of my dependent variables).

This communication is intended for the addressee only. It is confidential. If you have received this communication in error, please notify us immediately and destroy the original message. You may not copy or disseminate this communication without the permission of the University. Only authorized signatories are competent to enter into agreements on behalf of the University and recipients are thus advised that the content of this message may not be legally binding on the University and may contain the personal views and opinions of the author, which are not necessarily the views and opinions of The University of the Witwatersrand, Johannesburg. All agreements between the University and outsiders are subject to South African Law unless the University agrees in writing to the contrary.

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