Package: ecostats 1.1.11

ecostats: Code and Data Accompanying the Eco-Stats Text (Warton 2022)

Functions and data supporting the Eco-Stats text (Warton, 2022, Springer), and solutions to exercises. Functions include tools for using simulation envelopes in diagnostic plots, and a function for diagnostic plots of multivariate linear models. Datasets mentioned in the package are included here (where not available elsewhere) and there is a vignette for each chapter of the text with solutions to exercises.

Authors:David Warton [aut, cre], Christopher Chung [ctb], Mark Donoghoe [ctb], Eve Slavich [ctb]

ecostats_1.1.11.tar.gz
ecostats_1.1.11.zip(r-4.7)ecostats_1.1.11.zip(r-4.6)ecostats_1.1.11.zip(r-4.5)
ecostats_1.1.11.tgz(r-4.6-any)ecostats_1.1.11.tgz(r-4.5-any)
ecostats_1.1.11.tar.gz(r-4.7-any)ecostats_1.1.11.tar.gz(r-4.6-any)
ecostats_1.1.11.tgz(r-4.6-emscripten)
manual.pdf |manual.html
DESCRIPTION
card.svg |card.png
ecostats/json (API)

# Install 'ecostats' in R:
install.packages('ecostats', repos = c('https://dwarton.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/dwarton/ecostats/issues

Pkgdown/docs site:https://dwarton.github.io

Datasets:
  • aphids - Aphid data
  • aphidsBACI - Aphid data as a BACI design
  • estuaries - Effect of pollution on marine microinvertebrates in estuaries
  • estuaryZone - Effect of pollution on marine microinvertebrates in estuaries in different zones
  • globalPlants - Global Plants data
  • guineapig - Guineapig data
  • headbobLizards - Headbob displays of _Anolis_ lizards
  • maunaloa - Atmospheric carbon dioxide concentration from the Mauna Loa Observatory
  • Myrtaceae - Species richness of _Myrtaceae_ plants
  • ravens - Ravens data
  • reveg - Invertebrate abundances in a revegetation study
  • seaweed - Habitat Configuration data from seaweed experiment
  • seedsTemp - Germination rates of _Abutilon angulatum_ at different temperatures
  • snowmelt - How flowering time relates to snowmelt date
  • waterQuality - Water Quality data
  • windFarms - Data from wind farm study

On CRAN:

Conda:

6.68 score 8 stars 67 scripts 813 downloads 7 exports 60 dependencies

Last updated from:2a6c608f26. Checks:9 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-devel-x86_64OK229
source / vignettesOK343
linux-release-x86_64OK210
macos-release-arm64OK117
macos-oldrel-arm64OK133
windows-develOK151
windows-releaseOK139
windows-oldrelOK162
wasm-releaseOK178

Exports:addSmoothanovaPBBlockBootIDcpredictcresidualsplotenvelopeqqenvelope

Dependencies:betaregcliclustercodacodetoolscpp11doParallelecoCopulafarverflexmixforeachFormulaGETggplot2glassoglm2gluegridExtragtableigraphisobanditeratorslabelinglatticelifecyclelmtestmagrittrMASSMatrixmgcvmodeltoolsmvabundmvtnormnetworknlmennetnumDerivordinalpillarpkgconfigplyrR6RColorBrewerRcppRcppGSLrlangS7sandwichscalessnastatmodstatnet.commontibbletweedieucminfutf8vctrsviridisLitewithrzoo

Chapter 10 -- Analysing discrete data -- Exercise solutions and Code Boxes
Exercise 10.1: Crabs on seaweed | Exercise 10.2: Do offshore wind farms affect fish communities? | Exercise 10.3: Invertebrate response to bush regeneration} | Code Box 10.1: Example GLM fits for Exercises 10.1-3.} | Code for Fig. 10.5 | Code Box 10.2: A summary of a GLM fit to the crab presence-absence data of Exercise 10.1 | Code Box 10.3: Dunn-Smyth residual plots for the crab data, using the mvabund package | Code for Figure 10.8 | Exercise 10.4: Counts of Ostracods in habitat configuration experiment. | Code Box 10.4: Assumption checking for Ostracod counts of Exercise 10.4.} | Exercise 10.5: Checking the Poisson assumption on the wind farm data. | Exercise 10.6: Checking the Poisson assumption for the worm counts.}\label | Code Box 10.5: R code using the anova function to test the key hypotheses of interest to David and Alistair in Exercise 10.1. | Exercise 10.7: Testing if there a wind farm effect | Code Box 10.6: Model-based inference for Anthony's worm counts from Exercise 10.3. | Code Box 10.7: Design-based inference for David's and Alistair's crab data using mvabund. | Code Box 10.8: Getting the wrong answer by ignoring overdispersion in Anthony's worm counts from Exercise 10.3. | Code Box 10.9: Using an observation-level random effect for a binomial response | Exercise 10.8: Anthony's ant data. | Exercise 10.9: Worm counts with different numbers of pitfall traps | Code Box 10.10: Adding an offset to the model for worm counts. | Exercise 10.10: Anthony's cockroaches

