Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Hyphen '-' is not working within GMM equation sequence, any alternative suggestion is highly appreciated

    I am writing the following program:

    HTML Code:
    clear all
    program define svywt
    version 15.1
    syntax varlist, WTvar(varlist)
        
        gettoken depvar indepvars : varlist
        _fv_check_depvar `depvar'
        
        local k: word count `wtvar'
        
        forvalues i = 2/`k'{
        local 1(1:`:word 1 of `wtvar''/(1+{xb: `wtvar'})) //this equation has been written manually to provide linear combinations xb.
        local `i'(`i':`:word `i' of `wtvar''/(1+{xb: }))
        }
        local last(last:(`depvar' - ({`depvar': `indepvars' _cons}))/    (1+{xb: }))
        local last_inst instruments(last: `indepvars')
        
        gmm `1' `2'``k'' `last', `last_inst' onestep winitial(unadjusted, independent)  //help needed in this part
            
        end
    
    sysuse auto, clear
    egen y = mean(price)
    
    gen price_1 = price -y
    
    egen x = mean(mpg)
    
    gen mpg_1=mpg-x
    
    egen z =mean(trunk)
    
    gen trunk_1 = trunk-z
    
    svywt price weight mpg, wtvar(price_1 mpg_1 trunk_1)
    I need help to write this:

    HTML Code:
     gmm `1' `2'``k'' `last', `last_inst' onestep winitial(unadjusted, independent)
    in the form

    HTML Code:
    gmm `1' -``k'' `last', `last_inst' onestep winitial(unadjusted, independent)
    or some other form that allows me to write "1-k" equations in short so that if I have very large 'k', I do not need to mention all equations one by one.

    Thanks in advance for your help.

    Rabiul
    Last edited by Rabiul Islam; 29 Feb 2020, 15:30.
Working...
X