Hello everyone,
Currently, I am trying to generate a variable that indicates me the number of neighbors that are within 1 km and received a treatment. The indicator must be in control observations and treatment observations. So, if the observation is control, it would give me the total number of treated observations within 1 km, the same for the treated observation.
I have tried with the following code:
nearstat latitude longitude, near(latitude longitude) distvar(mydist) ncount(number_treated_HH) dband(0 1) contvar(puretreatment)
where puretreatment = 1 if the observation received the treatment. Nevertheless, I haven't succed. It returns the total number of neighbors within 1 km, regardless if the observation received or not the treatment.
Thank you very much in advance for your help,
Regards
Sara R
Related Posts with Nearstat count number of neighbors that satisfy a certain condition
First Difference of a Variable with RangestatHi, Is it possible to take the first difference (x - x[_n-1]) of a variable using Rangestat or with …
FMM predictive accuracy measuresDear STATA list members, I'm using the STATA command fmm to fit a 2-component normal mixture model …
Testing for significant differences between the betas of two FE model specifications without using an interaction termGood morning all, I am using 2-wave panel data and a standard fixed effects model to estimate the m…
missing option in proportion commandHello everyone, I am having a problem switching to STATA 14 to 16 Command proportion does not have…
Merging dataset with different number of subjectsHello, this is my first post and I am a bit of a newbie so I hope my question is not too obvious. I…
Subscribe to:
Post Comments (Atom)
0 Response to Nearstat count number of neighbors that satisfy a certain condition
Post a Comment