Last update: 2022-08-25
Started: 2021-03-25

Chapter 11 -- Multivariate analysis -- Exercise solutions and Code Boxes
Exercise 11.1: Leaf economics and environment | Exercise 11.2: Flower size and shape | Exercise 11.3: Hunting spiders and their environment | Code Box 11.1: Sample variance-covariance matrices on R | Code Box 11.2: Fitting a multivariate linear model to the leaf economics data. | Code Box 11.3: Checking multivariate linear model assumptions for leaf economics data | Code Box 11.4: A multivariate linear model for the leaf economics data using mvabund | Exercise 11.4: Transforming Ian's leaf economics data | Exercise 11.5: Transforming Edgar's data? | Code Box 11.5: Preparing spider data for analysis on lme4 or glmmTMB | Code Box 11.6: Fitting a hierarchical GLM to spider data on glmmTMB | Code Box 11.7: MCMCglmm fit to Petrus’s spider genus data | Exercise 11.6: Different effects on different spider genera? | Code for Figure 11.4 | Code Box 11.8: Diagnostic plots for a hierarchical GLM of Petrus’s spider data | Code Box 11.9: Diagnosing convergence in a MCMCglmm fit | Exercise 11.7: Non-converging model for Petrus’s Alopecosa species

Last update: 2022-08-25
Started: 2022-02-01

Chapter 12 -- Visualising many responses -- Exercise solutions and Code Boxes
Exercise 12.1: Flower size and shape | Exercise 12.2: Bush regeneration and invertebrate counts | Code Box 12.1: Plotting the bush regeneration data of Exercise 12.1 using mvabund. | Code Box 12.2: A PCA of Edgar's Iris data | Code Box 12.3: Factor analysis of the Iris data | Code Box 12.4: Assumption checking for a factor analysis of the Iris data | Exercise 12.4: A factor analysis for Anthony’s data(?) | Code Box 12.5: Choosing the number of factors for the iris data | Code Box 12.6: A generalised latent variable model for Anthony’s revegetation data | Exercise 12.5: Checking analysis decisions for Anthony’s revegetation data | Code Box 12.7: A non-metric multi-dimensional scaling ordination of Anthony’s data | Exercise 12.6: MDS ordinations of coral data | Code Box 12.8: Studying each observation separately for the Iris data

Last update: 2022-08-25
Started: 2022-02-01

Chapter 14 -- Multivariate abundances -- inference about environmental associations -- Exercise solutions and Code Boxes
Exercise 14.1: Revegetation and invertebrate counts | Exercise 14.2: Invertebrates settling on seaweed | Exercise 14.3: Do offshore wind farms affect fish communities? | Code Box 14.1: Using mvabund to test for an effect of revegetation in Exercise 12.2 | Exercise 14.4: Testing for an effect of isolation on invertebrates in seaweed | Code Box 14.2: Checking assumptions for the revegetation model of Code Box 14.1 | Code Box 14.3: Checking mean-variance assumptions for a Poisson revegetation model | Exercise 14.5: Checking assumptions for the habitat configuration data | Exercise 14.6: Checking assumptions for the wind farm data | Code Box 14.4: A manyglm analysis of the revegetation data, using a statistic accounting for correlation | Exercise 14.7: Testing for an effect of offshore wind farms (slowly) | Code Box 14.5: Analysing ordinal data from the habitat configuration study using manyany | Code Box 14.6: A compositional analysis of Anthony’s revegetation | Code Box 14.7: A faster compositional analysis of Anthony’s revegetation data | Code Box 14.8: Quick-and-dirty compositional analysis of Anthony’s revegetation data | Code Box 14.9: Posthoc testing for the bush regeneration data | Code Box 14.10: Exploring indicator taxa most strongly associated with the treatment effect in Anthony’s revegetation data | Exercise 14.8: Indicator species for offshore wind farms?

