DOI: 10.5061/dryad.hqbzkh1kv
title: Data from: Photoperiod and rainfall are associated with seasonal shifts in social structure in a songbird

description: Seasonally breeding animals often exhibit different social structures
 during non-breeding and breeding periods that coincide with seasonal
 environmental variation. Therefore, ongoing climate change may play an
 important role in determining the future structure of animal societies,
 especially if climate determines when seasonal shifts in social structure
 occur. However, we know little about the environmental cues that determine
 the timing of seasonal shifts in social structure, a lack of knowledge
 that contrasts with our well-defined knowledge of the environmental cues
 that trigger a shift to breeding physiology in seasonally breeding
 species. Here we tested whether the environmental cues that drive seasonal
 shifts in social structure are similar to those that determine timing of
 breeding in the red-backed fairywren (Malurus melanocephalus), an
 Australian songbird. Social network analyses revealed that social groups,
 which are highly territorial during the breeding season, interact in
 social “communities” on larger ranges during the non-breeding season.
 Interactions among non-breeding groups were related to rainfall, with more
 rainfall leading to reductions in home range size and fewer interactions
 among non-breeding social groups. Similarly, onset of breeding was also
 determined by rainfall during the non-breeding season, with greater
 rainfall leading to earlier breeding. These findings reveal that for some
 species, the cues that determine the timing of shifts in social structure
 across seasonal boundaries can be similar to those that determine timing
 of breeding. This study increases our understanding of how social
 structure and the selection pressures that result from different social
 structures might respond to changing climates.
description: See README file for descriptions of each dataset and summaries of
 each R script. See annotated R code for instructions on how to run the
 analyses. All analyses were conducted in R version 3.5.2 unless otherwise
 specified. 
description: # Data from: Photoperiod and rainfall are associated with seasonal shifts
 in social structure in a songbird Publication: Behavioral Ecology File
 preparation date: 5 November 2022 Authors: Joseph F. Welklin, Samantha M.
 Lantz, Sarah Khalil, Nicole M. Moody, Jordan Karubian, Michael S. Webster
 Contact Joseph Welklin at [jwelklin@gmail.com](mailto:jwelklin@gmail.com)
 with questions ## Summary of data and code This paper included tests of
 many different questions and many of our datasets used to answer these
 questions did not overlap. Therefore, we typically used different R
 scripts to answer each question or set of questions. The data for these
 scripts are included in two folders. The Input files folder contains
 mostly raw data from a database and data collected in the field. The
 Output files folder contains processed data files created using the
 attached scripts and the raw data files. These output files were used in
 further analyses. Scripts can be run by first loading the R-project file
 in RStudio, then opening each of the script files. Scripts should run
 without setting a working directory if all files are left in their current
 folders thanks to the here package in R. See below for descriptions of
 each script and each data file. ## List of R scripts # Script:
 Networks_Dedrograms_Groups_Communities 2_pub.R ``` Summary: Use this
 script to identify social groups and social communities within the network
 data for all four years where we have social network data. ``` # Script:
 Robustness and Randomizations_pub.R ``` Summary: Use this script to test
 whether the observed group and community structure is more structured than
 expected by random chance. ``` # Script: Relatedness in Non-breeding
 Networks_pub.R ``` Summary: Use this script to test whether genetic
 relatedness within groups and communities is different from chance ``` #
 Script: Assortment of groups across seasons 4_pub.R ``` Summary: Use this
 script to test whether past breeding group members and upcoming breeding
 group members are also assorted (strongly connected) during the
 non-breeding season. Also can see which social relationships from breeding
 (Father-son, breeding pair, etc) explain non-breeding season group
 membership. ``` # Script: Home Ranges 3 (AKDE)_pub.R ``` Summary: Use this
 script to measure changes in home range size over the non-breeding season
 ``` # Script: Groups per Observation dataframe v2_pub.R ``` Summary: Use
 this script to build the groups-by-observation dataframe that is used to
 model climate effects on interactions among social groups. This script
 builds from Networks_Dedrograms_Groups_Communities 2_pub.R ``` # Script:
 Climwin and Models 7_pub.R ``` Summary: Use this script to test whether
 climate factors influence the number of groups per observation ``` #
 Script: Climwin Breeding Start 2_pub.R ``` Summary: Use this script to
 test whether climate factors influence timing of initiation of breeding
 across years ``` # Script: Rainfall predict NDVI script_pub.R ``` Summary:
 Use this script to test whether rainfall predicts NDVI at our field site
 ``` # Scripts in 'Cluster Scripts folder' - described below ```
 Summary: These scripts were used to conduct randomization tests for the
 sliding window analyses and home range analyses included in the paper.
 These scripts were run on machines with multiple cores at the Cornell
 BioHPC computing cluster to greatly decrease run time. The scripts and
 data files were placed in the same folder so setting the working directory
 was not necessary. Scripts were run from linux coding on computing cluster
 machines. ``` # Cluster Script: Cluster_akde_randXX.R ``` Summary: XX
 stands in for the year 2016-2019. Use these scripts to run the
 randomizations for the home range size permutations comparing whether home
 range size varied over the non-breeding season. ``` # Cluster Script:
 Cluster_CLIMATE_WINDOW_rand_custom.R ``` Summary: One script for each
 climate variable looked at in the sliding window analysis testing whether
 associations among non-breeding groups were associated with climate
 variation within years. These are the randomizations used to test whether
 the observed climate windows were false positives. ``` # Cluster Script:
 Cluster_breeding_CLIMATE_WINDOW_rand_lin_k.R ``` Summary: One script for
 each climate variable looked at in the sliding window analysis testing
 whether initiation of breeding across years was associated with climate
 variables. These are the randomizations used to test whether the observed
 climate windows were false positives. ``` ## Input files folder -
 descriptions of data files: NOTE all year numbers in file names and in
 data files refer to the field season year which is the year the breeding
 season ended in. Breeding seasons ended in January/February so most data
 collection during the 2015 field season occurred in 2014. Dates in files
 refer to exact dates. RBFW = Red-backed Fairywren. NA values represent
 missing data that was not able to be collected. # Data file:
 agesexstatusxx.csv ``` Summary: Ages and sexes of RBFWs during the 2016,
 2017, 2018, 2019 field seasons. All files are in a similar structure.
 Column descriptions: Bird Color bands on birds this ID can change across
 years if color bands break/need replaced. Sex Male (M) or Female (F)
 Current.Age Age in years of bird in field season year (in file name).
 Age.Exact. Is the exact age known? min=exact age not known, at least this
 age but may be older. exact=exact age known. FWNo Numeric ID unique to
 each individual Red-backed Fairywren. This number never changes.
 Year.variable - Not important, left over from database structure.
 PrevBreedingYear - Previous field season. Status.variable - Not important,
 left over from database structure. PrevBreedingStatus - Individual's
 breeding status in previous breeding season. BF = breeding female, BM =
 breeding male, AHELP = helper, UNK = unknown, HY = hatch year class -
 Previous breeding class based on PrevBreedingStatus ``` # Data file: All
 Non-breeding GPS YEAR.csv ``` Summary: GPS waypoints from 2016 - 2019
 non-breeding seasons Column descriptions: Waypoint - GPS waypoint ID lat -
 latitude lon - longitude ``` # Data file: birdXX.csv ``` Summary: Raw data
 for network observations for 2016 - 2019 non-breeding seasons in an
 individuals list format. Used to create group-by-individual matrices. XX
 stands in for year 16-19 ID. Column descriptons: Sighting - Unique
 sampling point ID number. Sampling points were collected approximately
 every 5 minutes and each bird present was recorded. Observation - Unique
 observation ID number. Observations are groups of sampling points, usually
 ranging from 15 to 60 minutes in length with sampling points collected
 every 5 minutes. Initials - Observer ID Date - Collection date - actual
 date Time - Collection time Number - Number of birds present at
 sighting/sampling point, estimated by observer, may be larger than number
 of individual IDs recorded. WP - waypoint associated with where the
 sampling point was collected. Bird - Bird's color bands. Kerfuffle -
 did the association in the sighting/sampling point occur within 8 minutes
 of a courtship or aggressive event involving some of the birds in the
 sampling point? Y = yes, N = no. ``` # Data file: birdsXX_banded_unks.csv
 ``` Summary: Further information on number of birds and number of unknown
 individuals in each sampling point in birdXX.csv files. XX stands in for
 year 16-19 ID. Column descriptions: Sighting - Unique sampling point ID
 number. Sampling points were collected approximately every 5 minutes and
 each bird present was recorded. Observation - Unique observation ID
 number. Observations are groups of sampling points, usually ranging from
 15 to 60 minutes in length with sampling points collected every 5 minutes.
 Banded - number of banded birds in the sighting/sampling point. Unknowns -
 number of unknown birds in the sighting/sampling point - means they were
 probably banded but the observer was not able to identify their color
 bands to get an ID. ``` # Data file:
 RelatednessEstimates_8xdenovo80_14to19.csv ``` Summary: Genetic
 relatedness data for each possible pair of birds active from the 2014-2019
 seasons. Column descriptions: Pair - Unique ID number for each pair
 comparison. ind1 - individual 1 in the comparison ind2 - individual 2 in
 the comparison wang - Wang 2002 estimator of genetic relatedness -
 typically ranges from 0 (not related at all) to 1 (same individual)
 Siblings should be around 0.5, half-sibs around 0.25. Relatedness
 estimates are slightly lower than expected becuase few individuals were
 able to genotyped at every single SNP loci. See supplemental methods for a
 validation of this method using known mother-offspring pairs. ``` # Data
 file: RemovalorControl 2017.csv ``` Summary: Record of whether each bird
 belonged to a removal or control community in the 2017 non-breeding
 season. See supplemental methods for more information on this experiment.
 Column descriptions: Bird - Color bands of each bird active in 2017
 Community - "Neighborhood" bird was present in. Not defined via
 social network analysis. For individuals with a value of "X" in
 this column, it means they were not part of any of these communities.
 TreatmentGroup - Whether the neighborhood was a control or removal
 treatment. For individuals with a value of "X" in this column,
 it means they were not part of any of these treatment groups. ``` # Data
 file: Upcoming_statusXX.csv ``` Summary: Breeding statuses for each bird
 in the upcoming breeding season - breeding season following each
 non-breeding season. XX stands in for year 16-19 ID. Column descriptions:
 Year - Non-breeding season and breeding season year. 2016 non-breeding
 season (Feb-July/Aug) leads into Aug-Jan breeding season. Date.Created -
 date the breeding group was created - used each individual's first
 breeding group in a year. Group.Number - unique breeding group ID Bird -
 bird's color bands Status - bird's first breeding status in a
 breeding season. ``` ## Output files folder - list of which scripts that
 created each data file in the Output Files folder: \#NOTE: Refer to script
 and input files that created it for descriptions of each column in the
 data. Some of these files like the climate files were created in scripts
 not included on Dryad. Their creation scripts just filtered for relevant
 dates or combined data from different measurement sites. NA values
 represent missing data that was not able to be collected. # Data file:
 akde_randXX.csv ``` Summary: Randomization results for home range
 analyses. XX stands in for year 16-19 ID. Script where created:
 Cluster_akde_randXX.R XX stands in for year 16-19 ID. Column descriptions:
 X1.2 - Difference in home rage size between period 1 and period 2 from
 randomizations X1.3 - Difference in home range size between period 1 and
 period 3 from randomizations X2.3 - Difference in home range size between
 period 2 and period 3 from randomizations ``` # Data file:
 AverageSilhouetteWidths.csv ``` Summary: Saved average silhouette widths
 for each season's network. Script where created:
 Networks_Dedrograms_Groups_Communities 2_pub.R Column descriptions: year -
 Year of study avg.s - Average silhoutte width ``` # Data file:
 birdlistXXnoKsub.csv ``` Summary: List of birds in each year's
 network. XX stands in for year 16-19 ID. Script where created:
 Networks_Dedrograms_Groups_Communities 2_pub.R Column descriptions: Bird -
 Bird ID SightFreq - Number of times the bird was seen degXXnoK - Network
 degree ``` # Data file: birdlistXXnoKsubc.csv ``` Summary: List of birds
 in each year's network that were also assigned to social communities.
 XX stands in for year 16-19 ID. Script where created:
 Networks_Dedrograms_Groups_Communities 2_pub.R Column descriptions: Bird -
 Bird ID Social.Group - Bird's social group defined via dendrograms
 SightFreq - Number of times the bird was seen degxxnoK - Network degree
 Community - Network community Sex - Bird's sex (male/female)
 Current.Age - Bird's age in that season Age.Exact - Is the exact age
 known? min=exact age not known, at least this age but may be older.
 exact=exact age known. FWnumber - Numeric ID unique to each individual
 Red-backed Fairywren. This number never changes. Year.variable - Leftover
 from database PrevBreedingYear - Previous breeding season ID
 Status.variable - Leftover from database PrevBreedingStatus - Bird's
 breeding status in previous breeding season class - Bird's
 non-breeding social class ``` # Data file: birdlistXXnoKsubcb.csv ```
 Summary: List of birds in each year's network that were also assigned
 to social communities with previous and upcoming breeding group info. XX
 stands in for year 16-19 ID. Script where created:
 Networks_Dedrograms_Groups_Communities 2_pub.R Column descriptions: Bird -
 Bird ID Social.Group - Bird's social group defined via dendrograms
 SightFreq - Number of times the bird was seen degxxnoK - Network degree
 Community - Network community Sex - Bird's sex (male/female)
 Current.Age - Bird's age in that season Age.Exact - Is the exact age
 known? min=exact age not known, at least this age but may be older.
 exact=exact age known. FWnumber - Numeric ID unique to each individual
 Red-backed Fairywren. This number never changes. Year.variable - Leftover
 from database PrevBreedingYear - Previous breeding season ID
 Status.variable - Leftover from database PrevBreedingStatus - Bird's
 breeding status in previous breeding season class - Bird's
 non-breeding social class PrevBrGrp - Bird's previous breeding group
 ID UpcomingBrGrp - Bird's upcoming season breeding group ID ``` #
 Data file: communitiesXX.csv ``` Summary: Community membership of
 non-breeding groups in each season. XX stands in for year 16-19 ID. Script
 where created: Networks_Dedrograms_Groups_Communities 2_pub.R Column
 descriptions: Group - Social Group ID Community - Social community ID ```
 # Data file: firstegg_final.csv ``` Summary: First egg date data used in
 initiation of breeding analyses Column descriptions: GroupId - Breeding
 group ID Year - Field season year Nest - Nest ID Date.found - Date nest
 was found First.egg.date - Date of first egg First.egg.date.known -
 whether first egg date was "Known" (seen as 1 egg) or
 "Estimated" (backdated) Clutch.comp.date - date clutch completed
 (last egg laid) Clutch.comp.date.known - whether clutch completion date
 was known or estimated Female.fwno - Female ID, unlike color bands this
 cannot change across years Male.fwno - Male ID, unlike color bands this
 cannot change across years Female.Age - Female's age First.egg.jdate
 - Julian date of first egg (day of year) Paired.prev - Whether the pair
 was paired in the previous year Helpers - Number of helpers in the
 breeding group ``` # Data file: gbiXX.csv ``` Summary: Group by individual
 matrix for non-breeding season network. XX stands in for year 16-19 ID.
 Script where created: Networks_Dedrograms_Groups_Communities 2_pub.R
 Column descriptions: -Each column is an individual bird and each row
 represents a sampling point showing whether a bird was recorded in that
 sampling point (1) or not (0) ``` # Data file: gbiXXnoK.csv ``` Summary:
 Group by individual matrix for non-breeding season network with kerfuffle
 interactions not included. XX stands in for year 16-19 ID. Script where
 created: Networks_Dedrograms_Groups_Communities 2_pub.R Column
 descriptions: -Each column is an individual bird and each row represents a
 sampling point showing whether a bird was recorded in that sampling point
 (1) or not (0) ``` # Data file: gbssubmaxall.csv ``` Summary: Groups by
 observation data file used to test whether climate was associated with
 interactions among non-breeding groups. Script where created: Groups per
 Observation dataframe v2_pub.R Column descriptions: -Sighting - Unique
 sampling point ID -Observation - Observation ID -Number - Number of birds
 -Date - Collection date -Social.Groups.Total - Number of social groups
 present -Focal.Sightings - Number of sampling points the focal social
 group was seen in during the observation -Social.Group.Size - Size of the
 focal social group (number of birds) -Groups.in.Community - Number of
 groups in the focal social group's community -WP - GPS waypoint ID
 -Year - Study season -Focal.Group.Year - Combination of focal group ID and
 Year variable -Community.Year - Combination of focal group community ID
 and Year variable -jdate - Julian date - day of year ``` # Data file:
 groupXX.csv ``` Summary: List of what social group each bird was in. XX
 stands in for year 16-19 ID. Script where created:
 Networks_Dedrograms_Groups_Communities 2_pub.R Column descriptions: Bird -
 Bird ID Social.Group - Social group ID for that bird ``` # Data file:
 Landsat 8 NDVI yearly polygons noclouds.csv ``` Summary: Landsat 8 NDVI
 scores for the area of our fieldsite covered by RBFW territories. Column
 descriptions: Date - NDVI collection date NDVI - Normalized difference
 vegetation index score Year - Field season year ``` # Data file:
 Landsat7_all_years.csv ``` Summary: Landsat 7 NDVI scores for the area of
 our fieldsite covered by RBFW territories. Column descriptions: Date.n -
 Date as numeric in R. NDVI - Normalized difference vegetation index score
 Date - Collection date ``` # Data file: maxtemp_1994-2020.csv ``` Summary:
 Maximum temperature data from the Brisbane airport Column descriptions:
 Date - Collection date maxtemp - Maximum temperature in Celsius jdate -
 Julian date of Date (day of year) Year - Field season year ``` # Data
 file: maxtempallyears.csv ``` Summary: Maximum temperature data from the
 Brisbane airport Column descriptions: Date - Collection date Max.Temp -
 Maximum temperature in Celsius jDate - Julian date of Date (day of year)
 Year - Field season year ``` # Data file: mintemp_1994-2020.csv ```
 Summary: Minimum temperature data from the Brisbane Airport Column
 descriptions: Date - Collection date mintemp - Maximum temperature in
 Celsius jdate - Julian date of Date (day of year) Year - Field season year
 ``` # Data file: mintempallyears.csv ``` Summary: Minimum temperature data
 from the Brisbane airport Column descriptions: Date - Collection date
 Min.Temp - Maximum temperature in Celsius jDate - Julian date of Date (day
 of year) Year - Field season year ``` # Data file: modularity_scores.csv
 ``` Summary: Average modularity scores of social communities for each
 field season. Script where created: Networks_Dedrograms_Groups_Communities
 2_pub.R Column descriptions: year - Study year modularity - Average
 modularity score for that year ``` # Data file: rain_2004-2018.csv ```
 Summary: Rainfall data from three sites near our field site. Column
 descriptions: Date - Collection date Rainfall.amount..millimetres..x -
 Rainfall in mm for the first site Rainfall.amount..millimetres..y -
 Rainfall in mm for the second site Rainfall.amount..millimetres. -
 Rainfall in mm for the third site amount - Average amount of all three
 sites jDate - Julian Date of collection date (day of year) cumulative -
 Cumulative rainfall for each year Year - Field season year amountcm -
 "amount" column in cm ``` # Data file: rainallyears.csv ```
 Summary: Rainfall data from three sites near our field site. Column
 descriptions: Date - Collection date Rainfall.amount..millimetres..x -
 Rainfall in mm for the first site Rainfall.amount..millimetres..y -
 Rainfall in mm for the second site Rainfall.amount..millimetres. -
 Rainfall in mm for the third site amount - Average amount of all three
 sites jDate - Julian Date of collection date (day of year) cumulative -
 Cumulative rainfall for each year Year - Field season year amountcm -
 "amount" column in cm ``` # Data file: rnetXX.csv ``` Summary:
 Reduced network for each year - network of social groups Script where
 created: Networks_Dedrograms_Groups_Communities 2_pub.R Column
 descriptions: Network matrix of reduced network. Each row and column ID
 represents a social group. ``` # Data file: windallyears.csv ``` Summary:
 Wind data for our field site Column descriptions: Date - Collection date
 Windspeed - Average daily windspeed in m/s for our field site. ``` # Data
 files in 'Climwin model outputs' folder - described below ```
 Summary: Outputs from Sliding window analyses ``` # Data file:
 EncM_mean_CLIMATE_WINDOW.rds ``` Summary: Outputs from social group
 association sliding window climate models Script where created: Climwin
 and Models 7_pub.R ``` # Data file: FE_CLIMATE_WINDOW.rds ``` Summary:
 Outputs from first egg date (breeding initiation) sliding window climate
 models. Script where created: Climwin Breeding Start 2_pub.R ``` # Data
 file: rain_predicts_NDVI_season.rds ``` Summary: Output from sliding
 window analysis testing if rainfall predicts NDVI Script where created:
 Rainfall predict NDVI script_pub.R ``` # Data files in 'Climwin
 randomizations' folder ``` Summary: Outputs from sliding window
 randomization analyses ``` # Data file:
 Breeding_CLIMATE_WINDOW_randomizations.csv ``` Summary: Outputs from
 breeding initiation randomization analyses run on cluster. Scripts where
 created: Scripts in 'Cluster scripts' folder Column
 descriptions: deltaAICc - Change in AICc value from null model Open -
 Window open day Close - Window close day ModelBeta - Coefficient of
 climate variable from the top model in each randomization ``` # Data file:
 CLIMATE_WINDOW_randomizations.csv ``` Summary: Outputs from non-breeding
 social group associations sliding window climate randomizations. Scripts
 where created: Scripts in 'Cluster scripts' folder Column
 descriptions: deltaAICc - Change in AICc value from null model Open -
 Window open day Close - Window close day ``` # Data files in
 'Homerange output files' folder ``` Summary: These are outputs
 from different parts of the home range analysis process. These analyses
 took a long time to run so I saved the data at different intervals to
 speed up re-analysis. ``` # Data file: akdeXX_list_#.rds ``` Summary:
 Auto-correlated-kernel-density estimates for each year. XX stands in for
 year 16-19 ID. # stands in for period of the non-breeding season (1-3).
 Script where created: Home Ranges 3 (AKDE)_pub.R ``` # Data file:
 akdeXX.rand.#obs.rds ``` Summary: Outputs of randomziations used to test
 whether 5, 7, 10, or 15 observations were required to get a good estimate
 of an individual's home range size. XX stands in for year 16-19 ID. #
 stands in for the number of observations (5,7,10,15). Script where
 created: Home Ranges 3 (AKDE)_pub.R ``` # Data file:
 birdXX_gps15_list_#L.csv ``` Summary: List of birds in each period for
 each season. XX stands in for year 16-19 ID. # stands in for period of the
 non-breeding season (1-3). Script where created: Home Ranges 3
 (AKDE)_pub.R Column descriptions: individual.local.identifier - Individual
 ID n - number of GPS points for that individual ``` # Data file:
 birdXX_gps15.csv ``` Summary: Processed GPS data for each season - used in
 randomization scripts for home range analyses. XX stands in for year 16-19
 ID. Script where created: Home Ranges 3 (AKDE)_pub.R Column descriptions:
 WP2 - GPS waypoint ID Sighting - Sampling point ID Observation -
 Observation ID Inititals - Observer's initials Date - Date Time -
 Time sample collected Number - Number of birds present WP - Waypoint ID
 without the initials inidividual.local.identifier - Individual ID
 Kerfuffle - Was the sampling point associated with courtship or
 aggression? location.lat - Latitude of gps point location.long - Longitude
 of gps point Time2 - a second time variable timestamp - full timestamp
 with date jdate - julian date (day of year) ``` # Data file:
 birdlistXXakde15_#.csv ``` Summary: Summarized home range data for each
 period for each season. XX stands in for year 16-19 ID. # stands in for
 period of the non-breeding season (1-3). Column descriptions: Bird - Bird
 ID Social.Group - Bird's social group defined via dendrograms
 SightFreq - Number of times the bird was seen degxxnoK - Network degree
 Community - Network community Sex - Bird's sex (male/female)
 Current.Age - Bird's age in that season Age.Exact - Is the exact age
 known? min=exact age not known, at least this age but may be older.
 exact=exact age known. FWnumber - Numeric ID unique to each individual
 Red-backed Fairywren. This number never changes. Year.variable - Leftover
 from database PrevBreedingYear - Previous breeding season ID
 Status.variable - Leftover from database PrevBreedingStatus - Bird's
 breeding status in previous breeding season class - Bird's
 non-breeding social class akde - Home range size in hectares obs - Number
 of observations the bird was in WPfreq - number of GPS waypoints the bird
 was in akde.period - Home range size in hectares for the analysis period
 period - Home range comparison period (1-3) ``` ## Sharing/access
 Information Links to other publicly accessible locations of the data: Data
 only on Dryad Was data derived from another source? No