# NOT RUN {
#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")
# }
# NOT RUN {
# Full working example
# Fit a known climate window to the datasets Mass and MassClimate
data(Mass)
data(MassClimate)
# Test for a fixed climate window, starting from 20th May
# Fit a climate window starting 72 days ago and ending 15 days ago
# Fit a linear term for the mean climate
# Fit climate windows at the resolution of days
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")
##View data##
single$BestModel
head(single$BestModelData)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab