Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save benwhalley/9b465121fddbd632d0b07d38960f1165 to your computer and use it in GitHub Desktop.
Save benwhalley/9b465121fddbd632d0b07d38960f1165 to your computer and use it in GitHub Desktop.
rf2.longs.with <- bind_sims(extract_sims(rf2.preds), newdata)
rf2predswide <- rf2.longs %>%
dcast(., month+sim+pd.b~grp, value.var="fitted", fun.aggregate=mean)
intervals <- rf2predswide %>%
mutate(diff=tau-dbt) %>%
group_by(month) %>%
do(., as.data.frame(t(quantile(.$diff, probs=c(.025, .5, .975)))))
names(intervals) <- c("month", "lo", 'med', "hi")
intervals
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment