Learn R Programming

climwin (version 0.1.2)

plotbest: Visualise the best climate window

Description

Create a scatterplot showing the fit of the best climate window model through the biological data.

Usage

plotbest(dataset, bestmodel, bestmodeldata)

Arguments

dataset
A dataframe containing information on all fitted climate windows. Output from climatewin.
bestmodel
A model object. The strongest climate window model. Output from singlewin or climatewin.
bestmodeldata
A dataframe with the data used to fit the strongest climate window model. Output from singlewin or climatewin.

Value

  • Returns a scatterplot with a fitted line to show the fit of the best model through the data.

Examples

Run this code
# Visualise the best climate window from the datasets Mass and MassClimate

data(MassOutput)
data(Mass)
data(MassClimate)

single <- singlewin(xvar = list(Temp = MassClimate$Temp),
                   cdate = MassClimate$Date, bdate = Mass$Date,
                   baseline = lm(Mass ~ 1, data = Mass),
                   furthest = 72, closest = 15,
                   stat = "mean", func = "lin",
                   type = "fixed", cutoff.day = 20, cutoff.month = 5,
                   cmissing = FALSE, cinterval = "day")

plotbest(dataset = MassOutput, bestmodel = single$BestModel,
        bestmodeldata = single$BestModelData)

Run the code above in your browser using DataLab