Announcement

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

  • cannot use NL with weights and cluster-robust

    Hi all,

    I use substitutable expression program to run non-linear least squares (nl). I try to use both weights and cluster-robust standard error, however, I get error: "weights not allowed with vce()". Is there anyway I can get around this in Stata?

    I attach the part of codes that matter.

    capture program drop nlmain
    program nlmain
    version 15
    syntax varlist [if], at(name)
    tokenize `varlist'

    // extract parameters
    tempname b0 lambda theta b11 b12
    scalar `b0' = `at'[1,1]
    scalar lambda = `at'[1,2]
    scalar theta = `at'[1,3]
    scalar `b11' = `at'[1,4]
    scalar `b12' = `at'[1,5]

    update_exp
    replace `1' = `b11'* inc_tile_exp + `b12' * edu_exp + `b0' `if'

    // add controls
    foreach i of numlist 6/`=n_col +2'{
    tempname par`i'
    scalar `par`i'' = `at'[1,`i']
    }

    foreach i of numlist 6/`=n_col+2'{
    local ii = `i' - 4
    replace `1' = `1' + `par`i'' * ``ii''
    }
    end

    nl main @ pstk `control' , parameters("`par'") initial(myvals) hasconstant(b0) vce(cluster cohort)

    Thank you,

    Dickson Zhu
Working...
X