Supplement 1. R code demonstrating how to fit a logistic regression model, with a random intercept term, and how to use resampling-based hypothesis testing for inference.

2016-08-09T09:22:01Z (GMT) by David I. Warton Francis K. C. Hui
<h2>File List</h2><blockquote> <p><a href="glmmeg.R">glmmeg.R</a>: R code demonstrating how to fit a logistic regression model, with a random intercept term, to randomly generated overdispersed binomial data.</p> <p><a href="boot.glmm.R">boot.glmm.R</a>: R code for estimating <i>P</i>-values by applying the bootstrap to a GLMM likelihood ratio statistic.</p> </blockquote><h2>Description</h2><blockquote> <p>glmm.R is some example R code which show how to fit a logistic regression model (with or without a random effects term) and use diagnostic plots to check the fit. The code is run on some randomly generated data, which are generated in such a way that overdispersion is evident. This code could be directly applied for your own analyses if you read into R a data.frame called “dataset”, which has columns labelled “success” and “failure” (for number of binomial successes and failures), “species” (a label for the different rows in the dataset), and where we want to test for the effect of some predictor variable called “location”. In other cases, just change the labels and formula as appropriate.</p> <p>boot.glmm.R extends glmm.R by using bootstrapping to calculate P-values in a way that provides better control of Type I error in small samples. It accepts data in the same form as that generated in glmm.R.</p> </blockquote>