Last update: 2022-08-25
Started: 2022-02-01

Chapter 15 -- Predicting multivariate abundances -- Exercise solutions and Code Boxes
Exercise 15.1: Predicting fish communities at wind farms? | Exercise 15.2: Which environmental variables predict hunting spider communities? | Code Box 15.1: Predictive likelihood for the wind farm data | Exercise 15.3: Cross-validation for wind farm data and rare species | Code Box 15.2: Fitting a mixed model to the wind farm data | Exercise 15.4: Predictive likelihood for wind farm mixed model | Code Box 15.3: Fitting a LASSO to the wind farm data via glmnet | Code Box 15.4: Fitting a group-LASSO to the wind farm data | Exercise 15.5: Comparing predictive likelihoods for the wind farm data | Code Box 15.5: Reduced rank regression for the wind farm data | Code Box 15.6: Using the LASSO for Petrus’s spider data | Code Box 15.7: Mixed model prediction of spider abundances

Last update: 2022-08-25
Started: 2022-02-01

Chapter 16 -- Understanding variation in environmental response across taxa -- Exercise solutions and Code Boxes
Exercise 16.1: Understanding how spiders vary in environmental response | Code Box 16.1: Fitting a Species Archetype Model to Petrus’s spider data | Code Box 16.2: Minding your P’s and Q’s for Petrus’s Species Archetype Model | Exercise 16.2: Archetypal revegetation response | Code Box 16.3: Choosing the number of archetypes for Petrus’s spider data | Exercise 16.3: How many revegetation archetypes? | Exercise 16.4: Understanding why spiders vary in environmental response | Code Box 16.4: A fourth corner model for spider data using traitglm | Exercise 16.5: Heloise’s ants | Code Box 16.5: A fourth corner interaction plot for Petrus’s spider data | Exercise 16.6: A fourth corner interaction plot for Heloise’s ants | Code Box 16.6: Quantifying how effectively traits explain 𝛽-diversity | Exercise 16.7: Variation explained by traits for Heloise’s ants

Last update: 2022-08-25
Started: 2022-02-01

