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
table checking balance across covariates for two groups.Hi all, I am trying to create a small table where I test if covariates are balanced across two grou…
Interpreting coefficients when there are dummy variables presentHi, I had a question about interpreting coefficients on Stata. I have a continuous variable, call i…
cmp command for rank-ordered probit modelDear all, I am running a rank-ordered probit model using the cmp command. The dependent variable is…
Interpret predict probability Please how do you get to interpret the predict probability of an outcome? holding all other variabl…
Different colors for two groups of bars in a bar chartDear all, I am trying to make a bar chart that shows mean value of a variable (attitudes toward immi…
Subscribe to:
Post Comments (Atom)
0 Response to Nearstat count number of neighbors that satisfy a certain condition
Post a Comment