I'm relatively new to R and I'm uncertain whether I've correctly constructed an aggregated rate.
My data set contain monthly number of suicides for six counties in a country. Four of these regions have received a treatment, while the remaining two are controls.
I want to present a descriptive trend in suicide rate aggregated to treatment level, i.e. summarizing county suicides over regions and construct a population adjusted rate of suicides per 100 000 by treatment status.
This is my code:
# 1. Group suicide rate per 100 000 by treatment/intervention month_intervention <- GP %>% group_by(time,intervention)%>% summarize( suicideRate=sum(dead/regpop*100000)) month_intervention # 2. Make ggplot SuiPlot<-ggplot(month_intervention, aes(x=time, y=suicideRate, col=intervention )) + geom_smooth(se=FALSE) + geom_point(alpha=.5) + expand_limits(y=0) SuiPlot
Here the aggregated suicide rate is constructed by,
where dead is monthly number of suicides in individual counties and regpop is yearly registered population in individual counties (monthly data not available).