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
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 …
Data Categorization txt fileDear All I have daily share price data in a txt file. The issue is to split the variables into dif…
Getting p-values for variablesI am doing a logistic regression using three predictor variables: country, age group, and gender. Is…
How to export this table to excel from statasysuse auto tab foreign,sum(price) This code generates a table that I need to export to Excel. Can …
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 Nearstat count number of neighbors that satisfy a certain condition
Post a Comment