Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save florianhartig/e9a0ba91db1677aa57c6afe4778c2f14 to your computer and use it in GitHub Desktop.
Save florianhartig/e9a0ba91db1677aa57c6afe4778c2f14 to your computer and use it in GitHub Desktop.
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