Learn R Programming

climwin (version 0.1.2)

climwin-package: Detect and visualise a climate window

Description

Contains a number of functions used to detect a period of climate sensitivity (climate window) for a given biological response, and visualise the detected climate window. The functions provided in climwin allow users to select meaningful time periods over which to investigate the impacts of climate, reducing the need to choose arbitrary climate windows (e.g. spring temperature, winter precipitation).

Arguments

Details

ll{ Package: climwin Type: Package Version: 0.0.1 License: GPL-2 } climwin contains a number of useful functions. The key functions are outlined below. climatewin is used to detect a climate window for a given biological response. Requires seperate climate and biologial datasets. randwin will randomise provided biological data and conduct a new climate window analysis. By comparing the climate window results of the randomised data and original data, users can determine if their climate window results could have occured by random chance. plotall will generate a number of useful plots to help visualise climate window results. These plots can be invaluable for identifying a 'true' climate window. For a complete list of functions see library(help = "climwin")

References

van de Pol & Cockburn 2011 Am Nat 177(5):698-707 (doi: 10.1086/659101) "Identifying the critical climatic time window that affects trait expression"

Examples

Run this code
# Test for a fixed climate window using the datasets 'Mass' and 'MassClimate'

# Load data##

 data(Mass)
 data(MassClimate)

# Test a fixed window, starting 20 May
# Test for climate windows between 100 and 0 days ago (furthest=100, closest=0)
# Fit a linear term for the mean climate (FUNC="L")
# Test at the resolution of days (CINTERVAL="D")

clim <- climatewin(Xvar = MassClimate$Temp, CDate = MassClimate$Date, 
                   BDate = Mass$Date,
                   baseline = lm(Mass$Mass ~ 1),
                   furthest = 100, closest = 0,
                   STAT = "mean", FUNC = "L",
                   FIXED = TRUE, cutoff.day = 20, cutoff.month = 5,
                   nrandom = 0, CMISSING = FALSE, CINTERVAL = "D")
         
# Randomise biological data and re-run climate window analysis

rand <- randwin(repeats = 2,
                Xvar = MassClimate$Temp, CDate = MassClimate$Date, BDate = Mass$Date,
                baseline = lm(Mass$Mass ~ 1), furthest = 100, closest = 0,
                STAT = "mean", FUNC = "L", FIXED = TRUE, cutoff.day = 20, cutoff.month = 5,
                CMISSING = FALSE, CINTERVAL = "D")
       
# Visualise climate window results

plotall(Dataset = clim[[3]], DatasetRand = rand,
        BestModel = clim[[1]], BestModelData = clim[[2]],
        CW1 = 0.95, CW2 = 0.5, CW3 = 0.25, HISTQ = 0.99)

Run the code above in your browser using DataLab