plotcor {climwin}R Documentation

Visualise climate cross correlation or autocorrelation.

Description

Create a colour plot to visualise the results of autowin or crosswin. Displays correlation across all desired climate windows.

Usage

plotcor(cor.output, type, arrow = FALSE)

Arguments

cor.output

Output of autowin or crosswin

type

Should be either "A" for data generated by autowin or "C" for data generated by crosswin.

arrow

TRUE or FALSE. Add arrows to plots to pinpoint best window.

Value

Will generate a colour plot to visualise the correlation data.

Author(s)

Liam D. Bailey and Martijn van de Pol

Examples


#Simple test example
#Create data from a subset of our test dataset
#Just use two years
biol_data <- Mass[1:2, ]
clim_data <- MassClimate[grep(pattern = "1979|1986", x = MassClimate$Date), ]

single <- singlewin(xvar = list(Temp = clim_data$Temp),
                   cdate = clim_data$Date, 
                   bdate = biol_data$Date, 
                   baseline = lm(Mass ~ 1, data = biol_data),
                   range = c(1, 0), 
                   type = "relative", stat = "mean", 
                   func = c("lin"), cmissing = FALSE, cinterval = "day")
                   
auto <- autowin(reference = single,
                xvar  = list(Temp = clim_data$Temp),
                cdate = clim_data$Date, bdate = biol_data$Date,
                baseline = lm(Mass ~ 1, data = biol_data), range = c(1, 0), 
                stat = "mean", func = "lin", 
                type = "relative",
                cmissing = FALSE, cinterval = "day")
                
plotcor(auto, type = "A")

## Not run: 
# Full working example
# Visualise climate autocorrelation

data(Mass)
data(MassClimate)

# Fit a single climate window using the datasets Mass and MassClimate.

single <- singlewin(xvar = list(Temp = MassClimate$Temp), 
                   cdate = MassClimate$Date, bdate = Mass$Date,
                   baseline = lm(Mass ~ 1, data = Mass), 
                   range = c(72, 15),
                   stat = "mean", func = "lin",
                   type = "absolute", refday = c(20, 5),
                   cmissing = FALSE, cinterval = "day")            

# Test the autocorrelation between the climate in this single window and other climate windows.

auto <- autowin(reference = single,
               xvar  = list(Temp = MassClimate$Temp), 
               cdate = MassClimate$Date, bdate = Mass$Date,
               baseline = lm(Mass ~ 1, data = Mass), 
               range = c(365, 0), 
               stat = "mean", func = "lin",
               type = "absolute", refday = c(20, 5),
               cmissing = FALSE, cinterval = "day")
                
# Plot the auto-correlation data

plotcor(auto, type = "A")

## End(Not run)

[Package climwin version 1.2.3 Index]