Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
library(gdata)
Data = read.xls("http://www.pnas.org/content/suppl/2014/05/30/1402786111.DCSupplemental/pnas.1402786111.sd01.xlsx",
nrows = 92, as.is = TRUE)
library(glmmTMB)
originalModelGAM = glmmTMB(alldeaths ~ scale(MasFem) *
(scale(Minpressure_Updated.2014) + scale(NDAM)),
data = Data, family = nbinom2)
# Residual checks with DHARMa
library(DHARMa)
res <- simulateResiduals(originalModelGAM)
plot(res)
# no significant deviation in the general plot, but try this
# which was highlighted by https://www.theguardian.com/science/grrlscientist/2014/jun/04/hurricane-gender-name-bias-sexism-statistics
plotResiduals(res, Data$NDAM)
# we also find temporal autocorrelation
res2 = recalculateResiduals(res, group = Data$Year)
testTemporalAutocorrelation(res2, time = unique(Data$Year))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment