David I. Warton and Francis K. C. Hui. 2011. The arcsine is asinine: the analysis of proportions in ecology. Ecology 92:3–10.


Supplement

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.
Ecological Archives
E092-001-S1
.

Copyright


Authors
File list (downloads)
Description


Author(s)

David I. Warton & Francis K. C. Hui
School of Mathematics and Statistics
The University of New South Wales
NSW 2052 Australia
David.Warton@unsw.edu.au

File list

glmmeg.R: R code demonstrating how to fit a logistic regression model, with a random intercept term, to randomly generated overdispersed binomial data.

boot.glmm.R: R code for estimating P-values by applying the bootstrap to a GLMM likelihood ratio statistic.

Description

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.

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.