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
Multiple lineal regression / Dummy variable, interactions and confounding variablesHi. I apologize if this is no a question I should post here. I am trying to analyze the interaction …
Merge ifHello, Hi, I want to use merge, but the problem is that my using data set is an already appended da…
Getting p-values for variablesI am doing a logistic regression using three predictor variables: country, age group, and gender. Is…
Panel Data, one year dummy variable omitted because of collinearityHi everybody, I'm using panel data to examine the effect of CEO age on tone and readability of annu…
country/regional fixed effectsHi I have a question regarding country fixed effects. I am quite new to this subject, so apologies f…
Subscribe to:
Post Comments (Atom)
0 Response to cannot use NL with weights and cluster-robust
Post a Comment