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
Related Posts with cannot use NL with weights and cluster-robust
Storing first-stage statistics for 2SLS regression using regsaveHi everyone, I am running a long loop with a number of different 2SLS regressions using ivregress. …
Problem with combomarginsplotHi there, I have created two piecewise graphs from linear mixed effects models. I now want to overl…
Probit RegressionHey guys! I want to run a probit regression on the following data HHID PerID Agr_rev Insurance E…
Loop issuesHi everyone! I have some issues in running two loops. What I want to do is to estimate alpha and bet…
Code folding and unfoldingIn a do file, if code is enclosed within curly braces, that code can be folded and unfolded. However…
Subscribe to:
Post Comments (Atom)
0 Response to cannot use NL with weights and cluster-robust
Post a Comment