I’m trying to estimate parameters for an SEIR model.
My simulation will produce output by day in the form of vector. However, because my observed data is by month, I will need to sum up the daily output by groups, which is month-year, e.g “Jun-2009”.
In R, its done using rowsum like in the following scripts:
pred <- rowSums(out[,c(“Ab”,“Ag”,“Ao”,“Ae”,“Ai”)]) # to sum up a few vectors
pred.month <- rowsum(pred,group=time.month,reorder=FALSE,na.rm=TRUE) # aggregate daily model output by month
I have two issues here:
- how to declare time.month in data block given that its class is character in R.
- Is there an equivalent way to write rowsum in rstan?
I’m not sure if attaching my Stan code will be more helpful. any help is much appreciated.