knitr::opts_chunk$set(echo = TRUE)
sections_to_be_loaded <- c() source("vignettes/analysis_nonpublic.R")
Aim : create diagnostic plots of the models and compare.
The respective input datasets are loaded just before plotting.
Some of the diagnostic plots of the GDMs look very crappy. Does the %deviance explained correspond to the crappyness of the GDM model fit?
High % dev expl
efdist <- readRDS(paste(pathtodata, "/analysis/output_datasets/gdm_EFdistance_LUI_output.Rds", sep = "")) # efdist$explained # 29.99 cairo_pdf(paste("vignettes/out/gdm_EFdistance_LUI_GDM_diagnostic_plot.pdf", sep = ""), width = 11.7, height = 8.3) plot_diagn_gdm(efdist, title = "Efdistane") dev.off()
Saving diagnostic plot of each model to a separate pdf file.
efto0.5 <- readRDS(paste(pathtodata, "/analysis/output_datasets/gdm_EFturnover_0.5_LUI_output.Rds", sep = "")) efto0.5$explained # 12.19 plot_diagn_gdm(efto0.5)
# 9 plots EFturnover_varexpl <- list() for(i in seq(0.1, 0.9, 0.1)){ print(i) mod <- readRDS(paste(pathtodata, "/analysis/output_datasets/gdm_EFturnover_", i, "_LUI_output.Rds", sep = "")) EFturnover_varexpl <- append(EFturnover_varexpl, mod$explained) cairo_pdf(paste("vignettes/out/gdm_EFturnover_",i ,"_LUI_diagnostic_plot.pdf", sep = ""), width = 11.7, height = 8.3) plot_diagn_gdm(mod, title = paste("EFturnover", i)) dev.off() } # note : don't need to save variance explained as this is saved in script "summarise_GDM_results.Rmd" # EFturnover_varexpl
Saving diagnostic plot of each model to a separate pdf file.
# 9 plots EFnestedness_varexpl <- list() for(i in seq(0.1, 0.9, 0.1)){ print(i) mod <- readRDS(paste(pathtodata, "/analysis/output_datasets/gdm_EFnestedness_", i, "_LUI_output.Rds", sep = "")) EFnestedness_varexpl <- append(EFnestedness_varexpl, mod$explained) # plot and save cairo_pdf(paste("vignettes/out/gdm_EFnestedness_",i ,"_LUI_diagnostic_plot.pdf", sep = ""), width = 11.7, height = 8.3) plot_diagn_gdm(mod, title = paste("EFnestedness", i)) dev.off() } # note : don't need to save variance explained as this is saved in script "summarise_GDM_results.Rmd" # EFnestedness_varexpl
Saving all diagnostic plots of single function models to one pdf file
singleEF_varexpl <- list() cairo_pdf(paste("vignettes/out/gdm_ALL_singleEFmodels_LUI_diagnostic_plot.pdf", sep = ""), width = 11.7, height = 8.3, onefile=T) for(i in model_names[model_class == "singlefun", modelname]){ print(i) mod <- readRDS(paste(pathtodata, "/analysis/output_datasets/", i, "_output.Rds", sep = "")) singleEF_varexpl <- append(singleEF_varexpl, mod$explained) plot_diagn_gdm(mod, title = i) } names(singleEF_varexpl) <- model_names[model_class == "singlefun", modelname] dev.off() # note : don't need to save variance explained as this is saved in script "summarise_GDM_results.Rmd"
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.