DOI: 10.5061/dryad.79cnp5j2m
title: Data and code from: Disentangling the drivers of decadal body size decline in an insect population

description: While climate warming is widely predicted to reduce body size of
 ectotherms, evidence for this trend is mixed. Body size depends not only
 on temperature but also on other factors, such as food quality and
 intraspecific competition. Because temperature trends or other long-term
 environmental factors may affect population size and food sources,
 attributing trends in average body size to temperature requires the
 separation of potentially confounding effects. We evaluated trends in the
 body size of the midge Tanytarsus gracilentus and potential drivers (water
 temperature, population size, and food quality) between 1977 and 2015 at
 Lake Mývatn, Iceland. Although temperatures increased at Mývatn over this
 period, there was only a slight (non-significant) decrease in midge adult
 body size, contrary to theoretical expectations. Using a state-space model
 including multiple predictors, body size was negatively associated with
 both water temperature and midge population abundance, and it was
 positively associated with 13C enrichment of midges (an indicator of
 favorable food conditions). The magnitude of these effects were similar,
 such that simultaneous changes in temperature, abundance, and carbon
 stable isotopic signature could counteract each other in the long-term
 body size trend. Our results illustrate how multiple factors, all of which
 could be influenced by global change, interact to affect average ectotherm
 body size.
