# \donttest{
data("datacerardat")
resultat = cerardat(df = datacerardat$df,
row.sup = datacerardat$row.sup,
date = datacerardat$date,
nf = NULL,
confidence = 0.95,
graph = TRUE
)
resultat
#The Shapiro-Wilks test is used to verify the normality of the residuals.
#The Durbin-Watson test checks for first order autocorrelation.
#The Breusch-Pagan test checks for heteroscedasticity.
#See the first plot
plot(resultat, which = 1)
#We can add the date (when there is one) and the dateEv and dateAc
abline(v=resultat$prediction$date[1], col="grey40", lty=1)
abline(v=resultat$prediction$Fit_dateEv[1], col="red", lty=2)
abline(v=resultat$prediction$Median_dateAc[1], col="black", lty=3)
legend("topright",
legend=c("Date", "DateEv", "DateAc"),
col=c("grey40", "red", "black"),
lty=c(1, 2, 3)
)
#You can also create a plot with multiple context (which can be index/integer or rownames)
arrangePlot(resultat,
which = c("Z067", "Z070", "Z074"),
main = "Site: Neuvy-Le-Roi.",
xlim = c(300, 1300),
date = resultat$prediction[c("Z067","Z070","Z074"),]$Fit_dateEv,
col_date = c("red", rgb(0.20, 0.40, 0.30), 4)
)
##See the first 10 plots
#plot(resultat, which = 1:10)
#arrange the first 10 plots (with date we can add a grid)
arrangePlot(resultat,
which = 1:10,
col1 = rgb(0.7, 0.7, 0.7, 0.6), # the last arg of rgb is alpha for opacity
col2 = "black",
xlim = c(200, 1000), # limit of the x axis between 200 and 1000
date = seq(250, 950, 50), # add one line every 50 years between 250 and 950
col_date = "grey80",
lty_date = 3, # dotted line
bty = 'n', # remove box
cex.axis = 0.8 # control axis text size (only y axis is impacted in arrangePlot)
)
##See all the plots
#plot(resultat)
##You can extract the plots and find them in the directory :
#paste0(getwd(),"/figures")
##With the 'extract_results' function
#extract_results(resultat, width=480, height=480, path="figures")
# }
Run the code above in your browser using DataLab