Chapter 3 -- Regression with multiple predictor variables -- Exercise solutions and Code Boxes
Exercise 3.1: Global plant height | Code Box 3.1: Simple linear regression of global plant height data - predicting | Code Box 3.2: Multiple linear regression of global plant height data on R -- predicting | Code Box 3.3: R code to produce the plots of Figure 3.1 | Code Box 3.4: Tests of multiple parameters on R using the anova function | Code Box 3.5: Multi-collinearity example -- adding rainfall in the wettest month (rain.wetm) to a model that already has annual precipitation (rain). | Exercise 3.2: Plant height data -- transform response? | Exercise 3.3: Plant height -- skewed rainfall data? | Code Box 3.6: Computing variance inflation factors to check for multi-collinearity. | Code Box 3.7: Correlations and pairwise scatterplots to look for multi-collinearity. | Exercise 3.4: Snails on seaweed | Code Box 3.8: Analysis of variance in R for the seaweed data of Exercise 1.13 using | Code Box 3.9: Running confint on the seaweed data doesn't give us what we | Code Box 3.10: Analysis of variance of the seaweed data of Exercise 1.13 with Tukey's multiple comparisons via the multcomp package. | Exercise 3.5: Plant height -- climate explains patterns? | Exercise 3.6: Habitat con�guration study { mind your P's and Q's | Exercise 3.7: Habitat con�guration study { small plots

Last update: 2022-08-25
Started: 2021-03-09

Chapter 4 -- Linear models -- anything goes -- Exercise solutions and Code Boxes
Exercise 4.1: Ravens and gunshots | Code Box 4.1: Paired t-test for the ravens data | Exercise 4.2: Ravens, guns and air horns | Code Box 4.2: Paired t-test for the ravens data via a linear model | Code Box 4.3: A linear model for the blocked design given by the raven counts in Exercise 4.2 | Exercise 4.3: Seaweed, snails and seaweed mass | Code Box 4.4: Scatterplot of data from Exercise 4.3. | Code Box 4.5: Analysis of covariance for the seaweed data of Exercise 4.3. | Exercise 4.4: Checking ANCOVA assumptions | Code Box 4.6: ANCOVA with the order of terms switched. | Exercise 4.5: Order of terms in writing out a model for snails and seaweed. | Code Box 4.7: "Type II sums of squares" for the ANCOVA of snails and seaweed. | Exercise 4.6: Snails, isolation and time | Code Box 4.8: A comparative boxplot of snail density at each of the six possible combinations of sampling time and distance of isolation. | Exercise 4.7: Factorial ANOVA assumptions | Code Box 4.9: Factorial ANOVA of Snails, Isolation, and Time | Code Box 4.10: R code for the interaction plot in Figure 4.1. | Code Box 4.11: Uh oh... anova gone wrong | Code Box 4.12: Tukey's comparisons don't work for main e�ects in an orthogonal design, as seen for Exercise 4.9: | Code Box 4.13: Tukey's comparisons for a main e�ect of Dist for Exercise 4.6, assuming no interaction. | Code Box 4.14: Tukey's comparisons for all possible treatment combinations for Exercise 4.6. | Code Box 4.15: Tukey's comparisons for Dist within each sampling time, for Exercise 4.6. | Code Box 4.16: Testing for an interaction in an ANCOVA for density of epifauna as a function of Dist and algal wet mass. | Exercise 4.8: Global plant height | Code Box 4.17: Using R to fit a quadratic model to the plant height data of Exercise 3.1. | Exercise 4.9: Snowmelt and time to flowering | Exercise 4.10: Bird exclusion and biological control | Exercise 4.11: Seaweed, snails and three factors

Last update: 2022-08-25
Started: 2021-03-09

Chapter 5 -- Model selection -- Exercise solutions and Code Boxes
Exercise 5.1: Plant height and climate | Figures 5.1-5.2: bias-variance trade-off for polynomial models | Code Box 5.1: Using validation for model selection using Angela's plant height data | Code Box 5.2: 5-fold cross-validation for the data of Exercise 5.1 | Code Box 5.3: Computing Information Criteria on R for Exercise 5.1 | Code Box 5.4: All subsets selection for the plant height data of 5.1 | Code Box 5.5: Stepwise subset selection for the plant height data of 5.1 | Simulation code for Figure 5.4 | Code Box 5.6: LASSO for plant height data of 5.1 | Exercise 5.2: Relative importance of climate variables | Code Box 5.7: Sequential $R^2$ for variable importance | Code Box 5.8: Marginal and conditional $R^2$ for variable importance | Code Box 5.9: Standardised coefficients for Angela's height data | Exercise 5.3: Variable importance output | Code Box 5.10: Importance of temperature vs rainfall | Code for Figure 5.5 | Exercise 5.4: Head bobs in lizards -- do their displays change with the environment? | Exercise 5.5 Plant height data and precipitation

Last update: 2022-08-25
Started: 2021-03-09

Chapter 7 -- Correlated samples in times, space, phylogeny... -- Exercise solutions and Code Boxes
Exercise 7.1: Biological control of aphids over time | Code Box 7.1: R code to produce Figure 7.2. | Code Box 7.2: Choosing a longitudinal model for the aphid data | Code Box 7.3: Exploring the random intercept fit to the aphids data | Code Box 7.4: Exploring the random slopes fit to the aphids data | Exercise 7.2: Biological control of aphids in a wheat field | Exercise 7.3: Biological control of aphids across both fields! | Exercise 7.4: Eucalypt richness as a function of the environment | Code Box 7.5: Model selection to choose predictors, and a spatial model, for Ian's richness data | Code Box 7.6: Inferences from spatial and non-spatial models for Ian's richness data | Code Box 7.7: Spatial correlogram for Ian's species richness data | Exercise 7.5: Egg size when Dads incubate | Code Box 7.8: Phylogenetic tree of 71 shorebird species | Code Box 7.9: Exploratory analysis of egg size data}\label | Code Box 7.10: Comparative analysis of egg size data | Code Box 7.11: Residual diagnostics for egg size data | Exercise 7.6: Comparative analysis of egg size data revisited

Last update: 2022-08-25
Started: 2021-03-12

Chapter 9 -- Design-based inference -- Exercise solutions and Code Boxes
Exercise 9.1: Smoking in pregnancy | Exercise 9.2: Three example permutations of treatment labels in the guinea pig data | Code behind Figure 9.1 | Code Box 9.1: A permutation test for the guinea pig data using mvabund | Code Box 9.2: Permutation test for a relationship between latitude and plant height | Code Box 9.3: Using the mvabund package for a bootstrap test of guinea pig data | Exercise 9.3: Case resampling in the guinea pig data | Exercise 9.4: Global plant height -- does rainfall explain latitude effect? | Code Box 9.4: Residual resampling using mvabund for Exercise 9.4. | Code Box 9.5: Plant height data -- checking assumptions | Exercise 9.5: Plant height data -- log transformation | Exercise 9.6: Guinea pig data -- log transformation | Exercise 9.7: Revisiting linear models past | Repeating Exercise 4.9: | Now repeating Exercise 4.10: | Code Box 9.6: Block resampling using mvabund for estuary data | Code Box 9.7: Block resampling using permute for raven data | Code Box 9.8: Moving block bootstrap test for species richness modelling | Code Box 9.9: Moving block bootstrap standard errors for species richness predictions | Exercise 9.8: Does block length matter?

Last update: 2022-08-25
Started: 2021-03-22

Chapter 13 -- Allometric line-fitting -- Exercise solutions and Code Boxes
Exercise 13.1: Brain size-body size relationships | Exercise 13.2: Leaf economics and environment | Code Box 13.1: Linear models of the brain size-body size data | Code Box 13.2: Testing if the brain-body mass slope is 2/3 | Code Box 13.3: Comparing allometric slopes for Ian’s data using smatr | Code Box 13.4: Comparing elevations of allometric lines for Ian’s low soil nutrients data using smatr | Code Box 13.5: Residual plots for brain-body size relationship | Code Box 13.6: Robust SMA for brain-body size relationship | Exercise 13.3: Outlier sensitivity for the brain-body mass data | Exercise 13.4: Robust allometric line fitting for Ian’s leaf data

Last update: 2022-08-16
Started: 2022-02-01

Eco-Stats -- Code and Data Accompanying the Eco-Stats Text
Simulation envelopes in plots | anova tests using a parametric bootstrap | Datasets

Last update: 2022-08-16
Started: 2022-08-16

Chapter 1 -- 'STATS 101' Revision -- Exercise solutions and Code Boxes
Exercise 1.1: Experimental design issues | Exercise 1.2: Which plot for which research question? | Exercise 1.3: Raven count data -- what data properties? | Exercise 1.4: Gender ratios in bats | Exercise 1.5: Ravens and gunshots | Exercise 1.6: Pregnancy and smoking | Exercise 1.7: Inference notation -- Gender ratio in bats | Exercise 1.8: Inference notation -- raven counts | Code Box 1.1: Analysing Kerry's sex ratio data on bats | Exercise 1.9: Assumptions -- Gender ratio in bats | Exercise 1.10: Assumptions -- Raven example | Code Box 1.2: Normal quantile plot for the raven data | Code Box 1.3: log(y + 1)-transformation of the raven data | Exercise 1.11: Height and latitude | Exercise 1.12: Transform plant height? | Exercise 1.13: Snails on seaweed | Exercise 1.14: Transform snails?

Last update: 2022-06-09
Started: 2021-03-09

Chapter 6 -- Mixed effect models -- Exercise solutions and Code Boxes
Exercise 6.1: Effects of water pollution on subtidal marine micro-invertebrates | code for Fig 6.1 | Code Box 6.1: Fitting a linear mixed model to the estuary data of Exercise 6.1 | Code Box 6.2: Residual plots from a mixed model for Exercise 6.1 | Code Box 6.3: Using anova to compare mixed effects models for the estuary data | Code Box 6.4: Confidence intervals for parameters from a mixed effects model for the estuary data | Code Box 6.5: Prediction intervals for random effects terms in a mixed effects model | Exercise 6.2: Fitting random effects with different variances | Exercise 6.3: Bird exclusion and biological control | Exercise 6.4: Estuary data in different zones | Code Box 6.6: Using the parametric bootstrap to compute the standard error of the Mod fixed effect in Exercise 6.1. | Code Box 6.7: A parametric bootstrap to test for an effect of Estuary in Exercise 6.1. | Exercise 6.6: Accurate inferences about the estuary data

Last update: 2022-06-09
Started: 2021-03-09

Chapter 8 -- Wiggly Models -- Exercise solutions and Code Boxes
Code Box 8.1: Fitting a spline smoother to the Mauna Loa annual data of Exercise 8.1 on R. | Code Box 8.2: Residual plot from a GAM of the annual Mauna Loa data of Exercise 8.1 | Code Box 8.3: Comparing curves for the Mauna Loa data. | Exercise 8.2: Eucalypt richness as a function of the environment | Code Box 8.4: Handling interactions in a GAM, when modelling Ian's richness data as a function of minimum temperature and rainfall, for Exercise 8.2 | Exercise 8.3: Smoothers for climate effects on plant height | Code Box 8.5: Residual plot with a smoother to diagnose a model. | Exercise 8.4: Nonlinear predictors of species richness? | Exercise 8.5: Carbon dioxide measurements at Mauna Loa observatory | Code Box 8.6: A simple model for the Mauna Loa monthly data with a cyclical predictor | Code Box 8.7: Residual plots across time and season for the Mauna Loa monthly data | Code Box 8.8: Another model for the Mauna Loa monthly data, with an extra sine curve in there to better handle irregularities in the seasonal effect}\label | Code Box 8.9: Mauna Loa model with autocorrelation}\label | Exercise 8.6: Mauna Loa monthly data -- an extra term in seasonal trend? | Exercise 8.7: Mauna Loa annual data -- temporal autocorrelation?} | Exercise 8.8: Aspect as a predictor of species richness

Last update: 2022-06-09
Started: 2021-03-12

Chapter 17 -- Studying co-occurrence patterns -- Exercise solutions and Code Boxes
Exercise 17.1: Co-occurrence in hunting spider data | Code Box 17.1: Estimating co-occurrence patterns using a copula model | Code Box 17.2: Co-occurrence patterns explained by environmental variables | Exercise 17.2: Spider presence-absence | Exercise 17.3: Co-occurrence in bird communities | Code Box 17.3: A copula graphical model for Petrus’s spider data | Exercise 17.4: Does soil dryness explain co-occurrence patterns in Petrus’s data?

Last update: 2022-05-06
Started: 2022-02-01

Chapter 2 -- An importance equivalence result -- Exercise solutions and Code Boxes
Exercise 2.1 Two-sample t-test for guinea pig experiment | Code Box 2.1 A two-sample t-test of the data from the guinea pig experiment | Code Box 2.2: Smoking and pregnancy -- checking assumptions | Exercise 2.2: Water quality | Code Box 2.3: Fitting a linear regression to the water quality data | Exercise 2.3: Water quality -- interpreting R output | Code Box 2.4: Diagnostic plots for the water quality data | Exercise 2.4: Water quality{ assumption checks | Code Box 2.5: Two-sample t-test output for the smoking-pregnant data, again | Code Box 2.6: Linear regression analysis of the smoking-pregnant data. compare to Code Box 2.5 | Exercise 2.5: Global plant height against latitude | Exercise 2.6: Transform guinea pigs? | Exercise 2.7: Influential value in the water quality data

Last update: 2022-05-06
Started: 2021-03-09