description: Midges (Diptera: Chironomidae) were captured using window traps
 (Jónsson et al., 1986) at two locations around Lake Mývatn, Iceland. They
 were innumerated to species and separated into two cohorts (early summer
 and late summer), matching the voltinism pattern of the focal species
 (<em>Tanytarsus gracilentus</em>) which overwinter as larvae
 (Gardarsson et al., 2004; Lindegaard & Jónasson, 1979; Einarsson
 et al. 2002, 2004). Archived midges were used to measure carbon stable
 isotopes (McCormick et al. 2022) and wing lengths were measured from
 arculus to tip on 15-20 individuals per generation (where abundances were
 adequate). Because identifications of female midges is difficult and often
 impossible, the dataset includes only males. Air temperature data come
 from the Icelandic Meterological Office (https://www.vedur.is/). All processing to the data are included in scripts.
description: # Data and code for: Disentangling the drivers of decadal body size
 decline in an insect population
 [https://doi.org/10.5061/dryad.79cnp5j2m](https://doi.org/10.5061/dryad.79cnp5j2m) This analysis had two major goals: 1. characterize linear trends at Lake Mývatn, Iceland, between 1977 and 2015 in: 1. midge (*Tanytarsus gracilentus)* wing lengths 2. midge population size 3. midge stable carbon isotopes (<sup>13</sup>C) 4. air and water temperatures 2. characterize the impact of population size, stable isotope signature, and water temperature on midge wing lengths. To approach this problem, we employed state space models that account for temporal autocorrelation and measurement error. We assessed significance by using boostrapped likelihood ratio tests (2,000 simulations for each term). ## Description of the data and file structure This file consists of three subfolders: **Data**, **Output**, and **Scripts**. **Data** includes the raw data on which the analyses were used. * full\_data\_28Sep22.csv * All data used in the analyses | column | description | type | missing values | | ------ | ----------- | ---- | -------------- | | year | calendar year | numeric | NA | | gen | the annual cohort when the midges emerged (Overwintering/ Summer) | character | NA | | year2 | a unique numerical sequence for each generation (year + 0.5 for summer cohort) | numeric | NA | | time | a sequence from the beginning of the dataset to the end of the dataset in decades | numeric | NA | | mean.lengthmm | the average *Tanytarsus gracilentus* wing length in mm | numeric | NA | | lengthmm.se | the standard error of the mean wing length of *Tanytarsus gracilentus* in mm | numeric | NA | | n\_wings | number of individuals on which the average wing length was calculated | numeric | NA | | mean\_wtemp | average water temperature during that midge generation, either observed or estimated for gaps (see paper for details) | numeric | NA | | filled\_using\_airtemps | a logical describing whether water temperature was observed (FALSE) or estimated based on air temperatures (TRUE) used when gaps | logical | NA | | nas\_after\_filling | There were a few occasions where some days could not be estimated from air temperatures. This logical indicates whether any days could not be estimated or were not observed. | logical | NA | | d13C | carbon stable isotopes. See McCormick et al. (2022) for details | numeric | NA | | n\_iso | number of individuals used in the isotope analysis (pooled prior to stable isotope measurements) | numeric | NA | | logcount | log transformed midge abundance in window traps | numeric | NA | | gensummer | a binary reflecting whether the generation is part of the summer cohort | binary | NA | | mean.lengthmm2 | same as mean.winglengthmm, but set to NA where isotope data are missing. | numeric | NA | | d13C2 | same as d13C, but with missing values changed to 0. necessary for analysis. | numeric | 0\* | | logcountz | z transformed log count | numeric | NA | | d13Cz | z transformed d13C, missing values set to 0 for for analysis (they are not estimated, so this has no impact on the analysis, but the method does not handle NAs in this matrix) | numeric | 0\* | | wtempanomz | z tranformed water temperature (z transformed within cohort). | numeric | NA | * trap\_ids.csv * A spreadsheet that identifies the traps for which wing data are included for each generation. | Column | Description | Type | missing values | | ------ | ----------- | ---- | -------------- | | year | calendar year | numeric | NA | | gen | the annual cohort when the midges emerged (Overwintering/ Summer) | character | NA | | traps | A list of traps used to generate the wing length data. Trap names come from Einarsson et al. 2004 | character | NA | * old\_wings.csv * data from Einarsson et al. (2002). missing values = -100 * metadata in old\_wings.xlsx * AnnualTemps.csv * a dataframe of air temperatures. | Column | Description | Type | missing values | | ------ | ----------- | ---- | -------------- | | year | calendar year | numeric | NA | | iceoff | the date on which we estimated when the lake was ice-free (see methods for description) | yyyy-mm-dd | NA | | iceon | the date on which we estimated when the lake was ice covered | yyyy-mm-dd | NA | | nas\_after\_filling | number of dates where there were no water temperatures (see above). | logical | NA | | ann\_icefreewtemp | average water temperature during the ice-free period for a given year in Celsius | numeric | NA | | est\_ice\_duration | estimated duration of ice cover on the lake in days | numeric | NA | | time | number of decades since the first sample | numeric | NA | | ann\_airtemp | average annual air temperature at Grimsstaðir in Celsius | numeric | NA | | ann\_icefreewairtemp | average annual air temperature at Grimsstaðir in Celsius during the period when the lake was ice-free | numeric | NA | * Myvatn\_Outlet\_for\_JamieBotsch\_14sep2022.csv * a data frame containing water temperatures at the outlet (maintained by RAMY: https://ramy.is/). | Column | Description | Type | missing values | | ------ | ----------- | ---- | -------------- | | date | calendar date | dd.mm.08 | blank | | JULIAN | day of year | 1-366 | blank | | MONTH | month of year | numeric | blank | | all others | water temperature in Celsius | numeric | blank or -99 | * weatherstation\_raw (**not included.** We could not confirm that it could be published under CC0) * Hourly weather data for Mývatn from the Icelandic Meteorological Office. Icelandic Meteorological Office 2022: Icelandic Meteorological Office Database, delivery no. 2022-09-16/GEJ01 **\- contact authors for a copy** | Parameters | Explanation | missing values | | ---------- | ----------- | -------------- | | AR | Year of observation | NA | | D | Wind direction (10 min average), degrees | NA | | DAGUR | Day of observation | NA | | F | Wind speed (10 min average), m/s | NA | | FG | Wind gust (maximum 3 secs value since last listing), m/s | NA | | FX | Maximum 10 min average wind speed, m/s | NA | | KLST | Hour of observation | NA | | MAN | Month of observation | NA | | P | Air pressure calculated down to sea level, hPa | NA | | RH | Humidity (1 min average),% | NA | | STOD | Station number | NA | | T | Air temperature (1 min average), °C | NA | | TIMI | Timestamp of observation | NA | | TN | Minimum temperature (lowest 1 min average value since last listing), °C | NA | | TX | Maximum temperature (maximum 1 min average since last listing), ° C | NA | * Grimsstadir\_XXAvg.txt * datafiles for average and monthly air temperatures at Grimsstaðir. Not included, but can be accessed through the below links. * [https://www.vedur.is/Medaltalstoflur-txt/Stod_495_Grimsstadir.ArsMedal.txt](https://www.vedur.is/Medaltalstoflur-txt/Stod_495_Grimsstadir.ArsMedal.txt) * [https://www.vedur.is/Medaltalstoflur-txt/Stod_495_Grimsstadir.ManMedal.txt](https://www.vedur.is/Medaltalstoflur-txt/Stod_495_Grimsstadir.ManMedal.txt) **Scripts** includes all relevant code * fit\_trends.R includes code to fit SSMs to assess linear trends over time and to assess the significance of these trends * plots.R includes code to make all figures * TemperatureComp.R includes code comparing temperature at Grimsstaðir and Mývatn (both air and water temperatures). * TVARSS\_18Jan23.R contains code for performing a state space model per Ives and Dakos (2012) * wing\_analysis.R contains code to fit SSMs to wing length using predictor variables and to assess their significance. * wing\_comparison.R contains code comparing wing lengths used in the paper from wing lengths used in Einarsson et al. (2002) for years where data overlap **Outputs** include all model outputs and bootstrapped results. * **Trends** contains all outputs from the models estimating linear trends (XX\_trends.RDS), p values from LRTs (trends\_pvals.csv) and a folder containing the outputs from each of the bootstrapped LRTs (**trends\_bootstrapped\_LRTs**) with a file for each model. * **Wing** contains all outputs from the full model relating wing length to z-scored predictors, p values from LRTs (wing\_pvals.csv) and folders containing the outputs from each of the bootstrapped LRTs etiher with either only temperature or including population data (population size and carbon stable isotopes; **NoFood** and **wing\_boostrapped\_LRTS**, respectively). ## External data sources Long term air temperature data come from the Grimsstaðir weather station, maintained by the Icelandic Meteorological Office. IMO also provided hourly air temperatures at Mývatn. * [https://www.vedur.is/Medaltalstoflur-txt/Stod_495_Grimsstadir.ArsMedal.txt](https://www.vedur.is/Medaltalstoflur-txt/Stod_495_Grimsstadir.ArsMedal.txt) * [https://www.vedur.is/Medaltalstoflur-txt/Stod_495_Grimsstadir.ManMedal.txt](https://www.vedur.is/Medaltalstoflurtxt/Stod_495_Grimsstadir.ManMedal.txt) * Icelandic Meteorological Office Database delivery no. 2022-09-16/GEJ01. Carbon stable isotopes come from McCormick et al. (2022). * https://doi.org/10.6084/m9.figshare.c.6197266.v1 For comparison, wing lengths from Einarsson et al. (2002) are included.