Hello,
My data is arranged as panel data. I have daily data on Covid-19 cases per municipality and I am trying to define a variable to count how many surges occurred in each municipality over the past year. For that I am using the growth rate of the number of infections, and I defined that an outbreak occurs every time the growth rate is higher than 0.1. Having done all that, my problem is in counting the number of times that occurs. I cannot use the code egen outbreak = sum(growth_rate_cum == 0.1), by(concelho) since the growth rate is never exactly 0.1. On the other hand, egen outbreak = sum(0.0950 <= growth_rate <= 0.1050), by(concelho) counts too many observations. Rounding the growth rate is also not an option, since most observations will round to 0.1.
Having said that, I want to count the number of times that the growth rate goes from a value below 0.1 to a value equal or above 0.1. Is there anyway to do this?
Thank you in advance
My data is arranged as panel data. I have daily data on Covid-19 cases per municipality and I am trying to define a variable to count how many surges occurred in each municipality over the past year. For that I am using the growth rate of the number of infections, and I defined that an outbreak occurs every time the growth rate is higher than 0.1. Having done all that, my problem is in counting the number of times that occurs. I cannot use the code egen outbreak = sum(growth_rate_cum == 0.1), by(concelho) since the growth rate is never exactly 0.1. On the other hand, egen outbreak = sum(0.0950 <= growth_rate <= 0.1050), by(concelho) counts too many observations. Rounding the growth rate is also not an option, since most observations will round to 0.1.
Having said that, I want to count the number of times that the growth rate goes from a value below 0.1 to a value equal or above 0.1. Is there anyway to do this?
Thank you in advance

Comment