Ecosystem size is a key factor driving biodiversity and ecosystem function. Larger ecosystems contain more species and can be hubs of dispersal and resource flows in networks of multiple ecosystems. However, whether and how ecosystem size and resource flows interact to affect biodiversity and ecosystem function has been largely overlooked. Here, we investigated how ecosystem size asymmetry affects biodiversity and function of two-ecosystem meta-ecosystems connected through flows of non-living resources. We conducted microcosm experiments, mimicking resource flows between ecosystems of different sizes, yet otherwise being identical. We found that meta-ecosystems with asymmetric ecosystem sizes had higher β-diversity but lower α-diversity and ecosystem function (total biomass) than their unconnected counterparts, while such an effect was not found for meta-ecosystems of identical ecosystem sizes. Our work demonstrates of how cross-ecosystem dynamics modulated by differences in ecosystem sizes affect biodiversity and function, with a direct implication for conservation and management of connected ecosystems.
# --- SET UP R MARKDOWN AND GENERAL CODING RUNNING PARAMETERS --- #
set.seed(420)
start_time = Sys.time()
knitr::opts_chunk$set(message = FALSE,
cache = FALSE,
autodep = FALSE)
recompute_lengthy_analyses = TRUE
plot_model_residuals_metaecos = FALSE
# --- SET UP PARAMETERS RELATED TO RESOURCE FLOWS --- #
disturbance_levels = c("low", "high")
n_disturbance_levels = length(disturbance_levels)
resource_flow_days = c(5, 9, 13, 17, 21, 25)
first_resource_flow = resource_flow_days[1]
# --- SET UP SAMPLING PARAMETERS --- #
total_frames = 125
volume_recorded_μl = 34.4
time_points = 0:7
time_points_without_t0 = 1:7
time_point_names = c("t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7")
sampling_days = c(0, 4, 8, 12, 16, 20, 24, 28)
first_time_point = 0
last_time_point = length(sampling_days) - 1
n_time_points = last_time_point + 1
nr_videos = c(12, 1, 1, 1, 1, 1, 2, 2) #Videos taken for each time point for each culture. At t0 we took 12 videos of the large bottle from which we started the cultures. Write why 2 at the end.
videos_taken = data.frame(time_point = 0 : 7,
nr_videos = c(12, 1, 1, 1, 1, 1, 2, 2))
n_videos_taken_t0 = nr_videos[1]
time_point_day = data.frame(time_point = first_time_point:last_time_point,
day = sampling_days,
video_replicates = nr_videos)
videos_to_take_off = data.frame(ecosystem_ID = NA,
time_point = NA,
file = NA) %>%
add_row(ecosystem_ID = 137-110,
time_point = 7,
file = 137) %>%
slice(-1)
n_cultures = 110
total_number_of_video_rows = sum(nr_videos * n_cultures)
# --- SET UP PROTIST PARAMETERS --- #
protist_species = c("Ble", "Cep", "Col", "Eug", "Eup", "Lox", "Pau", "Pca", "Spi", "Spi_te", "Tet")
protist_species_indiv_per_volume = paste0(protist_species, "_indiv_per_volume")
protist_species_indiv_per_ml = paste0(protist_species, "_indiv_per_ml")
protist_species_dominance = paste0(protist_species_indiv_per_ml, "_dominance")
protist_species_total = paste0(protist_species, "_tot_indiv")
n_protist_species = length(protist_species)
first_protist = protist_species[1]
last_protist = protist_species[n_protist_species]
species_IDD_with_13_threshold = c("Col", "Eug", "Eup", "Lox", "Pau", "Pca", "Spi_te", "Tet")
species_IDD_with_13_threshold_indiv_per_volume = paste0(species_IDD_with_13_threshold, "_indiv_per_volume")
species_IDD_with_40_threshold = c("Ble", "Cep", "Spi")
species_IDD_with_40_threshold_indiv_per_volume = paste0(species_IDD_with_40_threshold, "_indiv_per_volume")
# --- SET UP ECOSYSTEM PARAMETERS --- #
ecosystems_to_take_off = 60 #Culture ID = 60 as it was spilled (small unconnected, high disturbance, system nr = 40)
ecosystems_info = read.csv(here("..",
"1_data",
"ecosystems_info.csv"),
header = TRUE) %>%
rename(ecosystem_ID = culture_ID)
columns_ecosystems = c("time_point",
"day",
"ecosystem_ID",
"system_nr",
"disturbance",
"ecosystem_type",
"connection",
"ecosystem_size",
"ecosystem_size_ml",
"metaecosystem",
"metaecosystem_type")
columns_treatments = columns_ecosystems[!columns_ecosystems %in% c("system_nr", "ecosystem_ID")]
variables_ecosystems = c("bioarea_mm2_per_ml",
"bioarea_tot_mm2",
"indiv_per_ml",
"indiv_tot",
"species_richness",
"shannon",
"simpson",
"inv_simpson",
"evenness_pielou",
"median_body_area_µm2",
paste0(protist_species, "_indiv_per_ml"),
paste0(protist_species, "_tot_indiv"),
paste0(protist_species_indiv_per_ml, "_dominance"))
baseline_columns = paste0("baseline_", variables_ecosystems)
ecosystem_types_ordered = c("Small connected to large",
"Small connected to small",
"Small unconnected",
"Medium connected to medium",
"Medium unconnected",
"Large connected to small",
"Large connected to large",
"Large unconnected")
treatments_and_controls = data.frame(treatment = c("Small connected to small",
"Small connected to large",
"Medium connected to medium",
"Large connected to large",
"Large connected to small"),
control = c("Small unconnected",
"Small unconnected",
"Medium unconnected",
"Large unconnected",
"Large unconnected"))
n_treatments = length(unique(treatments_and_controls$treatment))
n_controls = length(unique(treatments_and_controls$control))
n_replicates = 5
n_ecosystem_types = 8
# --- SET UP SIZE CLASSES PARAMETERS --- #
n_size_classes = 12
columns_classes = c(columns_ecosystems,
"size_class_n",
"mean_class_area_µm2")
# --- SET UP META-ECOSYSTEM PARAMETERS --- #
metaecosystems_to_take_off = ecosystems_info %>%
filter(ecosystem_ID %in% ecosystems_to_take_off) %>%
pull(system_nr) %>%
unique
system_nr_metaecosystems = ecosystems_info %>%
filter(metaecosystem == "yes") %>%
pull(system_nr) %>%
unique
n_metaecosystems = length(system_nr_metaecosystems)
variables_metaecos = c("total_metaecosystem_bioarea_mm2",
"jaccard_index",
"bray_curtis",
"beta_spatial_turnover",
"beta_nestedness",
"beta_total",
"metaecosystem_richness")
metaecosystem_types_ordered = c("Small-Small meta-ecosystem",
"Medium-Medium meta-ecosystem",
"Medium-Medium unconnected",
"Large-Large meta-ecosystem",
"Small-Large meta-ecosystem",
"Small-Large unconnected")
metaecosystem_type_selected = c("Medium-Medium",
"Small-Large")
Name of the axes per response variable.
# --- SET UP AXES LABELS PARAMETERS --- #
axis_names = data.frame(variable = NA,
axis_name= NA) %>%
add_row(variable = "day", axis_name = "Time (day)") %>%
add_row(variable = "ecosystem_size_ml", axis_name = "Patch size (ml)") %>%
add_row(variable = "log_size_class", axis_name = "Log size (μm2)") %>%
add_row(variable = "class_indiv_per_µl", axis_name = "Density (ind/ml)") %>%
add_row(variable = "bioarea_mm2_per_ml", axis_name = "Biomass (mm2/ml)") %>%
add_row(variable = "sqrt_bioarea_mm2_per_ml", axis_name = "Sqrt Biomass (mm2/ml)") %>%
add_row(variable = "bioarea_mm2_per_ml_d", axis_name = "Bioamass ES") %>%
add_row(variable = "bioarea_tot", axis_name = "Total Biomass (mm2)") %>%
add_row(variable = "total_metaecosystem_bioarea_mm2", axis_name = "Total Biomass (mm2)") %>%
add_row(variable = "species_richness", axis_name = "Species Richness") %>%
add_row(variable = "species_richness_d", axis_name = "Species Richness ES") %>%
add_row(variable = "mean_richness", axis_name = "Mean α-Diversity (Shannon)") %>%
add_row(variable = "mean_shannon", axis_name = "Mean α-Diversity (Shannon)") %>%
add_row(variable = "shannon", axis_name = "Biodiversity (Shannon)") %>%
add_row(variable = "sqrt_shannon", axis_name = "Sqrt Biodiversity (Shannon)") %>%
add_row(variable = "shannon_d", axis_name = "Biodiversity ES (Shannon ES)") %>%
add_row(variable = "bray_curtis", axis_name = "β-Diversity (Bray-Curtis)") %>%
add_row(variable = "beta_spatial_turnover", axis_name = "Turn over (Simpson pair-wise dissimilarity)") %>%
add_row(variable = "beta_nestedness", axis_name = "Nestedness (nestedness-fraction of Sorensen)") %>%
add_row(variable = "beta_total", axis_name = "Tot β-Diversity (Sorensen)") %>%
add_row(variable = "metaecosystem_richness", axis_name = "γ-Diversity (Species Richness)") %>%
add_row(variable = "indiv_per_ml", axis_name = "Abundance (ind/ml)") %>%
add_row(variable = "indiv_per_ml_d", axis_name = "Abundance ES") %>%
add_row(variable = "median_body_area_µm2", axis_name = "Median Body Size (µm²)") %>%
add_row(variable = "median_body_area_µm2_d", axis_name = "Median Body Size ES") %>%
add_row(variable = "Ble_indiv_per_ml", axis_name = "Ble Density (ind/ml)") %>%
add_row(variable = "Cep_indiv_per_ml", axis_name = "Cep Density (ind/ml)") %>%
add_row(variable = "Col_indiv_per_ml", axis_name = "Col Density (ind/ml)") %>%
add_row(variable = "Eug_indiv_per_ml", axis_name = "Eug Density (ind/ml)") %>%
add_row(variable = "Eup_indiv_per_ml", axis_name = "Eup Density (ind/ml)") %>%
add_row(variable = "Lox_indiv_per_ml", axis_name = "Lox Density (ind/ml)") %>%
add_row(variable = "Pau_indiv_per_ml", axis_name = "Pau Density (ind/ml)") %>%
add_row(variable = "Pca_indiv_per_ml", axis_name = "Pca Density (ind/ml)") %>%
add_row(variable = "Spi_indiv_per_ml", axis_name = "Spi Density (ind/ml)") %>%
add_row(variable = "Spi_te_indiv_per_ml", axis_name = "Spi te Density (ind/ml)") %>%
add_row(variable = "Tet_indiv_per_ml", axis_name = "Tet Density (ind/ml)") %>%
add_row(variable = "photo_hetero_ratio", axis_name = "Photosynthetisers-Heterotrops Ratio") %>%
add_row(variable = "sqrt_photo_hetero_ratio", axis_name = "Sqrt Photosynthetisers-Heterotrops Ratio") %>%
add_row(variable = "Ble_indiv_per_ml_d", axis_name = "Ble Density ES") %>%
add_row(variable = "Cep_indiv_per_ml_d", axis_name = "Cep Density ES") %>%
add_row(variable = "Col_indiv_per_ml_d", axis_name = "Col Density ES") %>%
add_row(variable = "Eug_indiv_per_ml_d", axis_name = "Eug Density ES") %>%
add_row(variable = "Eup_indiv_per_ml_d", axis_name = "Eup Density ES") %>%
add_row(variable = "Lox_indiv_per_ml_d", axis_name = "Lox Density ES") %>%
add_row(variable = "Pau_indiv_per_ml_d", axis_name = "Pau Density ES") %>%
add_row(variable = "Pca_indiv_per_ml_d", axis_name = "Pca Density ES") %>%
add_row(variable = "Spi_indiv_per_ml_d", axis_name = "Spi Density ES") %>%
add_row(variable = "Spi_te_indiv_per_ml_d", axis_name = "Spi te Density ES") %>%
add_row(variable = "Tet_indiv_per_ml_d", axis_name = "Tet Density ES") %>%
add_row(variable = "Ble_indiv_per_ml_dominance", axis_name = "Ble Dominance (%)") %>%
add_row(variable = "Cep_indiv_per_ml_dominance", axis_name = "Cep Dominance (%)") %>%
add_row(variable = "Col_indiv_per_ml_dominance", axis_name = "Col Dominance (%)") %>%
add_row(variable = "Eug_indiv_per_ml_dominance", axis_name = "Eug Dominance (%)") %>%
add_row(variable = "Eup_indiv_per_ml_dominance", axis_name = "Eup Dominance (%)") %>%
add_row(variable = "Lox_indiv_per_ml_dominance", axis_name = "Lox Dominance (%)") %>%
add_row(variable = "Pau_indiv_per_ml_dominance", axis_name = "Pau Dominance (%)") %>%
add_row(variable = "Pca_indiv_per_ml_dominance", axis_name = "Pca Dominance (%)") %>%
add_row(variable = "Spi_indiv_per_ml_dominance", axis_name = "Spi Dominance (%)") %>%
add_row(variable = "Spi_te_indiv_per_ml_dominance", axis_name = "Spi te Dominance (%)") %>%
add_row(variable = "Tet_indiv_per_ml_dominance", axis_name = "Tet Dominance (%)") %>%
add_row(variable = "Ble_indiv_per_ml_dominance_d", axis_name = "Ble Dominance ES") %>%
add_row(variable = "Cep_indiv_per_ml_dominance_d", axis_name = "Cep Dominance ES") %>%
add_row(variable = "Col_indiv_per_ml_dominance_d", axis_name = "Col Dominance ES") %>%
add_row(variable = "Eug_indiv_per_ml_dominance_d", axis_name = "Eug Dominance ES") %>%
add_row(variable = "Eup_indiv_per_ml_dominance_d", axis_name = "Eup Dominance ES") %>%
add_row(variable = "Lox_indiv_per_ml_dominance_d", axis_name = "Lox Dominance ES") %>%
add_row(variable = "Pau_indiv_per_ml_dominance_d", axis_name = "Pau Dominance ES") %>%
add_row(variable = "Pca_indiv_per_ml_dominance_d", axis_name = "Pca Dominance ES") %>%
add_row(variable = "Sp_indiv_per_mli_dominance_d", axis_name = "Spi Dominance ES") %>%
add_row(variable = "Spi_te_indiv_per_ml_dominance_d", axis_name = "Spi te Dominance ES") %>%
add_row(variable = "Tet_indiv_per_ml_dominance_d", axis_name = "Tet Dominance ES") %>%
add_row(variable = "dominance", axis_name = "Dominance (%)") %>%
add_row(variable = "log_abundance", axis_name = "Log Abundance + 1 (ind/mm²)") %>%
add_row(variable = "abundance_hedges_d", axis_name = "Density ES") %>%
add_row(variable = "beta_diversity_from_unconnected", axis_name = "Divergence from unconnected") %>%
add_row(variable = "beta_diversity_from_previous_time", axis_name = "Temporal Divergence") %>%
add_row(variable = "beta_diversity_from_previous_time_d", axis_name = "Temporal Divergence ES") %>%
add_row(variable = "evenness_pielou", axis_name = "Evenness") %>%
add_row(variable = "evenness_pielou_d", axis_name = "Evenness ES") %>%
slice(-1)
# --- SET UP COLOUR AND LINE TYPER PER ECOSYSTEM/META-ECOSYSTEM PARAMETERS --- #
treatment_colours = c("Small" = "#feb24c",
"Medium" = "#1b7837",
"Large" = "#3182bd",
"Small-Small" = "#fc9272",
"Large-Large" = "#67000d",
"Small-Large" = "#762a83",
"Medium-Medium" = "#1b7837",
"symmetric" = "#1b7837",
"asymmetric" = "#762a83")
treatment_colours_paper = c("symmetric" = "#1b7837",
"asymmetric" = "#762a83")
treatment_linetype_paper = c("connected" = "solid",
"unconnected" = "dashed")
treatment_linetype = c("connected to small" = "solid",
"connected to medium" = "dashed",
"connected to large" = "longdash",
"connected" = "solid",
"unconnected" = "dotted")
# --- SET UP PLOTTING PARAMETERS --- #
figures_height_rmd_output = 7
legend_position = "top"
legend_width_cm = 2
size_legend = 12
size_x_axis = 13
size_y_axis = size_x_axis
boxplot_width = 2
dodging = 0.5
width_errorbar = 0.2
dodging_error_bar = 0.5
treatment_lines_linewidth = 1
treatment_points_size = 2.5
resource_flow_line_type = "solid"
resource_flow_line_colour = "#d9d9d9"
resource_flow_line_width = 0.3
zero_line_colour = "grey"
zero_line_line_type = "dotted"
zero_line_line_width = 0.5
zero_line_ES_line_type = "dotted"
zero_line_ES_colour = "grey"
zero_line_ES_line_width = 1
ggarrange_margin_top = 0
ggarrange_margin_bottom = 0
ggarrange_margin_left = 0
ggarrange_margin_right = 0
paper_width = 17.3
paper_height = 20
paper_units = "cm"
paper_res = 600
paper_y_axis_size = 9
paper_labels_size = 9
presentation_figure_size = 15
presentation_figure_width = 30
presentation_figure_height = 22
presentation_legend_size = 20
presentation_x_axis_size = 22
presentation_y_axis_size = presentation_x_axis_size
presentation_axes_size = 12
presentation_treatment_points_size = 5
presentation_treatment_linewidth = 2
presentation_figure_units = "cm"
presentation_figure_res = 600
grey_background_xmin = -Inf
grey_background_xmax = 7.5
grey_background_ymin = -Inf
grey_background_ymax = Inf
grey_background_fill = "#f0f0f0"
grey_background_alpha = 0.03
grey_background_color = "transparent"
# --- SET UP MODELLING PARAMETERS --- #
time_point_of_baselines = 1
time_points_with_water_addtion = 3:7
time_points_model = 2:7
To create the data in this repository I had to analyse the videos I took of the ecosystems. Videos are not included in the repository as they are too heavy (~ 500 GB). Below is the code I used for each time point.
# Clear workspace
rm(list = ls())
# Set working directory
setwd("/media/mendel-himself/ID_061_Ema2/PatchSizePilot/t0")
# Load required libraries
# library(devtools)
# install_github("femoerman/bemovi", ref="master")
library(bemovi)
library(parallel)
library(doParallel)
library(foreach)
# Define memory allocation parameters (in MB)
memory.alloc <- 240000 # Total memory allocated
memory.per.identifier <- 40000 # Memory per identifier
memory.per.linker <- 5000 # Memory per linker
memory.per.overlay <- 60000 # Memory per overlay
# Set paths for tools and particle linker
tools.path <- "/home/mendel-himself/bemovi_tools/" # Path to tools folder
to.particlelinker <- tools.path
# Set directories and file names
to.data <- paste(getwd(), "/", sep = "")
video.description.folder <- "0_video_description/"
video.description.file <- "video_description.txt"
raw.video.folder <- "1_raw/"
raw.avi.folder <- "1a_raw_avi/"
metadata.folder <- "1b_raw_meta/"
particle.data.folder <- "2_particle_data/"
trajectory.data.folder <- "3_trajectory_data/"
temp.overlay.folder <- "4a_temp_overlays/"
overlay.folder <- "4_overlays/"
merged.data.folder <- "5_merged_data/"
ijmacs.folder <- "ijmacs/"
######################################################################
# VIDEO PARAMETERS
# Define video parameters
fps <- 25 # Video frame rate (frames per second)
total_frames <- 125 # Total length of video (frames)
width <- 2048 # Video width (pixels)
height <- 2048 # Video height (pixels)
measured_volume <- 34.4 # Measured volume (microliters) for Leica M205 C with 1.6 fold magnification, sample height 0.5 mm and Hamamatsu Orca Flash 4
pixel_to_scale <- 4.05 # Size of a pixel (micrometers) for Leica M205 C with 1.6 fold magnification, sample height 0.5 mm and Hamamatsu Orca Flash 4
video.format <- "cxd" # Video file format (avi, cxd, mov, tiff)
difference.lag <- 10 # Difference lag
thresholds <- c(13, 255) # Threshold values of pixel intensity (considered a measure of pixel "whiteness") for determining if a pixel belongs to an individual rather than the background
######################################################################
# FILTERING PARAMETERS
# optimized for Perfex Pro 10 stereomicrocope with Perfex SC38800 (IDS UI-3880LE-M-GL) camera
# tested stereomicroscopes: Perfex Pro 10, Nikon SMZ1500, Leica M205 C
# tested cameras: Perfex SC38800, Canon 5D Mark III, Hamamatsu Orca Flash 4
# tested species: Tet, Col, Pau, Pca, Eug, Chi, Ble, Ceph, Lox, Spi
particle_min_size <- 10 # Minimum particle size (pixels)
particle_max_size <- 1000 # Maximum particle size (pixels)
trajectory_link_range <- 3 # Number of adjacent frames for linking particles
trajectory_displacement <- 16 # Maximum displacement of a particle between frames
# Filtering criteria
filter_min_net_disp <- 25 # Minimum net displacement (µm)
filter_min_duration <- 1 # Minimum duration (s)
filter_detection_freq <- 0.1 # Minimum detection frequency (1/s)
filter_median_step_length <- 3 # Minimum median step length (µm)
######################################################################
# VIDEO ANALYSIS
# Check if all tools are installed and set permissions
check_tools_folder(tools.path)
system(paste0("chmod a+x ", tools.path, "bftools/bf.sh"))
system(paste0("chmod a+x ", tools.path, "bftools/bfconvert"))
system(paste0("chmod a+x ", tools.path, "bftools/showinf"))
# Convert video files to compressed avi format
convert_to_avi(to.data,
raw.video.folder,
raw.avi.folder,
metadata.folder,
tools.path,
fps,
video.format)
# Uncomment the following lines for testing
# check_video_file_names(to.data, raw.avi.folder, video.description.folder, video.description.file)
# check_threshold_values(to.data, raw.avi.folder, ijmacs.folder, 2, difference.lag, thresholds, tools.path, memory.alloc)
# Identify particles in the video
locate_and_measure_particles(to.data,
raw.avi.folder,
particle.data.folder,
difference.lag,
min_size = particle_min_size,
max_size = particle_max_size,
thresholds = thresholds,
tools.path,
memory = memory.alloc,
memory.per.identifier = memory.per.identifier,
max.cores = detectCores() - 1)
# Link particles across frames to form trajectories
link_particles(to.data,
particle.data.folder,
trajectory.data.folder,
linkrange = trajectory_link_range,
disp = trajectory_displacement,
start_vid = 1,
memory = memory.alloc,
memory_per_linkerProcess = memory.per.linker,
raw.avi.folder,
max.cores = detectCores() - 1,
max_time = 1)
# Merge video description file with particle data
merge_data(to.data,
particle.data.folder,
trajectory.data.folder,
video.description.folder,
video.description.file,
merged.data.folder)
# Load the merged data
load(paste0(to.data, merged.data.folder, "Master.RData"))
# Filter trajectory data based on defined criteria
trajectory.data.filtered <- filter_data(trajectory.data,
filter_min_net_disp,
filter_min_duration,
filter_detection_freq,
filter_median_step_length)
# Summarize trajectory data to individual-based data
morph_mvt <- summarize_trajectories(trajectory.data.filtered,
calculate.median = F,
write = T,
to.data,
merged.data.folder)
# Summarize sample level data
summarize_populations(trajectory.data.filtered,
morph_mvt,
write = T,
to.data,
merged.data.folder,
video.description.folder,
video.description.file,
total_frames)
# Create overlays for validation
create.subtitle.overlays(to.data,
traj.data = trajectory.data.filtered,
raw.video.folder,
raw.avi.folder,
temp.overlay.folder,
overlay.folder,
fps,
vid.length = total_frames / fps,
width,
height,
tools.path = tools.path,
overlay.type = "number",
video.format)
# Create overlays (old method)
create_overlays(traj.data = trajectory.data.filtered,
to.data = to.data,
merged.data.folder = merged.data.folder,
raw.video.folder = raw.avi.folder,
temp.overlay.folder = "4a_temp_overlays_old/",
overlay.folder = "4_overlays_old/",
width = width,
height = height,
difference.lag = difference.lag,
type = "traj",
predict_spec = F,
contrast.enhancement = 1,
IJ.path = "/home/mendel-himself/bemovi_tools",
memory = memory.alloc,
max.cores = detectCores() - 1,
memory.per.overlay = memory.per.overlay)
Below is the code I used to identify species to create the data in this repository.
# Clear the workspace
rm(list = ls())
# Uncomment and install required packages if not already installed
#install.packages("e1071",dependencies = T)
#install.packages("devtools",dependencies = T)
#install_github("pennekampster/bemovi", ref="master")
#library(devtools)
# Load required libraries
library(bemovi)
library(e1071)
library("here")
library("tidyverse")
# Define time points in the experiment
time_points_in_experiment = c("t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7")
# Loop through each time point in the experiment
for (time_point in time_points_in_experiment) {
# Define folder names and paths
video.description.folder = "0_video_description/"
video.description.file = "video_description.txt"
merged.data.folder = "5_merged_data/"
monocultures_folder_path = here("biomass_analysis", "training", "")
mixed_cultures_folder_path = here("biomass_analysis", time_point, "")
#Parameters used in the video analysis script
fps = 25
nsv = 5
measured_volume = 34.4
pixel_to_scale = 4.05
filter_min_net_disp = 25
filter_min_duration = 1
filter_detection_freq = 0.1
filter_median_step_length = 3
# Load master dataset of mono-cultures
load(paste0(monocultures_folder_path, merged.data.folder, "Master.RData"))
trajectory.data_monocultures = trajectory.data
rm(trajectory.data)
# Filter the master data of mono-cultures using the same parameters as in the video analysis script
trajectory.data_monocultures.filtered = filter_data(trajectory.data_monocultures,
filter_min_net_disp,
filter_min_duration,
filter_detection_freq,
filter_median_step_length)
# Summarize trajectory data to individual-based data
morph_mvt = summarize_trajectories(data = trajectory.data_monocultures.filtered,
calculate.median = FALSE,
write = TRUE,
to.data = monocultures_folder_path,
merged.data.folder = merged.data.folder) %>%
mutate(comment = NULL)
# Prepare training data by removing incomplete cases
training_data = morph_mvt[complete.cases(morph_mvt), ]
# Train SVM model on the training data
svm1 = svm(
factor(species) ~
mean_grey +
sd_grey +
mean_area +
sd_area +
mean_perimeter +
mean_turning +
sd_turning +
sd_perimeter +
mean_major +
sd_major +
mean_minor +
sd_minor +
mean_ar +
sd_ar +
duration +
max_net +
net_disp +
net_speed +
gross_disp +
max_step +
min_step +
sd_step +
sd_gross_speed +
max_gross_speed +
min_gross_speed ,
data = training_data,
probability = T,
na.action = na.pass)
# Generate and print confusion matrix
confusion.matrix = table(svm1$fitted, training_data$species)
confusion.matrix.nd = confusion.matrix
diag(confusion.matrix.nd) = 0
svm1$confusion = cbind(confusion.matrix,
class.error = rowSums(confusion.matrix.nd) / rowSums(confusion.matrix))
print(paste("Confusion matrix of time point", time_point))
print(svm1$confusion)
# Extract unique species names
species.names = unique(trajectory.data_monocultures$species)
# Load mixed cultures dataset
load(paste0(mixed_cultures_folder_path, merged.data.folder, "Master.RData"))
trajectory.data_mixed = trajectory.data
rm(trajectory.data)
# Filter mixed cultures data using the same parameters
trajectory.data_mixed.filtered = filter_data(trajectory.data_mixed,
filter_min_net_disp,
filter_min_duration,
filter_detection_freq,
filter_median_step_length)
# Summarize trajectory data to individual-based data
morph_mvt = summarize_trajectories(data = trajectory.data_mixed.filtered,
calculate.median = FALSE,
write = TRUE,
to.data = mixed_cultures_folder_path,
merged.data.folder = merged.data.folder)[, which(colnames(morph_mvt) != "Col_manual")] %>%
mutate(comment = NULL)
# Prepare data for prediction by removing incomplete cases
data.to.predict = morph_mvt[complete.cases(morph_mvt),]
# Predict species using the trained SVM model
p.id = predict(object = svm1, data.to.predict, type = "response")
data.to.predict$predicted_species = as.character(p.id)
# Summarize population data
pop.data = summarize_populations(traj.data = trajectory.data_monocultures.filtered,
sum.data = morph_mvt,
write = TRUE,
to.data = mixed_cultures_folder_path,
merged.data.folder = merged.data.folder,
video.description.folder = video.description.folder,
video.description.file = video.description.file,
total_frame = fps * nsv)
# Function to calculate species density
species.density = function(sample_output,
indiv_predicted,
species_names,
total_frames,
mv = measured_volume) {
samples = unique(indiv_predicted$file)
sp.dens = matrix(0,
nrow(sample_output),
length(species_names))
colnames(sp.dens) = species_names
for (i in 1:length(samples)) {
indiv = subset(indiv_predicted, file == samples[i])
spec = unique(indiv$predicted_species)
for (j in 1:length(spec)) {
all.indiv.sp = subset(indiv,
predicted_species == spec[j])
dens = sum(all.indiv.sp$N_frames) / total_frames / mv
sp.dens[which(sample_output$file == as.character(samples[i])), which(species_names == spec[j])] = dens
}
}
return(cbind(sample_output, sp.dens))
}
# Calculate species density for the current time point
output = species.density(pop.data,
data.to.predict,
species.names,
total_frames = fps * nsv,
mv = measured_volume)
# Save the species density results to a CSV file
file_name = paste0("species_ID_", time_point, ".csv")
write.csv(output, here("biomass_analysis", "species_ID_results", file_name))
rm(output)
}
ecosystems_info
)# --- IMPORT ECOSYSTEM INFORMATION --- #
# Read the 'ecosystems_info.csv' file
ecosystems_info = read.csv(here("..",
"1_data",
"ecosystems_info.csv"),
header = TRUE) %>%
# Rename specific columns for clarity
rename(ecosystem_ID = culture_ID,
ecosystem_size = patch_size,
ecosystem_size_ml = patch_size_volume) %>%
mutate(
# Recode 'ecosystem_size' to descriptive factor levels
ecosystem_size = factor(case_when(ecosystem_size == "S" ~ "Small",
ecosystem_size == "M" ~ "Medium",
ecosystem_size == "L" ~ "Large",
TRUE ~ NA_character_),
levels = c("Small", "Medium", "Large")),
# Define 'connection' based on 'eco_metaeco_type'
connection = case_when(
eco_metaeco_type == "S" ~ "unconnected",
eco_metaeco_type == "M" ~ "unconnected",
eco_metaeco_type == "L" ~ "unconnected",
eco_metaeco_type == "S (S_S)" ~ "connected to small",
eco_metaeco_type == "S (S_L)" ~ "connected to large",
eco_metaeco_type == "M (M_M)" ~ "connected to medium",
eco_metaeco_type == "L (S_L)" ~ "connected to small",
eco_metaeco_type == "L (L_L)" ~ "connected to large"),
# Create 'ecosystem_type' as a factor based on size and connection
ecosystem_type = factor(paste(ecosystem_size, connection),
levels = ecosystem_types_ordered),
# Recode 'metaecosystem_type' to descriptive values
metaecosystem_type = case_when(
metaecosystem_type == "S_S" ~ "Small-Small",
metaecosystem_type == "M_M" ~ "Medium-Medium",
metaecosystem_type == "L_L" ~ "Large-Large",
metaecosystem_type == "S_L" ~ "Small-Large",
TRUE ~ metaecosystem_type)) %>%
# Select only relevant columns for the final dataset
select(ecosystem_ID,
system_nr,
treatment_replicate,
disturbance,
ecosystem_size,
ecosystem_size_ml,
metaecosystem,
metaecosystem_type,
connection,
ecosystem_type)
In this dataset (ds_individuals
) each row represents an
individual at a time point.
# --- IMPORT TIME POINT 0 --- #
# Import the individual data of t0. We considered cultures to be all the same at
# the beginning (t0). Because of this reason, we filmed only the bottles from
# which cultures were assembled. Because we want to plot also t0 for the
# different treatments, we want to assign the video of bottles to all cultures
# at t0.
ds_individuals_t0_not_elongated = read.csv(here("..",
"1_data",
"individuals_13_threshold",
"t0.csv")) %>%
# Rename columns
rename(body_area_µm2 = mean_area) %>%
# Extract numeric values from 'time_point' and 'file' columns, add day and
# video replicate
mutate(time_point = as.numeric(str_extract(time_point, "\\d+")),
day = 0,
file = as.numeric(str_extract(file, "\\d+")),
video_replicate = file) %>%
# Select relevant columns
select(time_point,
day,
video_replicate,
file,
id,
N_frames,
body_area_µm2)
# Elongate 't0' dataset by replicating rows based on the number of ecosystems
ds_individuals_t0_elongated = ds_individuals_t0_not_elongated %>%
map_dfr(.x = 1 : nrow(ecosystems_info),
.f = ~ ds_individuals_t0_not_elongated) %>%
arrange(id) %>% # Id refers to an individual
# Add ecosystem_ID by repeating it across rows
mutate(ecosystem_ID = rep(1 : nrow(ecosystems_info),
times = nrow(ds_individuals_t0_not_elongated))) %>%
# Select relevant columns
select(time_point,
day,
video_replicate,
file,
ecosystem_ID,
id,
N_frames,
body_area_µm2)
# Test: Check that row count matches the expected elongated dataset size
expect_equal(nrow(ds_individuals_t0_not_elongated) * nrow(ecosystems_info),
nrow(ds_individuals_t0_elongated))
# --- IMPORT TIME POINTS 1 TO 7 --- #
# Initialise an empty list to store data for time points t1 to t7
ds_individuals_t1_to_t7 <- list()
# Loop over each time point (excluding t0) to import data
for (time_point_i in time_points_without_t0) {
# Read each time point's CSV file, rename columns, and set up new columns
ds_individuals_t1_to_t7[[time_point_i]] <- read.csv(here("..",
"1_data",
"individuals_13_threshold",
paste0("t",
time_point_i,
".csv"))) %>%
# Rename columns
rename(ecosystem_ID = culture_ID,
body_area_µm2 = mean_area) %>%
mutate(time_point = as.numeric(str_extract(time_point, "\\d+")),
day = time_point_day$day[time_point_day$time_point == time_point_i], # Map day based on time_point
file = as.numeric(str_extract(file, "\\d+")),
video_replicate = ceiling(file / n_cultures)) # Group files into video replicates
}
# Combine all imported time points (excluding t0) into a single data frame
ds_individuals_t1_to_t7 <- ds_individuals_t1_to_t7 %>%
bind_rows() %>%
# Select relevant columns for the final dataset
select(time_point,
day,
video_replicate,
file,
ecosystem_ID,
id,
N_frames,
body_area_µm2)
# --- CREATE DS_INDIVIDUALS --- #
# Bind time points 0 with time points 1 to 7 and add ecosystem information
ds_individuals = rbind(ds_individuals_t0_elongated,
ds_individuals_t1_to_t7) %>%
left_join(ecosystems_info,
by = "ecosystem_ID") %>%
# Take off problematic videos & ecosystems
filter(!(time_point %in% videos_to_take_off$time_point & file %in% videos_to_take_off$file),
!ecosystem_ID %in% ecosystems_to_take_off) %>%
# Select relevant columns
select(disturbance,
time_point,
day,
video_replicate,
ecosystem_ID,
system_nr,
file,
ecosystem_size,
ecosystem_size_ml,
metaecosystem,
metaecosystem_type,
body_area_µm2,
N_frames)
ds_ecosystems
)In this dataset (ds_ecosystems
) each row represents a
ecosystem at a time point.
# --- IMPORT TIME POINT 0 --- #
# Initialize an empty list to store elongated datasets for each video at time
# point 0
ds_ecosystems_t0_elongated <- list()
# Import t0 ecosystem level information - biomass and individuals
ds_ecosystems_t0 = read.csv(here("..",
"1_data",
"ecosystems_13_threshold",
"t0.csv")) %>%
mutate(time_point = as.numeric(str_extract(time_point, "\\d+")),
day = 0,
video_replicate = file) %>%
select(time_point,
day,
video_replicate,
file,
bioarea_per_volume,
indiv_per_volume)
# Import t0 ecosystem level information - species indiv/µl (threshold 13)
species_ID_13_threshold_t0 = read.csv(here("..",
"1_data",
"species_ID_13_threshold",
paste0("t0.csv"))) %>%
rename(Ble_indiv_per_volume = Ble,
Cep_indiv_per_volume = Cep,
Col_indiv_per_volume = Col,
Eug_indiv_per_volume = Eug,
Eup_indiv_per_volume = Eup,
Lox_indiv_per_volume = Lox,
Pau_indiv_per_volume = Pau,
Pca_indiv_per_volume = Pca,
Spi_indiv_per_volume = Spi,
Spi_te_indiv_per_volume = Spi_te,
Tet_indiv_per_volume = Tet) %>%
select(file,
all_of(species_IDD_with_13_threshold_indiv_per_volume))
# Import t0 ecosystem level information - species indiv/µl (threshold 40)
species_ID_40_threshold_t0 = read.csv(here("..",
"1_data",
"species_ID_40_threshold",
paste0("t0.csv"))) %>%
rename(Ble_indiv_per_volume = Ble,
Cep_indiv_per_volume = Cep,
Col_indiv_per_volume = Col,
Eug_indiv_per_volume = Eug,
Eup_indiv_per_volume = Eup,
Lox_indiv_per_volume = Lox,
Pau_indiv_per_volume = Pau,
Pca_indiv_per_volume = Pca,
Spi_indiv_per_volume = Spi,
Spi_te_indiv_per_volume = Spi_te,
Tet_indiv_per_volume = Tet) %>%
select(file,
all_of(species_IDD_with_40_threshold_indiv_per_volume))
# Combine biomass and species data
ds_ecosystems_t0 = ds_ecosystems_t0 %>%
left_join(species_ID_13_threshold_t0,
by = "file") %>%
left_join(species_ID_40_threshold_t0,
by = "file") %>%
mutate(file = as.numeric(str_extract(file, "\\d+")))
# Elongate data for each video taken at time point 0
for (video_i in 1:n_videos_taken_t0) {
# Filter the original dataset to select data for the current video
single_video = ds_ecosystems_t0 %>%
filter(file == video_i)
# Elongate current video's data with ecosystem info and assign time point
# and day
ds_ecosystems_t0_elongated[[video_i]] = ecosystems_info %>%
mutate(
time_point = 0,
day = 0,
file = single_video$file,
video_replicate = single_video$video_replicate,
bioarea_per_volume = single_video$bioarea_per_volume,
indiv_per_volume = single_video$indiv_per_volume,
Ble_indiv_per_volume = single_video$Ble_indiv_per_volume,
Cep_indiv_per_volume = single_video$Cep_indiv_per_volume,
Col_indiv_per_volume = single_video$Col_indiv_per_volume,
Eug_indiv_per_volume = single_video$Eug_indiv_per_volume,
Eup_indiv_per_volume = single_video$Eup_indiv_per_volume,
Lox_indiv_per_volume = single_video$Lox_indiv_per_volume,
Pau_indiv_per_volume = single_video$Pau_indiv_per_volume,
Pca_indiv_per_volume = single_video$Pca_indiv_per_volume,
Spi_indiv_per_volume = single_video$Spi_indiv_per_volume,
Spi_te_indiv_per_volume = single_video$Spi_te_indiv_per_volume,
Tet_indiv_per_volume = single_video$Tet_indiv_per_volume
)
}
# Combine all elongated datasets into one data frame
ds_ecosystems_t0 = ds_ecosystems_t0_elongated %>%
# Combine all videos data
bind_rows() %>%
# Select relevant columns
select(file,
time_point,
day,
ecosystem_ID,
video_replicate,
bioarea_per_volume,
indiv_per_volume,
all_of(protist_species_indiv_per_volume))
# Test: Verify the number of rows matches expected dataset size
expect_equal(nrow(ds_ecosystems_t0),
sum(n_videos_taken_t0 * n_cultures))
# --- IMPORT TIME POINTS 1 TO 7 --- #
# Initialize an empty list to store data for time points t1 to t7
ds_ecosystems_t1_to_t7 = list()
# Loop through each time point, excluding t0
for (time_point_i in time_points_without_t0) {
# Import ecosystem-level data (biomass and individuals) for the current time
# point
ds_ecosystems_t1_to_t7[[time_point_i]] = read.csv(here("..",
"1_data",
"ecosystems_13_threshold",
paste0("t",
time_point_i,
".csv"))) %>%
arrange(file) %>%
rename(ecosystem_ID = culture_ID) %>%
mutate(video_replicate = rep(1 : time_point_day$video_replicates[time_point_i+1],
each = n_cultures),
day = time_point_day$day[time_point_day$time_point == time_point_i]) %>%
select(file,
time_point,
day,
video_replicate,
file,
ecosystem_ID,
bioarea_per_volume,
indiv_per_volume)
# Import species data (indiv/µL) at threshold 13 for the current time point
species_ID_13_threshold = read.csv(here("..",
"1_data",
"species_ID_13_threshold",
paste0("t", time_point_i, ".csv"))) %>%
rename(Ble_indiv_per_volume = Ble,
Cep_indiv_per_volume = Cep,
Col_indiv_per_volume = Col,
Eug_indiv_per_volume = Eug,
Eup_indiv_per_volume = Eup,
Lox_indiv_per_volume = Lox,
Pau_indiv_per_volume = Pau,
Pca_indiv_per_volume = Pca,
Spi_indiv_per_volume = Spi,
Spi_te_indiv_per_volume = Spi_te,
Tet_indiv_per_volume = Tet) %>%
select(file,
all_of(species_IDD_with_13_threshold_indiv_per_volume))
# Import species data (indiv/µL) at threshold 40 for the current time point
species_ID_40_threshold = read.csv(here("..",
"1_data",
"species_ID_40_threshold",
paste0("t", time_point_i, ".csv"))) %>%
rename(Ble_indiv_per_volume = Ble,
Cep_indiv_per_volume = Cep,
Col_indiv_per_volume = Col,
Eug_indiv_per_volume = Eug,
Eup_indiv_per_volume = Eup,
Lox_indiv_per_volume = Lox,
Pau_indiv_per_volume = Pau,
Pca_indiv_per_volume = Pca,
Spi_indiv_per_volume = Spi,
Spi_te_indiv_per_volume = Spi_te,
Tet_indiv_per_volume = Tet) %>%
select(file,
all_of(species_IDD_with_40_threshold_indiv_per_volume))
# Merge species data with ecosystem data for the current time point
ds_ecosystems_t1_to_t7[[time_point_i]] = ds_ecosystems_t1_to_t7[[time_point_i]] %>%
left_join(species_ID_13_threshold,
by = "file") %>%
left_join(species_ID_40_threshold,
by = "file")
}
# Combine all datasets for time points t1 to t7 into a single data frame
ds_ecosystems_t1_to_t7 = ds_ecosystems_t1_to_t7 %>%
bind_rows()
# --- BIND TIME POITNS AND CACLULATE ECOSYSTEM-LEVEL INFORMATION --- #
ds_ecosystems =
# Bind time points
rbind(ds_ecosystems_t0,
ds_ecosystems_t1_to_t7) %>%
# Add ecosystem information
left_join(ecosystems_info,
by = "ecosystem_ID") %>%
# Extract numerical values
mutate(time_point = as.numeric(str_extract(time_point, "\\d+")),
file = as.numeric(str_extract(file, "\\d+"))) %>%
# Change from the word volume to the word μL
rename(bioarea_µm2_per_μL = bioarea_per_volume) %>%
rename_all( ~ gsub("volume", "μL", .)) %>%
# Change units of measurements to ml
mutate(bioarea_µm2_per_ml = bioarea_µm2_per_μL * 10^3,
bioarea_mm2_per_ml = bioarea_µm2_per_ml * 10^(-6),
Ble_indiv_per_ml = Ble_indiv_per_μL * 10^3,
Cep_indiv_per_ml = Cep_indiv_per_μL * 10^3,
Col_indiv_per_ml = Col_indiv_per_μL * 10^3,
Eug_indiv_per_ml = Eug_indiv_per_μL * 10^3,
Eup_indiv_per_ml = Eup_indiv_per_μL * 10^3,
Lox_indiv_per_ml = Lox_indiv_per_μL * 10^3,
Pau_indiv_per_ml = Pau_indiv_per_μL * 10^3,
Pca_indiv_per_ml = Pca_indiv_per_μL * 10^3,
Spi_indiv_per_ml = Spi_indiv_per_μL * 10^3,
Spi_te_indiv_per_ml = Spi_te_indiv_per_μL * 10^3,
Tet_indiv_per_ml = Tet_indiv_per_μL * 10^3) %>%
# Take off problematic videos
filter(!(time_point %in% videos_to_take_off$time_point &
file %in% videos_to_take_off$file)) %>%
# Take off problematic ecosystems
filter(!ecosystem_ID %in% ecosystems_to_take_off) %>%
# Average videos
group_by(across(all_of(columns_ecosystems))) %>%
summarise(across(contains("_per_ml"), mean),
across(contains("_tot"), mean)) %>%
ungroup() %>%
# Calculate ecosystem-level metrics
mutate(indiv_per_ml = !!rlang::parse_expr(paste(protist_species_indiv_per_ml,
collapse = " + ")),
bioarea_tot_mm2 = bioarea_mm2_per_ml * ecosystem_size_ml,
indiv_tot = indiv_per_ml * ecosystem_size_ml,
Ble_tot_indiv = Ble_indiv_per_ml * ecosystem_size_ml,
Cep_tot_indiv = Cep_indiv_per_ml * ecosystem_size_ml,
Col_tot_indiv = Col_indiv_per_ml * ecosystem_size_ml,
Eug_tot_indiv = Eug_indiv_per_ml * ecosystem_size_ml,
Eup_tot_indiv = Eup_indiv_per_ml * ecosystem_size_ml,
Lox_tot_indiv = Lox_indiv_per_ml * ecosystem_size_ml,
Pau_tot_indiv = Pau_indiv_per_ml * ecosystem_size_ml,
Pca_tot_indiv = Pca_indiv_per_ml * ecosystem_size_ml,
Spi_tot_indiv = Spi_indiv_per_ml * ecosystem_size_ml,
Spi_te_tot_indiv = Spi_te_indiv_per_ml * ecosystem_size_ml,
Tet_tot_indiv = Tet_indiv_per_ml * ecosystem_size_ml,
across(.cols = all_of(protist_species_indiv_per_ml),
.fns = list(dominance = ~ (. / indiv_per_ml) * 100),
.names = "{col}_dominance"),
photo_hetero_ratio = (Eug_indiv_per_ml + Eup_indiv_per_ml) /
(Ble_indiv_per_ml +
Cep_indiv_per_ml +
Col_indiv_per_ml +
Lox_indiv_per_ml +
Pau_indiv_per_ml +
Pca_indiv_per_ml +
Spi_indiv_per_ml +
Spi_te_indiv_per_ml +
Tet_indiv_per_ml))
# Add biodiversity metrics
ds_ecosystems = calculate.alpha.diversity()
# Add median body size
ds_median_body_size = ds_individuals %>%
group_by(time_point,
ecosystem_ID,
file) %>%
summarise(median_body_area_µm2 = median(body_area_µm2)) %>%
group_by(time_point,
ecosystem_ID) %>%
summarise(median_body_area_µm2 = mean(median_body_area_µm2))
ds_ecosystems = full_join(ds_ecosystems,
ds_median_body_size)
ds_metaecosystems
)In this dataset (ds_metaecosystems
) each row represents
a meta-ecosystem at a time point.
# --- FIND IDS OF UNCONNECTED ECOSYSTEMS --- #
ID_unconnected_S_low = ds_ecosystems %>%
filter(ecosystem_type == "Small unconnected",
disturbance == "low") %>%
pull(ecosystem_ID) %>%
unique()
ID_unconnected_M_low = ds_ecosystems %>%
filter(ecosystem_type == "Medium unconnected",
disturbance == "low") %>%
pull(ecosystem_ID) %>%
unique()
ID_unconnected_L_low = ds_ecosystems %>%
filter(ecosystem_type == "Large unconnected",
disturbance == "low") %>%
pull(ecosystem_ID) %>%
unique()
ID_unconnected_S_high = ds_ecosystems %>%
filter(ecosystem_type == "Small unconnected",
disturbance == "high") %>%
pull(ecosystem_ID) %>%
unique()
ID_unconnected_M_high = ds_ecosystems %>%
filter(ecosystem_type == "Medium unconnected",
disturbance == "high") %>%
pull(ecosystem_ID) %>%
unique()
ID_unconnected_L_high = ds_ecosystems %>%
filter(ecosystem_type == "Large unconnected",
disturbance == "high") %>%
pull(ecosystem_ID) %>%
unique()
# --- FIND COMBINATIONS OF ECOSYSTEMS TO CREATE UNCONNECTED META-ECOSYSTEMS --- #
combinations_S_and_L_low = crossing(ID_unconnected_S_low,
ID_unconnected_L_low) %>%
mutate(disturbance = "low",
metaecosystem_type = "Small-Large",
connection = "unconnected") %>%
rename(ID_first_ecosystem = ID_unconnected_S_low,
ID_second_ecosystem = ID_unconnected_L_low) %>%
select(disturbance,
metaecosystem_type,
connection,
ID_first_ecosystem,
ID_second_ecosystem)
combinations_S_and_L_high = crossing(ID_unconnected_S_high,
ID_unconnected_L_high) %>%
mutate(disturbance = "high",
metaecosystem_type = "Small-Large",
connection = "unconnected") %>%
rename(ID_first_ecosystem = ID_unconnected_S_high,
ID_second_ecosystem = ID_unconnected_L_high) %>%
select(disturbance,
metaecosystem_type,
connection,
ID_first_ecosystem,
ID_second_ecosystem)
combinations_M_and_M_low = combinat::combn(ID_unconnected_M_low,
m = 2) %>%
t() %>%
as.data.frame() %>%
rename(ID_first_ecosystem = V1,
ID_second_ecosystem = V2) %>%
mutate(disturbance = "low",
metaecosystem_type = "Medium-Medium",
connection = "unconnected") %>%
select(disturbance,
metaecosystem_type,
connection,
ID_first_ecosystem,
ID_second_ecosystem)
combinations_M_and_M_high = combinat::combn(ID_unconnected_M_high,
m = 2) %>%
t() %>%
as.data.frame() %>%
rename(ID_first_ecosystem = V1,
ID_second_ecosystem = V2) %>%
mutate(disturbance = "high",
metaecosystem_type = "Medium-Medium",
connection = "unconnected") %>%
select(disturbance,
metaecosystem_type,
connection,
ID_first_ecosystem,
ID_second_ecosystem)
# --- BIND ECOSYSTEM COMBINATIONS --- #
combinations_unconnected_metaeco = rbind(combinations_S_and_L_low,
combinations_S_and_L_high,
combinations_M_and_M_low,
combinations_M_and_M_high) %>%
mutate(system_nr = 1001:(1000 + nrow(.))) %>%
select(system_nr,
disturbance,
metaecosystem_type,
connection,
ID_first_ecosystem,
ID_second_ecosystem)
# --- FIND COMBINATIONS OF ECOSYSTEMS TO CREATE CONNECTED META-ECOSYSTEMS --- #
combinations_connected_metaeco = ds_ecosystems %>%
filter(time_point == 0,
metaecosystem == "yes") %>%
select(system_nr,
disturbance,
metaecosystem_type,
ecosystem_ID) %>%
group_by(system_nr,
disturbance,
metaecosystem_type) %>%
summarise(ID_first_ecosystem = (mean(ecosystem_ID) - 0.5),
ID_second_ecosystem = (mean(ecosystem_ID) + 0.5)) %>%
mutate(connection = "connected") %>%
as.data.frame()
# --- BIND COMBINATIONS OF ECOSYSTEMS TO CREATE UNCONNECTED & CONNECTED META-ECOSYSTEMS --- #
ecos_combin = rbind(combinations_unconnected_metaeco,
combinations_connected_metaeco) %>%
mutate(ecosystems_combined = paste0(ID_first_ecosystem, "|", ID_second_ecosystem))
n_ecosystems_combinations = nrow(ecos_combin)
# --- CREATE SETS FOR SMALL-LARGE UNCONNECTED META-ECOSYSTEMS --- #
# Create sets for Small-Large unconnected meta-ecosystems where in each set a
# small and a large ecosystems are paired differently (keep the small ecosystems
# on the same order and perform permutations on the large ecosystems)
# Initialize a list to store combinations for each disturbance level
SL_unconn_ecos_comb_sets <- vector("list",
length(disturbance_levels))
# Loop over each disturbance level
for (disturbance_i in 1:length(disturbance_levels)) {
# Extract unique IDs for small and large unconnected ecosystems for the
# current disturbance level
ID_small_ecosystems = ds_ecosystems %>%
filter(disturbance == disturbance_levels[disturbance_i],
ecosystem_type == "Small unconnected") %>%
pull(ecosystem_ID) %>%
unique()
ID_large_ecosystems = ds_ecosystems %>%
filter(disturbance == disturbance_levels[disturbance_i],
ecosystem_type == "Large unconnected") %>%
pull(ecosystem_ID) %>%
unique()
#Force small and large ecosystems vectors to have the same length
length_difference <- length(ID_small_ecosystems) - length(ID_large_ecosystems)
# Ensure small and large ecosystems vectors have the same length
if (length_difference > 0) {
ID_large_ecosystems = c(ID_large_ecosystems,
rep("Patch taken off",
times = abs(length(ID_small_ecosystems) -
length(ID_large_ecosystems))))
} else if (length_difference < 0) {
ID_small_ecosystems = c(ID_small_ecosystems,
rep("Patch taken off",
times = abs(length(ID_large_ecosystems) -
length(ID_small_ecosystems))))
}
# Generate permutations of large ecosystem IDs
permutations_large = permn(ID_large_ecosystems)
# Create a dataframe for combinations of small and large ecosystems
SL_unconn_ecos_comb_sets[[disturbance_i]] = data.frame(
disturbance = disturbance_levels[disturbance_i],
metaecosystem_type = "Small-Large",
connection = "unconnected",
ID_first_ecosystem = rep(ID_small_ecosystems,
times = length(permutations_large)),
ID_second_ecosystem = unlist(permutations_large),
set = rep(1 : length(permutations_large),
each = length(ID_small_ecosystems)))
# Verify the number of rows in the dataframe matches the expected count
expect_equal(nrow(SL_unconn_ecos_comb_sets[[disturbance_i]]),
length(ID_small_ecosystems) * length(permutations_large))
# Filter out any rows with "Patch taken off" and convert IDs to double
SL_unconn_ecos_comb_sets[[disturbance_i]] = SL_unconn_ecos_comb_sets[[disturbance_i]] %>%
filter(!ID_first_ecosystem == "Patch taken off",
!ID_second_ecosystem == "Patch taken off") %>%
mutate(ID_first_ecosystem = as.double(ID_first_ecosystem),
ID_second_ecosystem = as.double(ID_second_ecosystem)) %>%
full_join(ecos_combin %>%
filter(disturbance == disturbance_levels[disturbance_i],
metaecosystem_type == "Small-Large",
connection == "unconnected"))
}
# Store the combinations before binding into a single dataframe
SL_unconn_ecos_comb_sets_before_binding = SL_unconn_ecos_comb_sets
# Bind all the sets into a single dataframe
SL_unconn_ecos_comb_sets = SL_unconn_ecos_comb_sets %>%
bind_rows()
# Test: check that the total number of rows matches the expected sum of
# combinations
expect_equal(nrow(SL_unconn_ecos_comb_sets),
nrow(SL_unconn_ecos_comb_sets_before_binding[[1]]) +
nrow(SL_unconn_ecos_comb_sets_before_binding[[2]]))
# Test: verify that the unique system numbers in the final dataframe match
# those in the original combinations
expect_equal(length(SL_unconn_ecos_comb_sets %>%
pull(system_nr) %>%
unique()),
length(ecos_combin %>%
filter(metaecosystem_type == "Small-Large",
connection == "unconnected") %>%
pull(system_nr) %>%
unique()))
# --- CREATE SETS FOR MEDIUM-MEDIUM UNCONNECTED META-ECOSYSTEMS --- #
# Create sets for Medium-Medium unconnected meta-ecosystems where in each set
# two different medium ecosystems are paired. To do so, initialise
# MM_unconn_ecos_comb_sets. Assign 10^4 rows to each matrix so that we have
# enough rows not to run out of them when we try to assign values to them.
# Assign 4 columns which will include ecosystem_ID of the first system, second
# ecosystem_ID of the fist system, ecosystem_ID of the second system, and second
# ecosystem_ID of the second system.
# Initialize an empty list to store combinations for each disturbance level
MM_unconn_ecos_comb_sets = list()
# Assign an empty matrix with 10^4 rows and 4 columns for each disturbance level
for(disturbance_i in 1:length(disturbance_levels)){
MM_unconn_ecos_comb_sets[[disturbance_i]] <- matrix(nrow = 10 ^ 4,
ncol = 4)
}
# Loop over each disturbance level to generate combinations of medium ecosystems
for (disturbance_i in 1:length(disturbance_levels)) {
# Extract unique IDs for medium unconnected ecosystems for the current
# disturbance level
ID_medium_ecosystems = ds_ecosystems %>%
filter(disturbance == disturbance_levels[disturbance_i],
ecosystem_type == "Medium unconnected") %>%
pull(ecosystem_ID) %>%
unique()
# Generate all combinations of two medium ecosystems
MM_unconnected_systems = combn(ID_medium_ecosystems,
2) %>%
t()
matrix_row = 0
# Loop through combinations to find valid pairs of unconnected ecosystems
for (first_system_i in 1:nrow(MM_unconnected_systems)) {
# Identify the first ecosystem
first_system = MM_unconnected_systems[first_system_i, ]
for (second_system_i in 1:nrow(MM_unconnected_systems)) {
# Identify the second ecosystem
second_system = MM_unconnected_systems[second_system_i, ]
# Check for shared elements between the two systems
shared_elements_among_systems = intersect(first_system,
second_system)
# If there are no shared elements, store the combination
if (length(shared_elements_among_systems) == 0) {
matrix_row = matrix_row + 1
#Make first and second system into a set
MM_unconn_ecos_comb_sets[[disturbance_i]][matrix_row,] = c(first_system,
second_system)
}
}
}
# Convert the matrix to a dataframe and remove NA rows
MM_unconn_ecos_comb_sets[[disturbance_i]] = MM_unconn_ecos_comb_sets[[disturbance_i]] %>%
as.data.frame() %>%
drop_na()
# Test: ensure no duplicate IDs in the combinations
expect_equal(MM_unconn_ecos_comb_sets[[disturbance_i]] %>%
filter(V1 == V2 |
V1 == V3 |
V1 == V4 |
V2 == V3 |
V2 == V4 |
V3 == V4) %>%
nrow(),
0)
# Reorder the dataset with all the ecosystem combinations
MM_unconn_ecos_comb_sets_reordered = data.frame(ID_first_ecosystem = NA,
ID_second_ecosystem = NA,
set = NA)
for (set_input in 1:nrow(MM_unconn_ecos_comb_sets[[disturbance_i]])) {
MM_unconn_ecos_comb_sets_reordered = MM_unconn_ecos_comb_sets_reordered %>%
add_row(ID_first_ecosystem = MM_unconn_ecos_comb_sets[[disturbance_i]][set_input, 1],
ID_second_ecosystem = MM_unconn_ecos_comb_sets[[disturbance_i]][set_input, 2],
set = set_input) %>%
add_row(ID_first_ecosystem = MM_unconn_ecos_comb_sets[[disturbance_i]][set_input, 3],
ID_second_ecosystem = MM_unconn_ecos_comb_sets[[disturbance_i]][set_input, 4],
set = set_input)
}
#Add to a list
MM_unconn_ecos_comb_sets[[disturbance_i]] = MM_unconn_ecos_comb_sets_reordered %>%
drop_na() %>%
mutate(disturbance = disturbance_levels[disturbance_i],
metaecosystem_type = "Medium-Medium",
connection = "unconnected")
#Add system nr
ID_combinations_MM_unconnected = ecos_combin %>%
filter(disturbance == disturbance_levels[disturbance_i],
metaecosystem_type == "Medium-Medium",
connection == "unconnected")
MM_unconn_ecos_comb_sets[[disturbance_i]] = full_join(MM_unconn_ecos_comb_sets[[disturbance_i]],
ID_combinations_MM_unconnected)
}
# Bind all sets of medium-medium unconnected combinations into a single
# dataframe
MM_unconn_ecos_comb_sets = MM_unconn_ecos_comb_sets %>%
bind_rows()
# Test
expect_equal(length(MM_unconn_ecos_comb_sets %>%
pull(system_nr) %>%
unique()),
length(ecos_combin %>%
filter(metaecosystem_type == "Medium-Medium",
connection == "unconnected") %>%
pull(system_nr) %>%
unique()))
# --- BIND SL AND MM UNCONNECTED META-ECOSYSTEMS SETS --- #
ecos_combin_unconn_sets = rbind(SL_unconn_ecos_comb_sets,
MM_unconn_ecos_comb_sets) %>%
select(disturbance,
metaecosystem_type,
connection,
set,
system_nr,
ID_first_ecosystem,
ID_second_ecosystem)
# --- FIND SETS OF SETS --- #
# Find the number of combinations of SL & MM low or high disturbance
n_SL_low_sets = ecos_combin_unconn_sets %>%
filter(metaecosystem_type == "Small-Large",
disturbance == "low") %>%
pull(set) %>%
max()
n_SL_high_sets = ecos_combin_unconn_sets %>%
filter(metaecosystem_type == "Small-Large",
disturbance == "high") %>%
pull(set) %>%
max()
n_MM_low_sets = ecos_combin_unconn_sets %>%
filter(metaecosystem_type == "Medium-Medium",
disturbance == "low") %>%
pull(set) %>%
max()
n_MM_high_sets = ecos_combin_unconn_sets %>%
filter(metaecosystem_type == "Medium-Medium",
disturbance == "high") %>%
pull(set) %>%
max()
# Find combinations of sets
ecos_combin_unconn_sets_of_sets <- expand.grid(set_SL_low = 1:n_SL_low_sets,
set_SL_high = 1:n_SL_high_sets,
set_MM_low = 1:n_MM_low_sets,
set_MM_high = 1:n_MM_high_sets)
# --- COMPUTE META-ECOSYSTEMS FOR EACH TIME POINT --- #
# Set parameters and initialise
ds_metaecosystems = list()
row_i = 0
# Compute meta-ecosystems
for (combination_i in 1:n_ecosystems_combinations) {
for (time_point_selected in time_points) {
row_i = row_i + 1
current_day = sampling_days[time_point_selected + 1]
current_system_nr = ecos_combin[combination_i, ]$system_nr
current_combination = ecos_combin[combination_i, ]$ecosystems_combined
current_disturbance = ecos_combin[combination_i, ]$disturbance
current_metaeco_type = ecos_combin[combination_i, ]$metaecosystem_type
current_connection = ecos_combin[combination_i, ]$connection
current_IDs = c(ecos_combin[combination_i, ]$ID_first_ecosystem,
ecos_combin[combination_i, ]$ID_second_ecosystem)
if (current_system_nr %in% metaecosystems_to_take_off)
next
if (current_IDs[1] == current_IDs[2])
next
species_vector_two_ecosystems = ds_ecosystems %>%
filter(time_point == time_point_selected,
ecosystem_ID %in% current_IDs) %>%
ungroup() %>%
select(all_of(protist_species_indiv_per_ml))
absence_presence_two_ecosystems <-
ifelse(species_vector_two_ecosystems > 0, 1, 0)
#Alpha diversity: Shannon (mean between the two ecosystems)
shannon_ecosystem_1 = diversity(species_vector_two_ecosystems[1, ],
index = "shannon")
shannon_ecosystem_2 = diversity(species_vector_two_ecosystems[2, ],
index = "shannon")
shannon_value = (shannon_ecosystem_1 + shannon_ecosystem_2) / 2
#Alpha diversity: Species richness (mean between the two ecosystems)
richness_ecosystem_1 = specnumber(species_vector_two_ecosystems[1, ])
richness_ecosystem_2 = specnumber(species_vector_two_ecosystems[2, ])
mean_richness_value = (richness_ecosystem_1 + richness_ecosystem_2) / 2
#Beta diversity: Jaccard
jaccard_index_value = vegdist(species_vector_two_ecosystems,
method = "jaccard") %>%
as.numeric()
#Beta diversity: Bray Curtis
bray_curtis_value = vegdist(species_vector_two_ecosystems,
method = "bray") %>%
as.numeric()
#Beta diversity: partitioning of beta diversity from Sorensen index into
# turnover (Simpson pair-wise dissimilarity) and nestedness
# (nestedness-fraction of Sorensen)
betapart_core_object = betapart.core(absence_presence_two_ecosystems)
beta_spatial_turnover_value = beta.pair(betapart_core_object)$beta.sim %>%
as.double()
beta_nestedness_value = beta.pair(betapart_core_object)$beta.sne %>%
as.double()
beta_total_value = beta.pair(betapart_core_object)$beta.sor %>%
as.double()
#Gamma diversity: Meta-ecosystem richness
metaecosystem_richness_value = colSums(species_vector_two_ecosystems) %>%
specnumber()
#Put everything together
ds_metaecosystems[[row_i]] = ds_ecosystems %>%
filter(ecosystem_ID %in% current_IDs,
time_point == time_point_selected) %>%
summarise(total_metaecosystem_bioarea_mm2 = sum(bioarea_tot_mm2),
total_metaecosystem_Ble_indiv = sum(Ble_tot_indiv),
total_metaecosystem_Cep_indiv = sum(Cep_tot_indiv),
total_metaecosystem_Col_indiv = sum(Col_tot_indiv),
total_metaecosystem_Eug_indiv = sum(Eug_tot_indiv),
total_metaecosystem_Eup_indiv = sum(Eup_tot_indiv),
total_metaecosystem_Lox_indiv = sum(Lox_tot_indiv),
total_metaecosystem_Pau_indiv = sum(Pau_tot_indiv),
total_metaecosystem_Pca_indiv = sum(Pca_tot_indiv),
total_metaecosystem_Spi_indiv = sum(Spi_tot_indiv),
total_metaecosystem_Spi_te_indiv = sum(Spi_te_tot_indiv),
total_metaecosystem_Tet_indiv = sum(Tet_tot_indiv)) %>%
mutate(system_nr = current_system_nr,
ecosystems_combined = current_combination,
metaecosystem_type = current_metaeco_type,
ecosystem_size_symmetry = case_when(
metaecosystem_type == "Small-Large" ~ "asymmetric",
metaecosystem_type == "Medium-Medium" ~ "symmetric",
metaecosystem_type == "Small-Small" ~ "symmetric",
metaecosystem_type == "Large-Large" ~ "symmetric"),
connection = current_connection,
disturbance = current_disturbance,
time_point = time_point_selected,
day = current_day,
jaccard_index = jaccard_index_value,
bray_curtis = bray_curtis_value,
beta_spatial_turnover = beta_spatial_turnover_value,
beta_nestedness = beta_nestedness_value,
beta_total = beta_total_value,
metaecosystem_richness = metaecosystem_richness_value,
mean_shannon = shannon_value,
mean_richness = mean_richness_value) %>%
ungroup() %>%
as.data.frame() %>%
select(time_point,
day,
system_nr,
ecosystems_combined,
disturbance,
metaecosystem_type,
ecosystem_size_symmetry,
connection,
mean_shannon,
mean_richness,
jaccard_index,
bray_curtis,
beta_spatial_turnover,
beta_nestedness,
beta_total,
metaecosystem_richness,
total_metaecosystem_bioarea_mm2,
paste0("total_metaecosystem_", protist_species, "_indiv"))
}
}
## Warning in vegdist(species_vector_two_ecosystems, method = "jaccard"): you have empty rows: their dissimilarities may be
## meaningless in method "jaccard"
## Warning in vegdist(species_vector_two_ecosystems, method = "bray"): you have empty rows: their dissimilarities may be
## meaningless in method "bray"
## Warning in vegdist(species_vector_two_ecosystems, method = "jaccard"): you have empty rows: their dissimilarities may be
## meaningless in method "jaccard"
## Warning in vegdist(species_vector_two_ecosystems, method = "bray"): you have empty rows: their dissimilarities may be
## meaningless in method "bray"
## Warning in vegdist(species_vector_two_ecosystems, method = "jaccard"): you have empty rows: their dissimilarities may be
## meaningless in method "jaccard"
## Warning in vegdist(species_vector_two_ecosystems, method = "bray"): you have empty rows: their dissimilarities may be
## meaningless in method "bray"
## Warning in vegdist(species_vector_two_ecosystems, method = "jaccard"): you have empty rows: their dissimilarities may be
## meaningless in method "jaccard"
## Warning in vegdist(species_vector_two_ecosystems, method = "bray"): you have empty rows: their dissimilarities may be
## meaningless in method "bray"
## Warning in vegdist(species_vector_two_ecosystems, method = "jaccard"): you have empty rows: their dissimilarities may be
## meaningless in method "jaccard"
## Warning in vegdist(species_vector_two_ecosystems, method = "bray"): you have empty rows: their dissimilarities may be
## meaningless in method "bray"
## Warning in vegdist(species_vector_two_ecosystems, method = "jaccard"): you have empty rows: their dissimilarities may be
## meaningless in method "jaccard"
## Warning in vegdist(species_vector_two_ecosystems, method = "bray"): you have empty rows: their dissimilarities may be
## meaningless in method "bray"
## Warning in vegdist(species_vector_two_ecosystems, method = "jaccard"): you have empty rows: their dissimilarities may be
## meaningless in method "jaccard"
## Warning in vegdist(species_vector_two_ecosystems, method = "bray"): you have empty rows: their dissimilarities may be
## meaningless in method "bray"
## Warning in vegdist(species_vector_two_ecosystems, method = "jaccard"): you have empty rows: their dissimilarities may be
## meaningless in method "jaccard"
## Warning in vegdist(species_vector_two_ecosystems, method = "bray"): you have empty rows: their dissimilarities may be
## meaningless in method "bray"
## Warning in vegdist(species_vector_two_ecosystems, method = "jaccard"): you have empty rows: their dissimilarities may be
## meaningless in method "jaccard"
## Warning in vegdist(species_vector_two_ecosystems, method = "bray"): you have empty rows: their dissimilarities may be
## meaningless in method "bray"
## Warning in vegdist(species_vector_two_ecosystems, method = "jaccard"): you have empty rows: their dissimilarities may be
## meaningless in method "jaccard"
## Warning in vegdist(species_vector_two_ecosystems, method = "bray"): you have empty rows: their dissimilarities may be
## meaningless in method "bray"
## Warning in vegdist(species_vector_two_ecosystems, method = "jaccard"): you have empty rows: their dissimilarities may be
## meaningless in method "jaccard"
## Warning in vegdist(species_vector_two_ecosystems, method = "bray"): you have empty rows: their dissimilarities may be
## meaningless in method "bray"
## Warning in vegdist(species_vector_two_ecosystems, method = "jaccard"): you have empty rows: their dissimilarities may be
## meaningless in method "jaccard"
## Warning in vegdist(species_vector_two_ecosystems, method = "bray"): you have empty rows: their dissimilarities may be
## meaningless in method "bray"
## Warning in vegdist(species_vector_two_ecosystems, method = "jaccard"): you have empty rows: their dissimilarities may be
## meaningless in method "jaccard"
## Warning in vegdist(species_vector_two_ecosystems, method = "bray"): you have empty rows: their dissimilarities may be
## meaningless in method "bray"
## Warning in vegdist(species_vector_two_ecosystems, method = "jaccard"): you have empty rows: their dissimilarities may be
## meaningless in method "jaccard"
## Warning in vegdist(species_vector_two_ecosystems, method = "bray"): you have empty rows: their dissimilarities may be
## meaningless in method "bray"
## Warning in vegdist(species_vector_two_ecosystems, method = "jaccard"): you have empty rows: their dissimilarities may be
## meaningless in method "jaccard"
## Warning in vegdist(species_vector_two_ecosystems, method = "bray"): you have empty rows: their dissimilarities may be
## meaningless in method "bray"
## Warning in vegdist(species_vector_two_ecosystems, method = "jaccard"): you have empty rows: their dissimilarities may be
## meaningless in method "jaccard"
## Warning in vegdist(species_vector_two_ecosystems, method = "bray"): you have empty rows: their dissimilarities may be
## meaningless in method "bray"
## Warning in vegdist(species_vector_two_ecosystems, method = "jaccard"): you have empty rows: their dissimilarities may be
## meaningless in method "jaccard"
## Warning in vegdist(species_vector_two_ecosystems, method = "bray"): you have empty rows: their dissimilarities may be
## meaningless in method "bray"
## Warning in vegdist(species_vector_two_ecosystems, method = "jaccard"): you have empty rows: their dissimilarities may be
## meaningless in method "jaccard"
## Warning in vegdist(species_vector_two_ecosystems, method = "bray"): you have empty rows: their dissimilarities may be
## meaningless in method "bray"
## Warning in vegdist(species_vector_two_ecosystems, method = "jaccard"): you have empty rows: their dissimilarities may be
## meaningless in method "jaccard"
## Warning in vegdist(species_vector_two_ecosystems, method = "bray"): you have empty rows: their dissimilarities may be
## meaningless in method "bray"
## Warning in vegdist(species_vector_two_ecosystems, method = "jaccard"): you have empty rows: their dissimilarities may be
## meaningless in method "jaccard"
## Warning in vegdist(species_vector_two_ecosystems, method = "bray"): you have empty rows: their dissimilarities may be
## meaningless in method "bray"
## Warning in vegdist(species_vector_two_ecosystems, method = "jaccard"): you have empty rows: their dissimilarities may be
## meaningless in method "jaccard"
## Warning in vegdist(species_vector_two_ecosystems, method = "bray"): you have empty rows: their dissimilarities may be
## meaningless in method "bray"
## Warning in vegdist(species_vector_two_ecosystems, method = "jaccard"): you have empty rows: their dissimilarities may be
## meaningless in method "jaccard"
## Warning in vegdist(species_vector_two_ecosystems, method = "bray"): you have empty rows: their dissimilarities may be
## meaningless in method "bray"
## Warning in vegdist(species_vector_two_ecosystems, method = "jaccard"): you have empty rows: their dissimilarities may be
## meaningless in method "jaccard"
## Warning in vegdist(species_vector_two_ecosystems, method = "bray"): you have empty rows: their dissimilarities may be
## meaningless in method "bray"
## Warning in vegdist(species_vector_two_ecosystems, method = "jaccard"): you have empty rows: their dissimilarities may be
## meaningless in method "jaccard"
## Warning in vegdist(species_vector_two_ecosystems, method = "bray"): you have empty rows: their dissimilarities may be
## meaningless in method "bray"
## Warning in vegdist(species_vector_two_ecosystems, method = "jaccard"): you have empty rows: their dissimilarities may be
## meaningless in method "jaccard"
## Warning in vegdist(species_vector_two_ecosystems, method = "bray"): you have empty rows: their dissimilarities may be
## meaningless in method "bray"
## Warning in vegdist(species_vector_two_ecosystems, method = "jaccard"): you have empty rows: their dissimilarities may be
## meaningless in method "jaccard"
## Warning in vegdist(species_vector_two_ecosystems, method = "bray"): you have empty rows: their dissimilarities may be
## meaningless in method "bray"
## Warning in vegdist(species_vector_two_ecosystems, method = "jaccard"): you have empty rows: their dissimilarities may be
## meaningless in method "jaccard"
## Warning in vegdist(species_vector_two_ecosystems, method = "bray"): you have empty rows: their dissimilarities may be
## meaningless in method "bray"
## Warning in vegdist(species_vector_two_ecosystems, method = "jaccard"): you have empty rows: their dissimilarities may be
## meaningless in method "jaccard"
## Warning in vegdist(species_vector_two_ecosystems, method = "bray"): you have empty rows: their dissimilarities may be
## meaningless in method "bray"
## Warning in vegdist(species_vector_two_ecosystems, method = "jaccard"): you have empty rows: their dissimilarities may be
## meaningless in method "jaccard"
## Warning in vegdist(species_vector_two_ecosystems, method = "bray"): you have empty rows: their dissimilarities may be
## meaningless in method "bray"
## Warning in vegdist(species_vector_two_ecosystems, method = "jaccard"): you have empty rows: their dissimilarities may be
## meaningless in method "jaccard"
## Warning in vegdist(species_vector_two_ecosystems, method = "bray"): you have empty rows: their dissimilarities may be
## meaningless in method "bray"
## Warning in vegdist(species_vector_two_ecosystems, method = "jaccard"): you have empty rows: their dissimilarities may be
## meaningless in method "jaccard"
## Warning in vegdist(species_vector_two_ecosystems, method = "bray"): you have empty rows: their dissimilarities may be
## meaningless in method "bray"
## Warning in vegdist(species_vector_two_ecosystems, method = "jaccard"): you have empty rows: their dissimilarities may be
## meaningless in method "jaccard"
## Warning in vegdist(species_vector_two_ecosystems, method = "bray"): you have empty rows: their dissimilarities may be
## meaningless in method "bray"
## Warning in vegdist(species_vector_two_ecosystems, method = "jaccard"): you have empty rows: their dissimilarities may be
## meaningless in method "jaccard"
## Warning in vegdist(species_vector_two_ecosystems, method = "bray"): you have empty rows: their dissimilarities may be
## meaningless in method "bray"
## Warning in vegdist(species_vector_two_ecosystems, method = "jaccard"): you have empty rows: their dissimilarities may be
## meaningless in method "jaccard"
## Warning in vegdist(species_vector_two_ecosystems, method = "bray"): you have empty rows: their dissimilarities may be
## meaningless in method "bray"
## Warning in vegdist(species_vector_two_ecosystems, method = "jaccard"): you have empty rows: their dissimilarities may be
## meaningless in method "jaccard"
## Warning in vegdist(species_vector_two_ecosystems, method = "bray"): you have empty rows: their dissimilarities may be
## meaningless in method "bray"
## Warning in vegdist(species_vector_two_ecosystems, method = "jaccard"): you have empty rows: their dissimilarities may be
## meaningless in method "jaccard"
## Warning in vegdist(species_vector_two_ecosystems, method = "jaccard"): missing
## values in results
## Warning in vegdist(species_vector_two_ecosystems, method = "bray"): you have empty rows: their dissimilarities may be
## meaningless in method "bray"
## Warning in vegdist(species_vector_two_ecosystems, method = "bray"): missing
## values in results
## Warning in vegdist(species_vector_two_ecosystems, method = "jaccard"): you have empty rows: their dissimilarities may be
## meaningless in method "jaccard"
## Warning in vegdist(species_vector_two_ecosystems, method = "jaccard"): missing
## values in results
## Warning in vegdist(species_vector_two_ecosystems, method = "bray"): you have empty rows: their dissimilarities may be
## meaningless in method "bray"
## Warning in vegdist(species_vector_two_ecosystems, method = "bray"): missing
## values in results
## Warning in vegdist(species_vector_two_ecosystems, method = "jaccard"): you have empty rows: their dissimilarities may be
## meaningless in method "jaccard"
## Warning in vegdist(species_vector_two_ecosystems, method = "bray"): you have empty rows: their dissimilarities may be
## meaningless in method "bray"
## Warning in vegdist(species_vector_two_ecosystems, method = "jaccard"): you have empty rows: their dissimilarities may be
## meaningless in method "jaccard"
## Warning in vegdist(species_vector_two_ecosystems, method = "bray"): you have empty rows: their dissimilarities may be
## meaningless in method "bray"
# Bind everything together
ds_metaecosystems = ds_metaecosystems %>%
bind_rows()
# Test: check the number of rows are right
expect_equal(nrow(ds_metaecosystems),
n_time_points * n_ecosystems_combinations)
metaecosystem_type_selected = c("Medium-Medium", "Small-Large")
response_variable_selected = "mean_shannon"
# --- ORIGINAL DATA - PLOT MEAN ± 95% CI --- #
# Create plots
p1=plot.metaecos.points(ds_metaecosystems %>% filter(disturbance == "high"),
metaecosystem_type_selected,
response_variable_selected) +
annotate("text",
x = Inf,
y = Inf,
label = "High disturbance",
hjust = 1.1,
vjust = 1.1,
size = 5,
fontface = "bold") + # Adjust position and style
theme(axis.title.x = element_blank(), # Remove x-axis title
axis.text.x = element_blank()) # Remove x-axis text
p2=plot.metaecos.points(ds_metaecosystems %>% filter(disturbance == "low"),
metaecosystem_type_selected,
response_variable_selected) +
theme(legend.position = "none") +
annotate("text",
x = Inf,
y = Inf,
label = "Low disturbance",
hjust = 1.1,
vjust = 1.1,
size = 5,
fontface = "bold") # Adjust position and style
# Arrange the plots vertically
ggarrange(p1,
p2,
ncol = 1,
nrow = 2,
heights = c(0.9, 1),
common.legend = TRUE,
align = "v")
# --- ORIGINAL DATA - PLOT SINGLE REPLICATES --- #
p1=plot.metaecos.replicates(ds_metaecosystems %>% filter(disturbance == "high"),
metaecosystem_type_selected,
response_variable_selected) +
annotate("text",
x = Inf,
y = Inf,
label = "High disturbance",
hjust = 1.1,
vjust = 1.1,
size = 5,
fontface = "bold") + # Adjust position and style
theme(axis.title.x = element_blank(), # Remove x-axis title
axis.text.x = element_blank()) # Remove x-axis text
p2=plot.metaecos.replicates(ds_metaecosystems %>% filter(disturbance == "low"),
metaecosystem_type_selected,
response_variable_selected) +
theme(legend.position = "none") +
annotate("text",
x = Inf,
y = Inf,
label = "Low disturbance",
hjust = 1.1,
vjust = 1.1,
size = 5,
fontface = "bold") # Adjust position and style
# Arrange the plots vertically
ggarrange(p1,
p2,
ncol = 1,
nrow = 2,
heights = c(0.9, 1),
common.legend = TRUE,
align = "v")
# --- PREPARE DATA --- #
# Add baselines
baselines = ds_metaecosystems %>%
filter(time_point == time_point_of_baselines) %>%
select(system_nr,
all_of(response_variable_selected)) %>%
rename(baseline = all_of(response_variable_selected))
data_for_analysis = ds_metaecosystems %>%
left_join(baselines)
# Filter and change level names
data_for_analysis = data_for_analysis %>%
filter(time_point %in% time_points_model,
metaecosystem_type %in% metaecosystem_type_selected,
#!is.na(total_water_addition_ml),
!is.na(!!sym(response_variable_selected))) %>%
mutate(metaecosystem_type = case_when(metaecosystem_type == "Small-Large unconnected" ~ "SL unc",
metaecosystem_type == "Medium-Medium unconnected" ~ "MM unc",
metaecosystem_type == "Small-Small meta-ecosystem" ~ "SS con",
metaecosystem_type == "Medium-Medium meta-ecosystem" ~ "MM con",
metaecosystem_type == "Large-Large meta-ecosystem" ~ "LL con",
metaecosystem_type == "Small-Large meta-ecosystem" ~ "SL con",
TRUE ~ metaecosystem_type),
type_conn = paste(metaecosystem_type, connection))
# --- DATA FOR ANALYSIS - PLOT MEAN ± 95% CI OF FILTERED DATA --- #
p1=plot.metaecos.points(data_for_analysis %>% filter(disturbance == "high"),
metaecosystem_type_selected,
response_variable_selected) +
annotate("text",
x = Inf,
y = Inf,
label = "High disturbance",
hjust = 1.1,
vjust = 1.1,
size = 5,
fontface = "bold") + # Adjust position and style
theme(axis.title.x = element_blank(), # Remove x-axis title
axis.text.x = element_blank()) # Remove x-axis text
p2=plot.metaecos.points(data_for_analysis %>% filter(disturbance == "low"),
metaecosystem_type_selected,
response_variable_selected) +
theme(legend.position = "none") +
annotate("text",
x = Inf,
y = Inf,
label = "Low disturbance",
hjust = 1.1,
vjust = 1.1,
size = 5,
fontface = "bold") # Adjust position and style
# Arrange the plots vertically
ggarrange(p1,
p2,
ncol = 1,
nrow = 2,
heights = c(1, 0.7))
# --- DEFINE MODEL FORMULA --- #
formula = paste("get(response_variable_selected) ~",
"type_conn * disturbance * day +",
"(day | baseline) +",
"(day | system_nr)") %>%
print()
## [1] "get(response_variable_selected) ~ type_conn * disturbance * day + (day | baseline) + (day | system_nr)"
# --- FIND ECOSYSTEM COMBINATIONS FOR ANALYSIS --- #
# Set up parameters
bootstrap_iterations = 1000
# Produce random (bootstrapped) rows
random_sets_of_sets <- runif(bootstrap_iterations,
min = 1,
max = nrow(ecos_combin_unconn_sets_of_sets)) %>%
round()
# Filter combinations according to the random rows
sets_of_sets_filtered = ecos_combin_unconn_sets_of_sets %>%
filter(row_number() %in% random_sets_of_sets)
# --- DEFINE WHERE TO SAVE (AND FROM WHERE TO LATER READ) THE RESULTS OF THE ANALYSIS --- #
file_path = here("..",
"3_results",
"tables",
paste0("results_metaeco_",
response_variable_selected,
"_",
bootstrap_iterations,
"_iterations",
".csv"))
# --- FIND MODEL STATISTICS THROUGH MULTIPLE ITERATIONS RESHUFFLING ECOSYSTEM COMBINATIONS --- #
# Set parameters and initialise
results_table = list()
failed_optimizers = 0
# Fit models
for (comb_i in 1:bootstrap_iterations) {
# Find system numbers
system_nr_unconn_selected = ecos_combin_unconn_sets %>%
filter(metaecosystem_type == "Small-Large" &
disturbance == "low" &
set == sets_of_sets_filtered[comb_i, ]$set_SL_low |
metaecosystem_type == "Small-Large" &
disturbance == "high" &
set == sets_of_sets_filtered[comb_i, ]$set_SL_high |
metaecosystem_type == "Medium-Medium" &
disturbance == "low" &
set == sets_of_sets_filtered[comb_i, ]$set_MM_low |
metaecosystem_type == "Medium-Medium" &
disturbance == "high" &
set == sets_of_sets_filtered[comb_i, ]$set_MM_high) %>%
pull(system_nr)
# Prepare data for analysis
data_for_analysis_comb_i = data_for_analysis %>%
filter(system_nr %in% system_nr_unconn_selected | connection == "connected")
# Run model
model = try.different.optimizers.metaecos(data_for_analysis_comb_i,
formula)
# If all the optimisers fail, move on to the next iteration
if (is.null(model)) {
cat("This model could not be fitted with any optimiser (",
system_nr_unconn_selected,
") \n")
failed_optimizers = failed_optimizers + 1
next
}
# Residuals - show Q-Q plot
# print(qqnorm(resid(model))); print(qqline(resid(model)))
# Residuals - save Residuals vs Fitted plot
# plot = data_for_analysis_comb_i %>%
# mutate(predicted = fitted(model),
# residuals = resid(model)) %>%
# ggplot(aes(x = predicted,
# y = residuals)) +
# geom_point()
#
# ggsave(here("3_results",
# "residual_plots",
# paste0("res_vs_fit_",
# response_variable_selected,
# "_combination_",
# comb_i,
# ".png")),
# plot = plot,
# width = 8,
# height = 6)
# Set up contrasts
emmeans_output = emmeans(model,
specs = ~ type_conn * day * disturbance ,
method = "pairwise",
adjust = "sidak",
bias.adj = TRUE,
lmer.df = "satterthwaite")
summary(emmeans_output)
zeros = rep(0, 8)
high_MM_conn = zeros; high_MM_conn[1] = 1
high_MM_unc = zeros; high_MM_unc[2] = 1
high_SL_conn = zeros; high_SL_conn[3] = 1
high_SL_unc = zeros; high_SL_unc[4] = 1
low_MM_conn = zeros; low_MM_conn[5] = 1
low_MM_unc = zeros; low_MM_unc[6] = 1
low_SL_conn = zeros; low_SL_conn[7] = 1
low_SL_unc = zeros; low_SL_unc[8] = 1
# Save contrasts in a table
results_table[[comb_i]] = contrast(
emmeans_output,
method = list("high SL_conn - SL_unc" = high_SL_conn - high_SL_unc,
"high MM_conn - MM_unc" = high_MM_conn - high_MM_unc,
"low SL_conn - SL_unc" = low_SL_conn - low_SL_unc,
"low MM_conn - MM_unc" = low_MM_conn - low_MM_unc)) %>%
as.data.frame() %>%
mutate(combination = comb_i,
system_nr_unconnected_systems = paste(system_nr_unconn_selected, collapse = ", "))
}
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1005 1008 1012 1019 1021 1028 1035 1037 1044 1046 1055 1056 1063 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1001 1007 1014 1020 1023 1029 1035 1037 1043 1052 1047 1056 1063 )
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1005 1009 1011 1017 1023 1027 1034 1038 1041 1050 1049 1056 1064 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1005 1008 1012 1016 1024 1028 1035 1039 1042 1050 1055 1056 1064 )
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nloptwrap (NLOPT_LN_NELDERMEAD)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1001 1007 1014 1018 1025 1026 1032 1038 1045 1047 1051 1057 1061 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nloptwrap (NLOPT_LN_NELDERMEAD)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1001 1008 1012 1020 1024 1027 1033 1039 1041 1051 1054 1057 1061 )
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nloptwrap (NLOPT_LN_NELDERMEAD)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1005 1008 1014 1016 1022 1029 1032 1038 1045 1050 1055 1057 1062 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1001 1010 1012 1019 1023 1030 1031 1038 1044 1053 1049 1057 1062 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1005 1007 1011 1019 1023 1027 1035 1039 1041 1055 1050 1057 1062 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1004 1006 1015 1018 1022 1026 1032 1039 1045 1052 1047 1057 1065 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1003 1007 1014 1020 1021 1026 1032 1039 1043 1052 1048 1057 1065 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nloptwrap (NLOPT_LN_NELDERMEAD)"
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1002 1009 1013 1020 1021 1027 1031 1039 1043 1048 1050 1058 1060 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1001 1008 1014 1020 1022 1029 1032 1040 1041 1054 1051 1058 1060 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1001 1009 1015 1018 1022 1026 1033 1040 1042 1053 1052 1058 1062 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1003 1009 1015 1016 1022 1027 1031 1040 1044 1047 1052 1058 1064 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1003 1009 1011 1017 1025 1029 1032 1036 1043 1048 1052 1058 1064 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1003 1009 1012 1020 1021 1030 1032 1036 1044 1047 1051 1059 1060 )
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1003 1009 1012 1016 1025 1027 1033 1039 1045 1047 1055 1059 1060 )
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1004 1008 1012 1016 1025 1030 1032 1038 1044 1050 1048 1059 1060 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nloptwrap (NLOPT_LN_NELDERMEAD)"
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1001 1008 1012 1020 1024 1027 1035 1038 1044 1046 1055 1059 1061 )
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nloptwrap (NLOPT_LN_NELDERMEAD)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nloptwrap (NLOPT_LN_NELDERMEAD)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1002 1008 1011 1019 1025 1028 1031 1040 1042 1052 1048 1059 1063 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1004 1007 1011 1020 1023 1029 1032 1040 1043 1046 1055 1060 1059 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: nloptwrap (NLOPT_LN_NELDERMEAD)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nloptwrap (NLOPT_LN_NELDERMEAD)"
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1005 1009 1013 1016 1022 1026 1034 1040 1043 1053 1052 1060 1059 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: nloptwrap (NLOPT_LN_NELDERMEAD)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1005 1006 1012 1018 1024 1028 1034 1040 1042 1050 1049 1060 1065 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1003 1006 1015 1017 1024 1028 1032 1036 1045 1052 1053 1060 1065 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1001 1008 1015 1017 1024 1028 1031 1039 1045 1051 1047 1061 1057 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1003 1010 1014 1017 1021 1029 1033 1040 1042 1052 1048 1061 1057 )
## [1] "Model successfully fitted with optimizer: nloptwrap (NLOPT_LN_NELDERMEAD)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nloptwrap (NLOPT_LN_NELDERMEAD)"
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1003 1007 1011 1019 1025 1028 1032 1036 1045 1047 1051 1061 1059 )
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1004 1010 1012 1018 1021 1026 1033 1039 1045 1047 1055 1061 1059 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1004 1006 1012 1018 1025 1027 1031 1040 1044 1051 1047 1061 1059 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1004 1008 1011 1017 1025 1028 1035 1039 1041 1051 1054 1061 1059 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1003 1006 1015 1019 1022 1029 1035 1038 1042 1052 1048 1061 1059 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1002 1009 1011 1018 1025 1027 1031 1040 1043 1049 1051 1061 1064 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1002 1009 1013 1016 1025 1028 1034 1036 1045 1054 1048 1061 1064 )
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1002 1006 1013 1019 1025 1028 1034 1040 1041 1054 1051 1061 1064 )
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1004 1007 1015 1018 1021 1027 1034 1038 1041 1055 1047 1061 1064 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1005 1007 1011 1019 1023 1026 1034 1038 1042 1047 1055 1062 1057 )
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1001 1007 1015 1018 1024 1028 1035 1036 1042 1048 1050 1062 1057 )
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1002 1008 1011 1020 1024 1028 1035 1037 1044 1048 1050 1062 1057 )
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1003 1007 1011 1020 1024 1030 1033 1037 1044 1048 1054 1062 1057 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1003 1009 1012 1016 1025 1026 1033 1037 1045 1051 1047 1062 1057 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nloptwrap (NLOPT_LN_NELDERMEAD)"
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nloptwrap (NLOPT_LN_NELDERMEAD)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: nloptwrap (NLOPT_LN_NELDERMEAD)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1004 1007 1011 1018 1025 1029 1032 1038 1045 1052 1048 1062 1058 )
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1003 1009 1011 1020 1022 1026 1034 1038 1045 1053 1046 1062 1058 )
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1001 1007 1015 1018 1024 1028 1031 1037 1045 1053 1052 1062 1058 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: nloptwrap (NLOPT_LN_NELDERMEAD)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1005 1006 1014 1017 1023 1027 1034 1036 1043 1053 1046 1062 1063 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nloptwrap (NLOPT_LN_NELDERMEAD)"
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1004 1007 1015 1018 1021 1028 1032 1039 1045 1055 1050 1062 1063 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1003 1006 1014 1020 1022 1029 1033 1040 1042 1047 1055 1063 1056 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1002 1008 1015 1019 1021 1026 1032 1040 1044 1048 1052 1063 1056 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1005 1006 1012 1019 1023 1026 1035 1039 1043 1047 1051 1063 1059 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1002 1006 1013 1019 1025 1027 1033 1040 1041 1047 1051 1063 1059 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nloptwrap (NLOPT_LN_NELDERMEAD)"
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1005 1006 1012 1019 1023 1029 1031 1038 1045 1050 1049 1063 1059 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1005 1008 1014 1017 1021 1029 1035 1036 1043 1055 1050 1063 1059 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1005 1008 1012 1016 1024 1028 1032 1039 1041 1046 1054 1063 1062 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1002 1009 1013 1020 1021 1026 1034 1040 1043 1049 1051 1064 1058 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nloptwrap (NLOPT_LN_NELDERMEAD)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: nloptwrap (NLOPT_LN_NELDERMEAD)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1004 1007 1013 1020 1021 1026 1034 1040 1043 1048 1054 1065 1056 )
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: nloptwrap (NLOPT_LN_NELDERMEAD)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: nloptwrap (NLOPT_LN_NELDERMEAD)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nloptwrap (NLOPT_LN_NELDERMEAD)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1003 1006 1015 1019 1022 1028 1034 1040 1042 1054 1046 1065 1057 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1003 1007 1014 1020 1021 1026 1034 1037 1043 1047 1051 1065 1060 )
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1001 1009 1015 1018 1022 1026 1033 1037 1045 1047 1055 1065 1060 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1004 1010 1011 1018 1022 1026 1033 1037 1044 1049 1051 1065 1060 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nloptwrap (NLOPT_LN_NELDERMEAD)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nloptwrap (NLOPT_LN_NELDERMEAD)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1005 1008 1014 1016 1022 1030 1033 1036 1042 1053 1052 1065 1060 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1001 1010 1014 1017 1023 1029 1035 1036 1043 1055 1050 1065 1060 )
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1002 1006 1015 1018 1024 1029 1032 1038 1041 1055 1050 1065 1060 )
## [1] "Model successfully fitted with optimizer: bobyqa "
# Tell how many optimizers failed
print(paste((failed_optimizers/bootstrap_iterations * 100),
"% of combinations created models that could not be fit"))
## [1] "6.2 % of combinations created models that could not be fit"
# Bind rows within the list results_table
results_table = results_table %>%
bind_rows()
# Save the results
write.csv(results_table,
file = file_path,
row.names = F)
# --- READ THE RESULTS AFTER LENGTHY COMPUTATION --- #
results_table = read.csv(file = file_path)
# --- SHOW ITERATED RESULTS - P VALUE DISTRIBUTIONS --- #
results_table %>%
filter(contrast == "high MM_conn - MM_unc") %>%
pull(p.value) %>%
hist(main = "p values high MM_conn - MM_unc")
results_table %>%
filter(contrast == "high SL_conn - SL_unc") %>%
pull(p.value) %>%
hist(main = "p values high SL_conn - SL_unc")
results_table %>%
filter(contrast == "low MM_conn - MM_unc") %>%
pull(p.value) %>%
hist(main = "p values low MM_conn - MM_unc")
results_table %>%
filter(contrast == "low SL_conn - SL_unc") %>%
pull(p.value) %>%
hist(main = "p values low SL_conn vs SL_unc")
# --- SHOW ITERATED RESULTS - TABLE WITH AVERAGED VALUES --- #
results_table %>%
group_by(contrast) %>%
summarise(estimate = median(estimate),
SE = median(SE),
df = median(df),
t.ratio = median(t.ratio),
p.value = median(p.value)) %>%
as.data.frame() %>%
mutate(estimate = round(estimate, digits = 3),
SE = round(SE, digits = 3),
df = round(df, digits = 3),
t.ratio = round(t.ratio, digits = 3),
p.value = round(p.value, digits = 3),
evidence = "",
evidence = ifelse(p.value > 0.1,
"none",
evidence),
evidence = ifelse(p.value < 0.1,
"* weak",
evidence),
evidence = ifelse(p.value < 0.05,
"** moderate",
evidence),
evidence = ifelse(p.value < 0.01,
"*** strong",
evidence),
evidence = ifelse(p.value < 0.001,
"**** very strong",
evidence),
p.value = ifelse(p.value < 0.001,
"< 0.001",
p.value))
## contrast estimate SE df t.ratio p.value evidence
## 1 high MM_conn - MM_unc 0.115 0.078 37.56 1.497 0.142 none
## 2 high SL_conn - SL_unc 0.190 0.063 37.56 3.034 0.004 *** strong
## 3 low MM_conn - MM_unc -0.003 0.078 37.56 -0.034 0.933 none
## 4 low SL_conn - SL_unc 0.182 0.059 37.56 3.075 0.004 *** strong
response_variable_selected = "bray_curtis"
# --- ORIGINAL DATA - PLOT MEAN ± 95% CI --- #
# Create plots
p1=plot.metaecos.points(ds_metaecosystems %>% filter(disturbance == "high"),
metaecosystem_type_selected,
response_variable_selected) +
annotate("text",
x = Inf,
y = Inf,
label = "High disturbance",
hjust = 1.1,
vjust = 1.1,
size = 5,
fontface = "bold") + # Adjust position and style
theme(axis.title.x = element_blank(), # Remove x-axis title
axis.text.x = element_blank()) # Remove x-axis text
p2=plot.metaecos.points(ds_metaecosystems %>% filter(disturbance == "low"),
metaecosystem_type_selected,
response_variable_selected) +
theme(legend.position = "none") +
annotate("text",
x = Inf,
y = Inf,
label = "Low disturbance",
hjust = 1.1,
vjust = 1.1,
size = 5,
fontface = "bold") # Adjust position and style
# Arrange the plots vertically
ggarrange(p1,
p2,
ncol = 1,
nrow = 2,
heights = c(0.9, 1),
common.legend = TRUE,
align = "v")
# --- ORIGINAL DATA - PLOT SINGLE REPLICATES --- #
p1=plot.metaecos.replicates(ds_metaecosystems %>% filter(disturbance == "high"),
metaecosystem_type_selected,
response_variable_selected) +
annotate("text",
x = Inf,
y = Inf,
label = "High disturbance",
hjust = 1.1,
vjust = 1.1,
size = 5,
fontface = "bold") + # Adjust position and style
theme(axis.title.x = element_blank(), # Remove x-axis title
axis.text.x = element_blank()) # Remove x-axis text
p2=plot.metaecos.replicates(ds_metaecosystems %>% filter(disturbance == "low"),
metaecosystem_type_selected,
response_variable_selected) +
theme(legend.position = "none") +
annotate("text",
x = Inf,
y = Inf,
label = "Low disturbance",
hjust = 1.1,
vjust = 1.1,
size = 5,
fontface = "bold") # Adjust position and style
# Arrange the plots vertically
ggarrange(p1,
p2,
ncol = 1,
nrow = 2,
heights = c(0.9, 1),
common.legend = TRUE,
align = "v")
# --- PREPARE DATA --- #
# Add baselines
baselines = ds_metaecosystems %>%
filter(time_point == time_point_of_baselines) %>%
select(system_nr,
all_of(response_variable_selected)) %>%
rename(baseline = all_of(response_variable_selected))
data_for_analysis = ds_metaecosystems %>%
left_join(baselines)
# Filter and change level names
data_for_analysis = data_for_analysis %>%
filter(time_point %in% time_points_model,
metaecosystem_type %in% metaecosystem_type_selected,
#!is.na(total_water_addition_ml),
!is.na(!!sym(response_variable_selected))) %>%
mutate(metaecosystem_type = case_when(metaecosystem_type == "Small-Large unconnected" ~ "SL unc",
metaecosystem_type == "Medium-Medium unconnected" ~ "MM unc",
metaecosystem_type == "Small-Small meta-ecosystem" ~ "SS con",
metaecosystem_type == "Medium-Medium meta-ecosystem" ~ "MM con",
metaecosystem_type == "Large-Large meta-ecosystem" ~ "LL con",
metaecosystem_type == "Small-Large meta-ecosystem" ~ "SL con",
TRUE ~ metaecosystem_type),
type_conn = paste(metaecosystem_type, connection))
# --- DATA FOR ANALYSIS - PLOT MEAN ± 95% CI OF FILTERED DATA --- #
p1=plot.metaecos.points(data_for_analysis %>% filter(disturbance == "high"),
metaecosystem_type_selected,
response_variable_selected) +
annotate("text",
x = Inf,
y = Inf,
label = "High disturbance",
hjust = 1.1,
vjust = 1.1,
size = 5,
fontface = "bold") + # Adjust position and style
theme(axis.title.x = element_blank(), # Remove x-axis title
axis.text.x = element_blank()) # Remove x-axis text
p2=plot.metaecos.points(data_for_analysis %>% filter(disturbance == "low"),
metaecosystem_type_selected,
response_variable_selected) +
theme(legend.position = "none") +
annotate("text",
x = Inf,
y = Inf,
label = "Low disturbance",
hjust = 1.1,
vjust = 1.1,
size = 5,
fontface = "bold") # Adjust position and style
# Arrange the plots vertically
ggarrange(p1,
p2,
ncol = 1,
nrow = 2,
heights = c(1, 0.7))
# --- DEFINE MODEL FORMULA --- #
formula = paste("get(response_variable_selected) ~",
"type_conn * disturbance * day +",
"(day | baseline) +",
"(day | system_nr)") %>%
print()
## [1] "get(response_variable_selected) ~ type_conn * disturbance * day + (day | baseline) + (day | system_nr)"
# --- FIND ECOSYSTEM COMBINATIONS FOR ANALYSIS --- #
# Set up parameters
bootstrap_iterations = 1000
# Produce random (bootstrapped) rows
random_sets_of_sets <- runif(bootstrap_iterations,
min = 1,
max = nrow(ecos_combin_unconn_sets_of_sets)) %>%
round()
# Filter combinations according to the random rows
sets_of_sets_filtered = ecos_combin_unconn_sets_of_sets %>%
filter(row_number() %in% random_sets_of_sets)
# --- DEFINE WHERE TO SAVE (AND FROM WHERE TO LATER READ) THE RESULTS OF THE ANALYSIS --- #
file_path = here("..",
"3_results",
"tables",
paste0("results_metaeco_",
response_variable_selected,
"_",
bootstrap_iterations,
"_iterations",
".csv"))
# --- FIND MODEL STATISTICS THROUGH MULTIPLE ITERATIONS RESHUFFLING ECOSYSTEM COMBINATIONS --- #
# Set parameters and initialise
results_table = list()
failed_optimizers = 0
# Fit models
for (comb_i in 1:bootstrap_iterations) {
# Find system numbers
system_nr_unconn_selected = ecos_combin_unconn_sets %>%
filter(metaecosystem_type == "Small-Large" &
disturbance == "low" &
set == sets_of_sets_filtered[comb_i, ]$set_SL_low |
metaecosystem_type == "Small-Large" &
disturbance == "high" &
set == sets_of_sets_filtered[comb_i, ]$set_SL_high |
metaecosystem_type == "Medium-Medium" &
disturbance == "low" &
set == sets_of_sets_filtered[comb_i, ]$set_MM_low |
metaecosystem_type == "Medium-Medium" &
disturbance == "high" &
set == sets_of_sets_filtered[comb_i, ]$set_MM_high) %>%
pull(system_nr)
# Prepare data for analysis
data_for_analysis_comb_i = data_for_analysis %>%
filter(system_nr %in% system_nr_unconn_selected | connection == "connected")
# Run model
model = try.different.optimizers.metaecos(data_for_analysis_comb_i,
formula)
# If all the optimisers fail, move on to the next iteration
if (is.null(model)) {
cat("This model could not be fitted with any optimiser (",
system_nr_unconn_selected,
") \n")
failed_optimizers = failed_optimizers + 1
next
}
# Residuals - show Q-Q plot
# print(qqnorm(resid(model))); print(qqline(resid(model)))
# Residuals - save Residuals vs Fitted plot
# plot = data_for_analysis_comb_i %>%
# mutate(predicted = fitted(model),
# residuals = resid(model)) %>%
# ggplot(aes(x = predicted,
# y = residuals)) +
# geom_point()
#
# ggsave(here("3_results",
# "residual_plots",
# paste0("res_vs_fit_",
# response_variable_selected,
# "_combination_",
# comb_i,
# ".png")),
# plot = plot,
# width = 8,
# height = 6)
# Set up contrasts
emmeans_output = emmeans(model,
specs = ~ type_conn * day * disturbance ,
method = "pairwise",
adjust = "sidak",
bias.adj = TRUE,
lmer.df = "satterthwaite")
summary(emmeans_output)
zeros = rep(0, 8)
high_MM_conn = zeros; high_MM_conn[1] = 1
high_MM_unc = zeros; high_MM_unc[2] = 1
high_SL_conn = zeros; high_SL_conn[3] = 1
high_SL_unc = zeros; high_SL_unc[4] = 1
low_MM_conn = zeros; low_MM_conn[5] = 1
low_MM_unc = zeros; low_MM_unc[6] = 1
low_SL_conn = zeros; low_SL_conn[7] = 1
low_SL_unc = zeros; low_SL_unc[8] = 1
# Save contrasts in a table
results_table[[comb_i]] = contrast(
emmeans_output,
method = list("high SL_conn - SL_unc" = high_SL_conn - high_SL_unc,
"high MM_conn - MM_unc" = high_MM_conn - high_MM_unc,
"low SL_conn - SL_unc" = low_SL_conn - low_SL_unc,
"low MM_conn - MM_unc" = low_MM_conn - low_MM_unc)) %>%
as.data.frame() %>%
mutate(combination = comb_i,
system_nr_unconnected_systems = paste(system_nr_unconn_selected, collapse = ", "))
}
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1002 1006 1014 1018 1025 1026 1032 1040 1043 1051 1047 1056 1064 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1001 1007 1013 1019 1025 1030 1032 1038 1041 1055 1050 1056 1064 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1005 1008 1014 1016 1022 1029 1031 1037 1045 1050 1055 1056 1065 )
## [1] "Model successfully fitted with optimizer: nloptwrap (NLOPT_LN_NELDERMEAD)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1001 1008 1014 1017 1025 1030 1033 1039 1042 1052 1047 1056 1065 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nloptwrap (NLOPT_LN_NELDERMEAD)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1005 1008 1014 1016 1022 1030 1031 1037 1043 1053 1052 1057 1062 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1005 1007 1014 1018 1021 1027 1033 1039 1045 1055 1050 1057 1062 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1002 1008 1014 1020 1021 1026 1035 1039 1042 1049 1050 1057 1065 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1002 1008 1014 1016 1025 1030 1034 1038 1042 1049 1053 1058 1060 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1005 1009 1011 1017 1023 1027 1034 1038 1041 1052 1047 1058 1062 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1003 1010 1011 1019 1022 1028 1031 1039 1045 1048 1052 1058 1064 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1003 1007 1015 1019 1021 1027 1031 1040 1043 1050 1048 1058 1064 )
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nloptwrap (NLOPT_LN_NELDERMEAD)"
## [1] "Model successfully fitted with optimizer: nloptwrap (NLOPT_LN_NELDERMEAD)"
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1005 1009 1012 1018 1021 1028 1035 1037 1041 1052 1047 1058 1064 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1004 1010 1011 1017 1023 1026 1033 1040 1044 1054 1051 1059 1060 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1003 1006 1014 1020 1022 1030 1033 1036 1044 1047 1051 1059 1061 )
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1004 1006 1013 1017 1025 1030 1033 1037 1044 1050 1055 1059 1063 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nloptwrap (NLOPT_LN_NELDERMEAD)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nloptwrap (NLOPT_LN_NELDERMEAD)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1001 1010 1014 1018 1022 1026 1035 1039 1043 1050 1055 1060 1059 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nloptwrap (NLOPT_LN_NELDERMEAD)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1004 1007 1013 1016 1025 1029 1031 1038 1042 1055 1047 1060 1059 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1005 1008 1014 1017 1021 1026 1032 1038 1045 1053 1046 1060 1065 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1002 1006 1014 1018 1025 1030 1031 1037 1044 1053 1052 1060 1065 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1003 1009 1011 1017 1025 1030 1034 1036 1042 1051 1054 1061 1059 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nloptwrap (NLOPT_LN_NELDERMEAD)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1003 1010 1012 1019 1021 1027 1034 1038 1041 1054 1046 1062 1057 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nloptwrap (NLOPT_LN_NELDERMEAD)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1002 1010 1011 1019 1023 1026 1034 1038 1042 1050 1048 1063 1062 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1002 1006 1013 1019 1025 1028 1032 1036 1044 1053 1046 1063 1062 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nloptwrap (NLOPT_LN_NELDERMEAD)"
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1002 1008 1011 1019 1025 1029 1033 1040 1042 1050 1048 1064 1056 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1001 1007 1014 1018 1025 1029 1032 1036 1045 1050 1055 1064 1056 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1004 1008 1015 1016 1022 1027 1035 1039 1043 1051 1049 1064 1056 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1004 1007 1013 1020 1021 1030 1034 1037 1041 1054 1051 1064 1056 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1002 1010 1014 1018 1021 1027 1033 1040 1041 1047 1055 1064 1058 )
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1005 1007 1013 1019 1021 1028 1032 1039 1045 1049 1050 1064 1058 )
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nloptwrap (NLOPT_LN_NELDERMEAD)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nloptwrap (NLOPT_LN_NELDERMEAD)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1005 1008 1014 1016 1022 1029 1035 1036 1042 1053 1046 1065 1060 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1004 1010 1012 1016 1023 1029 1035 1037 1041 1055 1047 1065 1060 )
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
# Tell how many optimizers failed
print(paste((failed_optimizers/bootstrap_iterations * 100),
"% of combinations created models that could not be fit"))
## [1] "3.1 % of combinations created models that could not be fit"
# Bind rows within the list results_table
results_table = results_table %>%
bind_rows()
# Save the results
write.csv(results_table,
file = file_path,
row.names = F)
# --- READ THE RESULTS AFTER LENGTHY COMPUTATION --- #
results_table = read.csv(file = file_path)
# --- SHOW ITERATED RESULTS - P VALUE DISTRIBUTIONS --- #
results_table %>%
filter(contrast == "high MM_conn - MM_unc") %>%
pull(p.value) %>%
hist(main = "p values high MM_conn - MM_unc")
results_table %>%
filter(contrast == "high SL_conn - SL_unc") %>%
pull(p.value) %>%
hist(main = "p values high SL_conn - SL_unc")
results_table %>%
filter(contrast == "low MM_conn - MM_unc") %>%
pull(p.value) %>%
hist(main = "p values low MM_conn - MM_unc")
results_table %>%
filter(contrast == "low SL_conn - SL_unc") %>%
pull(p.value) %>%
hist(main = "p values low SL_conn vs SL_unc")
# --- SHOW ITERATED RESULTS - TABLE WITH AVERAGED VALUES --- #
results_table %>%
group_by(contrast) %>%
summarise(estimate = median(estimate),
SE = median(SE),
df = median(df),
t.ratio = median(t.ratio),
p.value = median(p.value)) %>%
as.data.frame() %>%
mutate(estimate = round(estimate, digits = 3),
SE = round(SE, digits = 3),
df = round(df, digits = 3),
t.ratio = round(t.ratio, digits = 3),
p.value = round(p.value, digits = 3),
evidence = "",
evidence = ifelse(p.value > 0.1,
"none",
evidence),
evidence = ifelse(p.value < 0.1,
"* weak",
evidence),
evidence = ifelse(p.value < 0.05,
"** moderate",
evidence),
evidence = ifelse(p.value < 0.01,
"*** strong",
evidence),
evidence = ifelse(p.value < 0.001,
"**** very strong",
evidence),
p.value = ifelse(p.value < 0.001,
"< 0.001",
p.value))
## contrast estimate SE df t.ratio p.value evidence
## 1 high MM_conn - MM_unc 0.064 0.045 44.803 1.377 0.174 none
## 2 high SL_conn - SL_unc -0.124 0.036 44.803 -3.407 0.001 *** strong
## 3 low MM_conn - MM_unc 0.065 0.045 44.803 1.432 0.157 none
## 4 low SL_conn - SL_unc -0.129 0.034 44.803 -3.800 < 0.001 **** very strong
response_variable_selected = "metaecosystem_richness"
# --- ORIGINAL DATA - PLOT MEAN ± 95% CI --- #
# Create plots
p1=plot.metaecos.points(ds_metaecosystems %>% filter(disturbance == "high"),
metaecosystem_type_selected,
response_variable_selected) +
annotate("text",
x = Inf,
y = Inf,
label = "High disturbance",
hjust = 1.1,
vjust = 1.1,
size = 5,
fontface = "bold") + # Adjust position and style
theme(axis.title.x = element_blank(), # Remove x-axis title
axis.text.x = element_blank()) # Remove x-axis text
p2=plot.metaecos.points(ds_metaecosystems %>% filter(disturbance == "low"),
metaecosystem_type_selected,
response_variable_selected) +
theme(legend.position = "none") +
annotate("text",
x = Inf,
y = Inf,
label = "Low disturbance",
hjust = 1.1,
vjust = 1.1,
size = 5,
fontface = "bold") # Adjust position and style
# Arrange the plots vertically
ggarrange(p1,
p2,
ncol = 1,
nrow = 2,
heights = c(0.9, 1),
common.legend = TRUE,
align = "v")
# --- ORIGINAL DATA - PLOT SINGLE REPLICATES --- #
p1=plot.metaecos.replicates(ds_metaecosystems %>% filter(disturbance == "high"),
metaecosystem_type_selected,
response_variable_selected) +
annotate("text",
x = Inf,
y = Inf,
label = "High disturbance",
hjust = 1.1,
vjust = 1.1,
size = 5,
fontface = "bold") + # Adjust position and style
theme(axis.title.x = element_blank(), # Remove x-axis title
axis.text.x = element_blank()) # Remove x-axis text
p2=plot.metaecos.replicates(ds_metaecosystems %>% filter(disturbance == "low"),
metaecosystem_type_selected,
response_variable_selected) +
theme(legend.position = "none") +
annotate("text",
x = Inf,
y = Inf,
label = "Low disturbance",
hjust = 1.1,
vjust = 1.1,
size = 5,
fontface = "bold") # Adjust position and style
# Arrange the plots vertically
ggarrange(p1,
p2,
ncol = 1,
nrow = 2,
heights = c(0.9, 1),
common.legend = TRUE,
align = "v")
# --- PREPARE DATA --- #
# Add baselines
baselines = ds_metaecosystems %>%
filter(time_point == time_point_of_baselines) %>%
select(system_nr,
all_of(response_variable_selected)) %>%
rename(baseline = all_of(response_variable_selected))
data_for_analysis = ds_metaecosystems %>%
left_join(baselines)
# Filter and change level names
data_for_analysis = data_for_analysis %>%
filter(time_point %in% time_points_model,
metaecosystem_type %in% metaecosystem_type_selected,
#!is.na(total_water_addition_ml),
!is.na(!!sym(response_variable_selected))) %>%
mutate(metaecosystem_type = case_when(metaecosystem_type == "Small-Large unconnected" ~ "SL unc",
metaecosystem_type == "Medium-Medium unconnected" ~ "MM unc",
metaecosystem_type == "Small-Small meta-ecosystem" ~ "SS con",
metaecosystem_type == "Medium-Medium meta-ecosystem" ~ "MM con",
metaecosystem_type == "Large-Large meta-ecosystem" ~ "LL con",
metaecosystem_type == "Small-Large meta-ecosystem" ~ "SL con",
TRUE ~ metaecosystem_type),
type_conn = paste(metaecosystem_type, connection))
# --- DATA FOR ANALYSIS - PLOT MEAN ± 95% CI OF FILTERED DATA --- #
p1=plot.metaecos.points(data_for_analysis %>% filter(disturbance == "high"),
metaecosystem_type_selected,
response_variable_selected) +
annotate("text",
x = Inf,
y = Inf,
label = "High disturbance",
hjust = 1.1,
vjust = 1.1,
size = 5,
fontface = "bold") + # Adjust position and style
theme(axis.title.x = element_blank(), # Remove x-axis title
axis.text.x = element_blank()) # Remove x-axis text
p2=plot.metaecos.points(data_for_analysis %>% filter(disturbance == "low"),
metaecosystem_type_selected,
response_variable_selected) +
theme(legend.position = "none") +
annotate("text",
x = Inf,
y = Inf,
label = "Low disturbance",
hjust = 1.1,
vjust = 1.1,
size = 5,
fontface = "bold") # Adjust position and style
# Arrange the plots vertically
ggarrange(p1,
p2,
ncol = 1,
nrow = 2,
heights = c(1, 0.7))
# --- DEFINE MODEL FORMULA --- #
formula = paste("get(response_variable_selected) ~",
"type_conn * disturbance * day +",
"(day | baseline) +",
"(day | system_nr)") %>%
print()
## [1] "get(response_variable_selected) ~ type_conn * disturbance * day + (day | baseline) + (day | system_nr)"
# --- FIND ECOSYSTEM COMBINATIONS FOR ANALYSIS --- #
# Set up parameters
bootstrap_iterations = 1000
# Produce random (bootstrapped) rows
random_sets_of_sets <- runif(bootstrap_iterations,
min = 1,
max = nrow(ecos_combin_unconn_sets_of_sets)) %>%
round()
# Filter combinations according to the random rows
sets_of_sets_filtered = ecos_combin_unconn_sets_of_sets %>%
filter(row_number() %in% random_sets_of_sets)
# --- DEFINE WHERE TO SAVE (AND FROM WHERE TO LATER READ) THE RESULTS OF THE ANALYSIS --- #
file_path = here("..",
"3_results",
"tables",
paste0("results_metaeco_",
response_variable_selected,
"_",
bootstrap_iterations,
"_iterations",
".csv"))
# --- FIND MODEL STATISTICS THROUGH MULTIPLE ITERATIONS RESHUFFLING ECOSYSTEM COMBINATIONS --- #
# Set parameters and initialise
results_table = list()
failed_optimizers = 0
# Fit models
for (comb_i in 1:bootstrap_iterations) {
# Find system numbers
system_nr_unconn_selected = ecos_combin_unconn_sets %>%
filter(metaecosystem_type == "Small-Large" &
disturbance == "low" &
set == sets_of_sets_filtered[comb_i, ]$set_SL_low |
metaecosystem_type == "Small-Large" &
disturbance == "high" &
set == sets_of_sets_filtered[comb_i, ]$set_SL_high |
metaecosystem_type == "Medium-Medium" &
disturbance == "low" &
set == sets_of_sets_filtered[comb_i, ]$set_MM_low |
metaecosystem_type == "Medium-Medium" &
disturbance == "high" &
set == sets_of_sets_filtered[comb_i, ]$set_MM_high) %>%
pull(system_nr)
# Prepare data for analysis
data_for_analysis_comb_i = data_for_analysis %>%
filter(system_nr %in% system_nr_unconn_selected | connection == "connected")
# Run model
model = try.different.optimizers.metaecos(data_for_analysis_comb_i,
formula)
# If all the optimisers fail, move on to the next iteration
if (is.null(model)) {
cat("This model could not be fitted with any optimiser (",
system_nr_unconn_selected,
") \n")
failed_optimizers = failed_optimizers + 1
next
}
# Residuals - show Q-Q plot
# print(qqnorm(resid(model))); print(qqline(resid(model)))
# Residuals - save Residuals vs Fitted plot
# plot = data_for_analysis_comb_i %>%
# mutate(predicted = fitted(model),
# residuals = resid(model)) %>%
# ggplot(aes(x = predicted,
# y = residuals)) +
# geom_point()
#
# ggsave(here("3_results",
# "residual_plots",
# paste0("res_vs_fit_",
# response_variable_selected,
# "_combination_",
# comb_i,
# ".png")),
# plot = plot,
# width = 8,
# height = 6)
# Set up contrasts
emmeans_output = emmeans(model,
specs = ~ type_conn * day * disturbance ,
method = "pairwise",
adjust = "sidak",
bias.adj = TRUE,
lmer.df = "satterthwaite")
summary(emmeans_output)
zeros = rep(0, 8)
high_MM_conn = zeros; high_MM_conn[1] = 1
high_MM_unc = zeros; high_MM_unc[2] = 1
high_SL_conn = zeros; high_SL_conn[3] = 1
high_SL_unc = zeros; high_SL_unc[4] = 1
low_MM_conn = zeros; low_MM_conn[5] = 1
low_MM_unc = zeros; low_MM_unc[6] = 1
low_SL_conn = zeros; low_SL_conn[7] = 1
low_SL_unc = zeros; low_SL_unc[8] = 1
# Save contrasts in a table
results_table[[comb_i]] = contrast(
emmeans_output,
method = list("high SL_conn - SL_unc" = high_SL_conn - high_SL_unc,
"high MM_conn - MM_unc" = high_MM_conn - high_MM_unc,
"low SL_conn - SL_unc" = low_SL_conn - low_SL_unc,
"low MM_conn - MM_unc" = low_MM_conn - low_MM_unc)) %>%
as.data.frame() %>%
mutate(combination = comb_i,
system_nr_unconnected_systems = paste(system_nr_unconn_selected, collapse = ", "))
}
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nloptwrap (NLOPT_LN_NELDERMEAD)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
# Tell how many optimizers failed
print(paste((failed_optimizers/bootstrap_iterations * 100),
"% of combinations created models that could not be fit"))
## [1] "0 % of combinations created models that could not be fit"
# Bind rows within the list results_table
results_table = results_table %>%
bind_rows()
# Save the results
write.csv(results_table,
file = file_path,
row.names = F)
# --- READ THE RESULTS AFTER LENGTHY COMPUTATION --- #
results_table = read.csv(file = file_path)
# --- SHOW ITERATED RESULTS - P VALUE DISTRIBUTIONS --- #
results_table %>%
filter(contrast == "high MM_conn - MM_unc") %>%
pull(p.value) %>%
hist(main = "p values high MM_conn - MM_unc")
results_table %>%
filter(contrast == "high SL_conn - SL_unc") %>%
pull(p.value) %>%
hist(main = "p values high SL_conn - SL_unc")
results_table %>%
filter(contrast == "low MM_conn - MM_unc") %>%
pull(p.value) %>%
hist(main = "p values low MM_conn - MM_unc")
results_table %>%
filter(contrast == "low SL_conn - SL_unc") %>%
pull(p.value) %>%
hist(main = "p values low SL_conn vs SL_unc")
# --- SHOW ITERATED RESULTS - TABLE WITH AVERAGED VALUES --- #
results_table %>%
group_by(contrast) %>%
summarise(estimate = median(estimate),
SE = median(SE),
df = median(df),
t.ratio = median(t.ratio),
p.value = median(p.value)) %>%
as.data.frame() %>%
mutate(estimate = round(estimate, digits = 3),
SE = round(SE, digits = 3),
df = round(df, digits = 3),
t.ratio = round(t.ratio, digits = 3),
p.value = round(p.value, digits = 3),
evidence = "",
evidence = ifelse(p.value > 0.1,
"none",
evidence),
evidence = ifelse(p.value < 0.1,
"* weak",
evidence),
evidence = ifelse(p.value < 0.05,
"** moderate",
evidence),
evidence = ifelse(p.value < 0.01,
"*** strong",
evidence),
evidence = ifelse(p.value < 0.001,
"**** very strong",
evidence),
p.value = ifelse(p.value < 0.001,
"< 0.001",
p.value))
## contrast estimate SE df t.ratio p.value evidence
## 1 high MM_conn - MM_unc 0.367 0.442 39.171 0.822 0.416 none
## 2 high SL_conn - SL_unc -0.339 0.353 38.411 -0.950 0.348 none
## 3 low MM_conn - MM_unc 0.967 0.445 39.581 2.173 0.036 ** moderate
## 4 low SL_conn - SL_unc 0.033 0.333 38.467 0.097 0.872 none
response_variable_selected = "total_metaecosystem_bioarea_mm2"
# --- ORIGINAL DATA - PLOT MEAN ± 95% CI --- #
# Create plots
p1=plot.metaecos.points(ds_metaecosystems %>% filter(disturbance == "high"),
metaecosystem_type_selected,
response_variable_selected) +
annotate("text",
x = Inf,
y = Inf,
label = "High disturbance",
hjust = 1.1,
vjust = 1.1,
size = 5,
fontface = "bold") + # Adjust position and style
theme(axis.title.x = element_blank(), # Remove x-axis title
axis.text.x = element_blank()) # Remove x-axis text
p2=plot.metaecos.points(ds_metaecosystems %>% filter(disturbance == "low"),
metaecosystem_type_selected,
response_variable_selected) +
theme(legend.position = "none") +
annotate("text",
x = Inf,
y = Inf,
label = "Low disturbance",
hjust = 1.1,
vjust = 1.1,
size = 5,
fontface = "bold") # Adjust position and style
# Arrange the plots vertically
ggarrange(p1,
p2,
ncol = 1,
nrow = 2,
heights = c(0.9, 1),
common.legend = TRUE,
align = "v")
# --- ORIGINAL DATA - PLOT SINGLE REPLICATES --- #
p1=plot.metaecos.replicates(ds_metaecosystems %>% filter(disturbance == "high"),
metaecosystem_type_selected,
response_variable_selected) +
annotate("text",
x = Inf,
y = Inf,
label = "High disturbance",
hjust = 1.1,
vjust = 1.1,
size = 5,
fontface = "bold") + # Adjust position and style
theme(axis.title.x = element_blank(), # Remove x-axis title
axis.text.x = element_blank()) # Remove x-axis text
p2=plot.metaecos.replicates(ds_metaecosystems %>% filter(disturbance == "low"),
metaecosystem_type_selected,
response_variable_selected) +
theme(legend.position = "none") +
annotate("text",
x = Inf,
y = Inf,
label = "Low disturbance",
hjust = 1.1,
vjust = 1.1,
size = 5,
fontface = "bold") # Adjust position and style
# Arrange the plots vertically
ggarrange(p1,
p2,
ncol = 1,
nrow = 2,
heights = c(0.9, 1),
common.legend = TRUE,
align = "v")
# --- PREPARE DATA --- #
# Add baselines
baselines = ds_metaecosystems %>%
filter(time_point == time_point_of_baselines) %>%
select(system_nr,
all_of(response_variable_selected)) %>%
rename(baseline = all_of(response_variable_selected))
data_for_analysis = ds_metaecosystems %>%
left_join(baselines)
# Filter and change level names
data_for_analysis = data_for_analysis %>%
filter(time_point %in% time_points_model,
metaecosystem_type %in% metaecosystem_type_selected,
#!is.na(total_water_addition_ml),
!is.na(!!sym(response_variable_selected))) %>%
mutate(metaecosystem_type = case_when(metaecosystem_type == "Small-Large unconnected" ~ "SL unc",
metaecosystem_type == "Medium-Medium unconnected" ~ "MM unc",
metaecosystem_type == "Small-Small meta-ecosystem" ~ "SS con",
metaecosystem_type == "Medium-Medium meta-ecosystem" ~ "MM con",
metaecosystem_type == "Large-Large meta-ecosystem" ~ "LL con",
metaecosystem_type == "Small-Large meta-ecosystem" ~ "SL con",
TRUE ~ metaecosystem_type),
type_conn = paste(metaecosystem_type, connection))
# --- DATA FOR ANALYSIS - PLOT MEAN ± 95% CI OF FILTERED DATA --- #
p1=plot.metaecos.points(data_for_analysis %>% filter(disturbance == "high"),
metaecosystem_type_selected,
response_variable_selected) +
annotate("text",
x = Inf,
y = Inf,
label = "High disturbance",
hjust = 1.1,
vjust = 1.1,
size = 5,
fontface = "bold") + # Adjust position and style
theme(axis.title.x = element_blank(), # Remove x-axis title
axis.text.x = element_blank()) # Remove x-axis text
p2=plot.metaecos.points(data_for_analysis %>% filter(disturbance == "low"),
metaecosystem_type_selected,
response_variable_selected) +
theme(legend.position = "none") +
annotate("text",
x = Inf,
y = Inf,
label = "Low disturbance",
hjust = 1.1,
vjust = 1.1,
size = 5,
fontface = "bold") # Adjust position and style
# Arrange the plots vertically
ggarrange(p1,
p2,
ncol = 1,
nrow = 2,
heights = c(1, 0.7))
# --- DEFINE MODEL FORMULA --- #
formula = paste("get(response_variable_selected) ~",
"type_conn * disturbance * day +",
"(day | baseline) +",
"(day | system_nr)") %>%
print()
## [1] "get(response_variable_selected) ~ type_conn * disturbance * day + (day | baseline) + (day | system_nr)"
# --- FIND ECOSYSTEM COMBINATIONS FOR ANALYSIS --- #
# Set up parameters
bootstrap_iterations = 1000
# Produce random (bootstrapped) rows
random_sets_of_sets <- runif(bootstrap_iterations,
min = 1,
max = nrow(ecos_combin_unconn_sets_of_sets)) %>%
round()
# Filter combinations according to the random rows
sets_of_sets_filtered = ecos_combin_unconn_sets_of_sets %>%
filter(row_number() %in% random_sets_of_sets)
# --- DEFINE WHERE TO SAVE (AND FROM WHERE TO LATER READ) THE RESULTS OF THE ANALYSIS --- #
file_path = here("..",
"3_results",
"tables",
paste0("results_metaeco_",
response_variable_selected,
"_",
bootstrap_iterations,
"_iterations",
".csv"))
# --- FIND MODEL STATISTICS THROUGH MULTIPLE ITERATIONS RESHUFFLING ECOSYSTEM COMBINATIONS --- #
# Set parameters and initialise
results_table = list()
failed_optimizers = 0
# Fit models
for (comb_i in 1:bootstrap_iterations) {
# Find system numbers
system_nr_unconn_selected = ecos_combin_unconn_sets %>%
filter(metaecosystem_type == "Small-Large" &
disturbance == "low" &
set == sets_of_sets_filtered[comb_i, ]$set_SL_low |
metaecosystem_type == "Small-Large" &
disturbance == "high" &
set == sets_of_sets_filtered[comb_i, ]$set_SL_high |
metaecosystem_type == "Medium-Medium" &
disturbance == "low" &
set == sets_of_sets_filtered[comb_i, ]$set_MM_low |
metaecosystem_type == "Medium-Medium" &
disturbance == "high" &
set == sets_of_sets_filtered[comb_i, ]$set_MM_high) %>%
pull(system_nr)
# Prepare data for analysis
data_for_analysis_comb_i = data_for_analysis %>%
filter(system_nr %in% system_nr_unconn_selected | connection == "connected")
# Run model
model = try.different.optimizers.metaecos(data_for_analysis_comb_i,
formula)
# If all the optimisers fail, move on to the next iteration
if (is.null(model)) {
cat("This model could not be fitted with any optimiser (",
system_nr_unconn_selected,
") \n")
failed_optimizers = failed_optimizers + 1
next
}
# Residuals - show Q-Q plot
# print(qqnorm(resid(model))); print(qqline(resid(model)))
# Residuals - save Residuals vs Fitted plot
# plot = data_for_analysis_comb_i %>%
# mutate(predicted = fitted(model),
# residuals = resid(model)) %>%
# ggplot(aes(x = predicted,
# y = residuals)) +
# geom_point()
#
# ggsave(here("3_results",
# "residual_plots",
# paste0("res_vs_fit_",
# response_variable_selected,
# "_combination_",
# comb_i,
# ".png")),
# plot = plot,
# width = 8,
# height = 6)
# Set up contrasts
emmeans_output = emmeans(model,
specs = ~ type_conn * day * disturbance ,
method = "pairwise",
adjust = "sidak",
bias.adj = TRUE,
lmer.df = "satterthwaite")
summary(emmeans_output)
zeros = rep(0, 8)
high_MM_conn = zeros; high_MM_conn[1] = 1
high_MM_unc = zeros; high_MM_unc[2] = 1
high_SL_conn = zeros; high_SL_conn[3] = 1
high_SL_unc = zeros; high_SL_unc[4] = 1
low_MM_conn = zeros; low_MM_conn[5] = 1
low_MM_unc = zeros; low_MM_unc[6] = 1
low_SL_conn = zeros; low_SL_conn[7] = 1
low_SL_unc = zeros; low_SL_unc[8] = 1
# Save contrasts in a table
results_table[[comb_i]] = contrast(
emmeans_output,
method = list("high SL_conn - SL_unc" = high_SL_conn - high_SL_unc,
"high MM_conn - MM_unc" = high_MM_conn - high_MM_unc,
"low SL_conn - SL_unc" = low_SL_conn - low_SL_unc,
"low MM_conn - MM_unc" = low_MM_conn - low_MM_unc)) %>%
as.data.frame() %>%
mutate(combination = comb_i,
system_nr_unconnected_systems = paste(system_nr_unconn_selected, collapse = ", "))
}
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1003 1009 1012 1016 1025 1027 1033 1039 1041 1048 1054 1056 1063 )
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1001 1009 1013 1017 1025 1026 1035 1037 1043 1049 1050 1056 1063 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nloptwrap (NLOPT_LN_NELDERMEAD)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nloptwrap (NLOPT_LN_NELDERMEAD)"
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1001 1009 1013 1017 1025 1026 1033 1040 1042 1049 1053 1056 1064 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nloptwrap (NLOPT_LN_NELDERMEAD)"
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1005 1006 1014 1018 1022 1027 1035 1038 1041 1050 1055 1056 1064 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1003 1010 1014 1016 1022 1027 1035 1038 1041 1055 1050 1056 1064 )
## [1] "Model successfully fitted with optimizer: nloptwrap (NLOPT_LN_NELDERMEAD)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nloptwrap (NLOPT_LN_NELDERMEAD)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1001 1010 1014 1018 1022 1028 1031 1040 1042 1048 1050 1056 1065 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1005 1007 1014 1018 1021 1026 1032 1040 1043 1051 1054 1056 1065 )
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1002 1006 1014 1020 1023 1026 1032 1040 1043 1051 1054 1056 1065 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1005 1006 1013 1017 1024 1030 1031 1037 1043 1053 1046 1056 1065 )
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1001 1010 1014 1018 1022 1026 1032 1038 1045 1053 1049 1056 1065 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1001 1007 1014 1020 1023 1026 1033 1037 1045 1055 1047 1056 1065 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1001 1010 1014 1018 1022 1030 1031 1038 1042 1049 1050 1057 1061 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: nloptwrap (NLOPT_LN_NELDERMEAD)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1002 1009 1013 1020 1021 1026 1034 1038 1042 1053 1049 1057 1061 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1002 1009 1013 1020 1021 1027 1034 1036 1043 1053 1052 1057 1061 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nloptwrap (NLOPT_LN_NELDERMEAD)"
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1002 1009 1015 1016 1023 1026 1035 1038 1042 1048 1052 1057 1062 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1005 1009 1012 1018 1021 1028 1032 1039 1045 1050 1048 1057 1062 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1005 1009 1013 1016 1022 1028 1034 1040 1042 1051 1047 1057 1062 )
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1005 1007 1013 1016 1024 1028 1032 1036 1045 1051 1047 1057 1062 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1001 1010 1012 1018 1024 1027 1034 1038 1041 1054 1048 1057 1062 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1001 1010 1014 1018 1022 1026 1035 1038 1042 1055 1050 1057 1062 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1002 1009 1015 1016 1023 1027 1033 1039 1041 1047 1051 1057 1065 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nloptwrap (NLOPT_LN_NELDERMEAD)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1002 1009 1015 1018 1021 1029 1033 1036 1042 1050 1048 1057 1065 )
## [1] "Model successfully fitted with optimizer: nloptwrap (NLOPT_LN_NELDERMEAD)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1002 1010 1013 1016 1024 1028 1031 1037 1045 1053 1046 1057 1065 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nloptwrap (NLOPT_LN_NELDERMEAD)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1005 1008 1014 1016 1022 1026 1033 1040 1042 1048 1054 1058 1060 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1001 1009 1013 1020 1022 1027 1031 1038 1044 1051 1049 1058 1060 )
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1001 1010 1014 1017 1023 1030 1031 1037 1043 1051 1054 1058 1060 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1005 1009 1012 1016 1023 1026 1035 1038 1042 1052 1048 1058 1060 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nloptwrap (NLOPT_LN_NELDERMEAD)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: nloptwrap (NLOPT_LN_NELDERMEAD)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nloptwrap (NLOPT_LN_NELDERMEAD)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1003 1007 1014 1016 1025 1028 1031 1040 1042 1049 1053 1058 1062 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1003 1007 1014 1016 1025 1026 1032 1038 1045 1050 1055 1058 1062 )
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nloptwrap (NLOPT_LN_NELDERMEAD)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1005 1009 1013 1016 1022 1029 1032 1038 1041 1054 1046 1058 1062 )
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1001 1008 1012 1020 1024 1026 1032 1038 1044 1054 1051 1058 1062 )
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1005 1007 1013 1016 1024 1027 1031 1038 1045 1054 1051 1058 1062 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1003 1010 1012 1016 1024 1027 1031 1040 1043 1047 1051 1058 1064 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1005 1007 1014 1016 1023 1030 1033 1036 1042 1052 1053 1058 1064 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1003 1009 1015 1016 1022 1026 1035 1037 1043 1053 1052 1058 1064 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1003 1009 1011 1017 1025 1026 1032 1038 1045 1046 1053 1059 1060 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1005 1006 1014 1018 1022 1029 1033 1036 1042 1047 1051 1059 1060 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1005 1009 1012 1016 1023 1027 1033 1039 1041 1054 1051 1059 1060 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1005 1007 1013 1019 1021 1028 1034 1037 1041 1055 1047 1059 1060 )
## [1] "Model successfully fitted with optimizer: nloptwrap (NLOPT_LN_NELDERMEAD)"
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1003 1007 1011 1020 1024 1029 1033 1037 1045 1055 1050 1059 1060 )
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1004 1007 1015 1018 1021 1028 1032 1040 1041 1055 1050 1059 1060 )
## [1] "Model successfully fitted with optimizer: nloptwrap (NLOPT_LN_NELDERMEAD)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1001 1010 1012 1018 1024 1027 1035 1036 1043 1047 1055 1059 1061 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1003 1006 1014 1020 1022 1028 1031 1037 1045 1053 1046 1059 1061 )
## [1] "Model successfully fitted with optimizer: nloptwrap (NLOPT_LN_NELDERMEAD)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1001 1007 1014 1020 1023 1028 1031 1039 1042 1054 1051 1059 1061 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1005 1009 1013 1016 1022 1028 1031 1037 1045 1046 1053 1059 1063 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1003 1009 1011 1017 1025 1028 1031 1037 1044 1047 1052 1059 1063 )
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1002 1009 1011 1020 1023 1029 1032 1038 1041 1048 1054 1059 1063 )
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1003 1010 1012 1016 1024 1026 1032 1040 1043 1050 1055 1059 1063 )
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: nloptwrap (NLOPT_LN_NELDERMEAD)"
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1002 1010 1013 1016 1024 1028 1031 1040 1042 1051 1049 1059 1063 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1005 1009 1011 1018 1022 1027 1033 1036 1045 1051 1054 1059 1063 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1001 1009 1012 1018 1025 1030 1033 1036 1042 1052 1053 1059 1063 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1001 1009 1012 1018 1025 1026 1035 1037 1043 1054 1051 1059 1063 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1003 1009 1015 1016 1022 1026 1033 1040 1042 1047 1051 1060 1058 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1005 1009 1011 1018 1022 1028 1034 1037 1041 1051 1049 1060 1058 )
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1003 1009 1011 1020 1022 1030 1032 1036 1043 1053 1046 1060 1058 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1002 1009 1013 1016 1025 1027 1033 1040 1041 1054 1051 1060 1058 )
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1002 1008 1015 1016 1024 1030 1032 1036 1043 1051 1047 1060 1059 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1002 1009 1015 1018 1021 1030 1032 1036 1043 1051 1049 1060 1059 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1003 1006 1015 1017 1024 1028 1031 1037 1045 1051 1054 1060 1059 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1001 1009 1012 1018 1025 1027 1031 1040 1043 1051 1054 1060 1059 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1001 1007 1014 1020 1023 1027 1033 1036 1045 1055 1047 1060 1059 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1003 1006 1015 1017 1024 1027 1034 1036 1043 1055 1047 1060 1059 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1003 1007 1015 1016 1024 1028 1034 1036 1042 1046 1054 1060 1065 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1005 1009 1011 1017 1023 1028 1032 1036 1044 1047 1051 1060 1065 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1003 1007 1015 1016 1024 1029 1032 1038 1041 1050 1049 1060 1065 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1005 1009 1011 1017 1023 1027 1033 1036 1045 1051 1047 1060 1065 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1003 1006 1012 1019 1025 1028 1035 1037 1041 1051 1054 1060 1065 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1002 1006 1015 1018 1024 1027 1035 1038 1041 1052 1053 1060 1065 )
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1001 1007 1015 1018 1024 1026 1033 1037 1044 1053 1046 1060 1065 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1001 1009 1015 1018 1022 1027 1033 1036 1044 1046 1053 1061 1057 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1003 1006 1012 1020 1024 1028 1032 1039 1041 1047 1051 1061 1057 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1001 1007 1015 1018 1024 1028 1035 1039 1042 1051 1047 1061 1057 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1005 1009 1011 1017 1023 1026 1032 1040 1043 1051 1049 1061 1057 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1002 1006 1014 1018 1025 1030 1031 1037 1043 1051 1054 1061 1057 )
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1001 1010 1013 1017 1024 1027 1031 1039 1043 1051 1054 1061 1057 )
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1001 1007 1013 1020 1024 1030 1032 1036 1043 1051 1054 1061 1057 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1005 1009 1013 1017 1021 1029 1031 1037 1043 1053 1049 1061 1057 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1001 1009 1012 1018 1025 1026 1032 1038 1044 1054 1046 1061 1057 )
## [1] "Model successfully fitted with optimizer: nloptwrap (NLOPT_LN_NELDERMEAD)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nloptwrap (NLOPT_LN_NELDERMEAD)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1005 1007 1011 1018 1024 1028 1035 1036 1042 1053 1052 1061 1059 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nloptwrap (NLOPT_LN_NELDERMEAD)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1001 1009 1012 1018 1025 1028 1032 1036 1045 1048 1052 1061 1064 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1005 1007 1011 1018 1024 1030 1033 1037 1041 1050 1048 1061 1064 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1001 1009 1015 1018 1022 1028 1034 1040 1042 1047 1055 1062 1057 )
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1002 1006 1014 1018 1025 1028 1034 1037 1041 1047 1055 1062 1057 )
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1002 1006 1014 1018 1025 1030 1033 1037 1041 1049 1053 1062 1057 )
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1005 1008 1012 1016 1024 1030 1033 1036 1042 1051 1054 1062 1057 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1003 1007 1014 1020 1021 1026 1032 1039 1043 1053 1052 1062 1057 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1003 1006 1015 1019 1022 1030 1032 1036 1043 1053 1052 1062 1057 )
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1004 1006 1012 1018 1025 1028 1031 1040 1042 1054 1046 1062 1057 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1001 1008 1015 1017 1024 1027 1031 1038 1045 1055 1050 1062 1057 )
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1002 1009 1013 1020 1021 1026 1032 1038 1045 1046 1054 1062 1058 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1003 1009 1011 1017 1025 1027 1031 1038 1045 1047 1052 1062 1058 )
## [1] "Model successfully fitted with optimizer: nloptwrap (NLOPT_LN_NELDERMEAD)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1003 1007 1015 1016 1024 1030 1032 1038 1041 1048 1050 1062 1058 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nloptwrap (NLOPT_LN_NELDERMEAD)"
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1005 1007 1014 1018 1021 1028 1031 1039 1042 1050 1055 1062 1058 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1003 1006 1014 1017 1025 1030 1031 1037 1043 1055 1047 1062 1058 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nloptwrap (NLOPT_LN_NELDERMEAD)"
## [1] "Model successfully fitted with optimizer: nloptwrap (NLOPT_LN_NELDERMEAD)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1001 1010 1013 1017 1024 1028 1032 1040 1041 1049 1051 1062 1063 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nloptwrap (NLOPT_LN_NELDERMEAD)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1002 1008 1011 1020 1024 1030 1032 1038 1041 1054 1051 1062 1063 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nloptwrap (NLOPT_LN_NELDERMEAD)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1004 1006 1013 1020 1022 1028 1031 1039 1042 1047 1051 1063 1056 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1005 1009 1013 1016 1022 1028 1032 1040 1041 1048 1054 1063 1056 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nloptwrap (NLOPT_LN_NELDERMEAD)"
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: nloptwrap (NLOPT_LN_NELDERMEAD)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nloptwrap (NLOPT_LN_NELDERMEAD)"
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1003 1007 1015 1016 1024 1027 1031 1038 1044 1048 1054 1063 1059 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1002 1006 1013 1019 1025 1027 1033 1036 1045 1051 1054 1063 1059 )
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1002 1009 1013 1020 1021 1028 1035 1037 1041 1052 1047 1063 1059 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1003 1009 1015 1017 1021 1028 1031 1037 1044 1052 1053 1063 1059 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1001 1009 1012 1020 1023 1028 1035 1037 1041 1046 1054 1063 1062 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1001 1009 1015 1017 1023 1030 1031 1038 1042 1047 1051 1063 1062 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nloptwrap (NLOPT_LN_NELDERMEAD)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1002 1009 1011 1018 1025 1029 1032 1038 1041 1053 1046 1063 1062 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1005 1006 1014 1018 1022 1029 1032 1036 1043 1054 1048 1063 1062 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1002 1009 1013 1016 1025 1026 1032 1039 1043 1046 1055 1064 1056 )
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1005 1007 1014 1018 1021 1029 1032 1038 1045 1047 1055 1064 1056 )
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1005 1007 1014 1018 1021 1030 1032 1036 1043 1052 1048 1064 1056 )
## [1] "Model successfully fitted with optimizer: nloptwrap (NLOPT_LN_NELDERMEAD)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1005 1007 1011 1018 1024 1028 1031 1037 1044 1048 1050 1064 1058 )
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1005 1009 1012 1018 1021 1030 1032 1038 1044 1051 1047 1064 1058 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nloptwrap (NLOPT_LN_NELDERMEAD)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nloptwrap (NLOPT_LN_NELDERMEAD)"
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1002 1008 1015 1016 1024 1026 1033 1037 1044 1047 1051 1064 1061 )
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1005 1009 1012 1016 1023 1030 1033 1037 1041 1049 1050 1064 1061 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1003 1006 1014 1017 1025 1026 1032 1038 1045 1051 1047 1064 1061 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1002 1009 1011 1018 1025 1029 1033 1036 1042 1052 1047 1064 1061 )
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1003 1006 1012 1020 1024 1027 1035 1038 1041 1053 1052 1064 1061 )
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1001 1007 1015 1018 1024 1028 1032 1036 1045 1047 1052 1065 1056 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1004 1007 1011 1020 1023 1026 1033 1037 1045 1051 1054 1065 1056 )
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1005 1009 1013 1017 1021 1026 1032 1040 1043 1052 1047 1065 1056 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1003 1009 1011 1017 1025 1030 1033 1036 1042 1052 1047 1065 1056 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1001 1009 1015 1018 1022 1028 1032 1036 1045 1052 1053 1065 1056 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1001 1009 1015 1018 1022 1026 1032 1038 1045 1054 1051 1065 1056 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nloptwrap (NLOPT_LN_NELDERMEAD)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1003 1007 1014 1016 1025 1026 1033 1037 1045 1049 1050 1065 1057 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1005 1007 1014 1016 1023 1028 1035 1037 1041 1050 1048 1065 1057 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1002 1009 1011 1020 1023 1030 1031 1038 1042 1050 1055 1065 1057 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1002 1008 1015 1019 1021 1030 1033 1036 1042 1051 1054 1065 1057 )
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1005 1007 1014 1018 1021 1029 1032 1038 1041 1051 1054 1065 1057 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1002 1006 1014 1018 1025 1026 1033 1040 1042 1053 1049 1065 1057 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1002 1008 1011 1020 1024 1026 1033 1040 1042 1055 1050 1065 1057 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1001 1010 1013 1017 1024 1027 1035 1038 1041 1046 1054 1065 1060 )
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nloptwrap (NLOPT_LN_NELDERMEAD)"
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: Nelder_Mead "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1001 1009 1015 1018 1022 1027 1035 1038 1041 1051 1047 1065 1060 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nlminbwrap "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1002 1009 1015 1018 1021 1030 1032 1036 1043 1053 1046 1065 1060 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1002 1006 1015 1018 1024 1030 1033 1036 1042 1053 1049 1065 1060 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: nloptwrap (NLOPT_LN_NELDERMEAD)"
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1002 1009 1011 1020 1023 1030 1032 1038 1044 1054 1048 1065 1060 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1001 1008 1014 1020 1022 1029 1033 1036 1042 1054 1051 1065 1060 )
## [1] "Model fitting failed with all optimizers."
## This model could not be fitted with any optimiser ( 1005 1009 1013 1017 1021 1028 1032 1040 1044 1054 1051 1065 1060 )
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: bobyqa "
## [1] "Model successfully fitted with optimizer: optimx (L-BFGS-B)"
## [1] "Model successfully fitted with optimizer: bobyqa "
# Tell how many optimizers failed
print(paste((failed_optimizers/bootstrap_iterations * 100),
"% of combinations created models that could not be fit"))
## [1] "13.6 % of combinations created models that could not be fit"
# Bind rows within the list results_table
results_table = results_table %>%
bind_rows()
# Save the results
write.csv(results_table,
file = file_path,
row.names = F)
# --- READ THE RESULTS AFTER LENGTHY COMPUTATION --- #
results_table = read.csv(file = file_path)
# --- SHOW ITERATED RESULTS - P VALUE DISTRIBUTIONS --- #
results_table %>%
filter(contrast == "high MM_conn - MM_unc") %>%
pull(p.value) %>%
hist(main = "p values high MM_conn - MM_unc")
results_table %>%
filter(contrast == "high SL_conn - SL_unc") %>%
pull(p.value) %>%
hist(main = "p values high SL_conn - SL_unc")
results_table %>%
filter(contrast == "low MM_conn - MM_unc") %>%
pull(p.value) %>%
hist(main = "p values low MM_conn - MM_unc")
results_table %>%
filter(contrast == "low SL_conn - SL_unc") %>%
pull(p.value) %>%
hist(main = "p values low SL_conn vs SL_unc")
# --- SHOW ITERATED RESULTS - TABLE WITH AVERAGED VALUES --- #
results_table %>%
group_by(contrast) %>%
summarise(estimate = median(estimate),
SE = median(SE),
df = median(df),
t.ratio = median(t.ratio),
p.value = median(p.value)) %>%
as.data.frame() %>%
mutate(estimate = round(estimate, digits = 3),
SE = round(SE, digits = 3),
df = round(df, digits = 3),
t.ratio = round(t.ratio, digits = 3),
p.value = round(p.value, digits = 3),
evidence = "",
evidence = ifelse(p.value > 0.1,
"none",
evidence),
evidence = ifelse(p.value < 0.1,
"* weak",
evidence),
evidence = ifelse(p.value < 0.05,
"** moderate",
evidence),
evidence = ifelse(p.value < 0.01,
"*** strong",
evidence),
evidence = ifelse(p.value < 0.001,
"**** very strong",
evidence),
p.value = ifelse(p.value < 0.001,
"< 0.001",
p.value))
## contrast estimate SE df t.ratio p.value evidence
## 1 high MM_conn - MM_unc 17.326 13.109 33.314 1.325 0.194 none
## 2 high SL_conn - SL_unc -32.905 10.510 33.314 -3.106 0.004 *** strong
## 3 low MM_conn - MM_unc 38.759 13.109 33.314 2.945 0.006 *** strong
## 4 low SL_conn - SL_unc -21.448 9.909 33.314 -2.164 0.038 ** moderate
response_variable_selected = "shannon"
# --- ORIGINAL DATA - PLOT MEAN ± 95% CI --- #
p1 = plot.all.patches.points(data = ds_ecosystems %>%
filter(disturbance == "high"),
response_variable_selected) +
annotate("text",
x = Inf,
y = Inf,
label = "High disturbance",
hjust = 1.1,
vjust = 1.1,
size = 5,
fontface = "bold") + # Adjust position and style
theme(axis.title.x = element_blank(), # Remove x-axis title
axis.text.x = element_blank()) # Remove x-axis text
## Warning in qt(conf.interval/2 + 0.5, datac$N - 1): NaNs produced
p2 = plot.all.patches.points(data = ds_ecosystems %>%
filter(disturbance == "low"),
response_variable_selected) +
theme(legend.position = "none") +
annotate("text",
x = Inf,
y = Inf,
label = "Low disturbance",
hjust = 1.1,
vjust = 1.1,
size = 5,
fontface = "bold") # Adjust position and style
# Arrange the plots vertically
ggarrange(p1,
p2,
ncol = 1,
nrow = 2,
heights = c(1, 0.7))
# --- PREPARE DATA FOR ANALYSIS --- #
# Add baselines
baselines = ds_ecosystems %>%
filter(time_point == time_point_of_baselines) %>%
select(ecosystem_ID,
all_of(response_variable_selected)) %>%
rename(baseline = all_of(response_variable_selected))
data_for_analysis = ds_ecosystems %>%
left_join(baselines)
# Filter data and change level names
data_for_analysis = data_for_analysis %>%
filter(time_point %in% time_points_model,
#!is.na(water_addition_ml),
!is.na(!!sym(response_variable_selected)),
!is.infinite(!!sym(response_variable_selected))) %>%
mutate(ecosystem_type = case_when(ecosystem_type == "Small unconnected" ~ "S",
ecosystem_type == "Medium unconnected" ~ "M",
ecosystem_type == "Large unconnected" ~ "L",
ecosystem_type == "Small connected to small" ~ "S_S",
ecosystem_type == "Small connected to large" ~ "S_L",
ecosystem_type == "Medium connected to medium" ~ "M_M",
ecosystem_type == "Large connected to large" ~ "L_L",
ecosystem_type == "Large connected to small" ~ "L_S",
TRUE ~ ecosystem_type)) %>%
ungroup()
# --- DATA FOR ANALYSIS - PLOT MEAN ± 95% CI --- #
p1 = plot.all.patches.points(data = data_for_analysis %>%
filter(disturbance == "high"),
response_variable_selected) +
annotate("text",
x = Inf,
y = Inf,
label = "High disturbance",
hjust = 1.1,
vjust = 1.1,
size = 5,
fontface = "bold") + # Adjust position and style
theme(axis.title.x = element_blank(), # Remove x-axis title
axis.text.x = element_blank()) # Remove x-axis text
## Warning in qt(conf.interval/2 + 0.5, datac$N - 1): NaNs produced
p2 = plot.all.patches.points(data = data_for_analysis %>%
filter(disturbance == "low"),
response_variable_selected) +
theme(legend.position = "none") +
annotate("text",
x = Inf,
y = Inf,
label = "Low disturbance",
hjust = 1.1,
vjust = 1.1,
size = 5,
fontface = "bold") # Adjust position and style
# Arrange the plots vertically
ggarrange(p1,
p2,
ncol = 1,
nrow = 2,
heights = c(1, 0.7))
# --- MODEL - CONSTRUCT --- #
# Define formula
formula = paste("get(response_variable_selected) ~",
"ecosystem_type * disturbance * day +",
"(day | ecosystem_ID) +",
"(day | baseline)") %>%
print()
## [1] "get(response_variable_selected) ~ ecosystem_type * disturbance * day + (day | ecosystem_ID) + (day | baseline)"
# Construct model
model = try.different.optimizers.ecos(data_for_analysis,
formula)
## [1] "Model successfully fitted with optimizer: bobyqa "
# --- MODEL - SUMMARY --- #
print(summary(model), digits = 1)
## Linear mixed model fit by maximum likelihood . t-tests use Satterthwaite's
## method [lmerModLmerTest]
## Formula: formula
## Data: data
## Control: lmerControl(optimizer = opt$optimizer)
##
## AIC BIC logLik deviance df.resid
## 352.4 526.4 -137.2 274.4 602
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.5 -0.6 0.0 0.7 3.7
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## ecosystem_ID (Intercept) 0e+00 0e+00
## day 1e-18 1e-09 NaN
## baseline (Intercept) 4e-11 7e-06
## day 2e-13 5e-07 -1.00
## Residual 9e-02 3e-01
## Number of obs: 641, groups: ecosystem_ID, 109; baseline, 109
##
## Fixed effects:
## Estimate Std. Error df t value
## (Intercept) 1e+00 2e-01 6e+02 9.6
## ecosystem_typeL_L -6e-02 2e-01 6e+02 -0.3
## ecosystem_typeL_S -3e-01 2e-01 6e+02 -1.2
## ecosystem_typeM -3e-01 2e-01 6e+02 -1.3
## ecosystem_typeM_M -6e-02 2e-01 6e+02 -0.3
## ecosystem_typeS 1e-01 2e-01 6e+02 0.6
## ecosystem_typeS_L 5e-01 2e-01 6e+02 2.5
## ecosystem_typeS_S 3e-01 2e-01 6e+02 1.7
## disturbancelow 4e-01 2e-01 6e+02 1.6
## day -7e-04 8e-03 6e+02 -0.1
## ecosystem_typeL_L:disturbancelow -3e-01 3e-01 6e+02 -1.0
## ecosystem_typeL_S:disturbancelow -3e-01 3e-01 6e+02 -0.9
## ecosystem_typeM:disturbancelow -4e-01 3e-01 6e+02 -1.2
## ecosystem_typeM_M:disturbancelow -4e-01 3e-01 6e+02 -1.5
## ecosystem_typeS:disturbancelow -2e-01 3e-01 6e+02 -0.6
## ecosystem_typeS_L:disturbancelow -1e+00 3e-01 6e+02 -3.2
## ecosystem_typeS_S:disturbancelow -4e-01 3e-01 6e+02 -1.6
## ecosystem_typeL_L:day 2e-03 1e-02 6e+02 0.2
## ecosystem_typeL_S:day 8e-03 1e-02 6e+02 0.7
## ecosystem_typeM:day 3e-03 1e-02 6e+02 0.3
## ecosystem_typeM_M:day -2e-03 1e-02 6e+02 -0.2
## ecosystem_typeS:day -7e-02 1e-02 6e+02 -5.1
## ecosystem_typeS_L:day -6e-02 1e-02 6e+02 -5.7
## ecosystem_typeS_S:day -7e-02 1e-02 6e+02 -6.5
## disturbancelow:day -2e-02 1e-02 6e+02 -1.4
## ecosystem_typeL_L:disturbancelow:day 1e-02 1e-02 6e+02 0.8
## ecosystem_typeL_S:disturbancelow:day 2e-02 2e-02 6e+02 1.0
## ecosystem_typeM:disturbancelow:day 2e-02 2e-02 6e+02 1.4
## ecosystem_typeM_M:disturbancelow:day 2e-02 1e-02 6e+02 1.3
## ecosystem_typeS:disturbancelow:day 4e-02 2e-02 6e+02 2.3
## ecosystem_typeS_L:disturbancelow:day 8e-02 2e-02 6e+02 5.0
## ecosystem_typeS_S:disturbancelow:day 4e-02 1e-02 6e+02 2.8
## Pr(>|t|)
## (Intercept) <2e-16 ***
## ecosystem_typeL_L 0.732
## ecosystem_typeL_S 0.240
## ecosystem_typeM 0.205
## ecosystem_typeM_M 0.741
## ecosystem_typeS 0.579
## ecosystem_typeS_L 0.014 *
## ecosystem_typeS_S 0.086 .
## disturbancelow 0.109
## day 0.930
## ecosystem_typeL_L:disturbancelow 0.318
## ecosystem_typeL_S:disturbancelow 0.361
## ecosystem_typeM:disturbancelow 0.228
## ecosystem_typeM_M:disturbancelow 0.128
## ecosystem_typeS:disturbancelow 0.555
## ecosystem_typeS_L:disturbancelow 0.002 **
## ecosystem_typeS_S:disturbancelow 0.119
## ecosystem_typeL_L:day 0.810
## ecosystem_typeL_S:day 0.485
## ecosystem_typeM:day 0.781
## ecosystem_typeM_M:day 0.836
## ecosystem_typeS:day 4e-07 ***
## ecosystem_typeS_L:day 2e-08 ***
## ecosystem_typeS_S:day 2e-10 ***
## disturbancelow:day 0.149
## ecosystem_typeL_L:disturbancelow:day 0.429
## ecosystem_typeL_S:disturbancelow:day 0.295
## ecosystem_typeM:disturbancelow:day 0.155
## ecosystem_typeM_M:disturbancelow:day 0.196
## ecosystem_typeS:disturbancelow:day 0.022 *
## ecosystem_typeS_L:disturbancelow:day 6e-07 ***
## ecosystem_typeS_S:disturbancelow:day 0.005 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (bobyqa) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
# --- MODEL - ANOVA --- #
car::Anova(model, type = "III")
## Analysis of Deviance Table (Type III Wald chisquare tests)
##
## Response: get(response_variable_selected)
## Chisq Df Pr(>Chisq)
## (Intercept) 92.1969 1 < 2.2e-16 ***
## ecosystem_type 26.7429 7 0.0003707 ***
## disturbance 2.5795 1 0.1082569
## day 0.0077 1 0.9302887
## ecosystem_type:disturbance 11.9786 7 0.1012636
## ecosystem_type:day 155.7995 7 < 2.2e-16 ***
## disturbance:day 2.0906 1 0.1482065
## ecosystem_type:disturbance:day 37.7566 7 3.371e-06 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# --- ESTIMATE MARGINAL MEANS --- #
emmeans_output = emmeans(model,
specs = ~ ecosystem_type * disturbance * day,
adjust = "sidak",
bias.adj = TRUE,
lmer.df = "satterthwaite")
emmeans_output
## ecosystem_type disturbance day emmean SE df lower.CL upper.CL
## L high 17.8 1.468 0.0547 641 1.306 1.630
## L_L high 17.8 1.446 0.0387 641 1.331 1.560
## L_S high 17.8 1.353 0.0547 641 1.191 1.515
## M high 17.8 1.248 0.0547 641 1.086 1.410
## M_M high 17.8 1.370 0.0387 641 1.255 1.484
## S high 17.8 0.336 0.0736 641 0.118 0.554
## S_L high 17.8 0.854 0.0547 641 0.692 1.016
## S_S high 17.8 0.621 0.0412 641 0.499 0.743
## L low 17.8 1.526 0.0547 641 1.364 1.688
## L_L low 17.8 1.433 0.0387 641 1.318 1.547
## L_S low 17.8 1.429 0.0547 641 1.267 1.591
## M low 17.8 1.341 0.0547 641 1.179 1.503
## M_M low 17.8 1.341 0.0387 641 1.226 1.455
## S low 17.8 0.939 0.0557 641 0.774 1.104
## S_L low 17.8 1.373 0.0547 641 1.211 1.535
## S_S low 17.8 0.966 0.0387 641 0.852 1.081
##
## Degrees-of-freedom method: satterthwaite
## Results are given on the get (not the response) scale.
## Confidence level used: 0.95
## Conf-level adjustment: sidak method for 16 estimates
# --- CODE EACH LEVEL OF DISTURBANCE AND ECOSYSTEM TYPE TO THEN PRODUCE CONTRASTS --- #
high_L = c(1, rep(0,15))
high_L_L = c(rep(0,1), 1, rep(0,14))
high_L_S = c(rep(0,2), 1, rep(0,13))
high_M = c(rep(0,3), 1, rep(0,12))
high_M_M = c(rep(0,4), 1, rep(0,11))
high_S = c(rep(0,5), 1, rep(0,10))
high_S_L = c(rep(0,6), 1, rep(0,9))
high_S_S = c(rep(0,7), 1, rep(0,8))
low_L = c(rep(0,8), 1, rep(0,7))
low_L_L = c(rep(0,9), 1, rep(0,6))
low_L_S = c(rep(0,10), 1, rep(0,5))
low_M = c(rep(0,11), 1, rep(0,4))
low_M_M = c(rep(0,12), 1, rep(0,3))
low_S = c(rep(0,13), 1, rep(0,2))
low_S_L = c(rep(0,14), 1, rep(0,1))
low_S_S = c(rep(0,15), 1)
# --- PRODUCE ECOSYSTEM TYPE CONTRASTS --- #
# Set parameters
n_of_digits = 3
# Compute constrasts
contrasts = contrast(emmeans_output,
method = list("high S_L - S" = high_S_L - high_S,
"high S_L - S_S" = high_S_L - high_S_S,
"high S_S - S" = high_S_S - high_S,
"high M_M - M" = high_M_M - high_M,
"high L_S - L" = high_L_S - high_L,
"high L_S - L_L" = high_L_S - high_L_L,
"high L_L - L" = high_L_L - high_L,
"low S_L - S" = low_S_L - low_S,
"low S_L - S_S" = low_S_L - low_S_S,
"low S_S - S" = low_S_S - low_S,
"low M_M - M" = low_M_M - low_M,
"low L_S - L" = low_L_S - low_L,
"low L_S - L_L" = low_L_S - low_L_L,
"low L_L - L" = low_L_L - low_L)) %>%
as.data.frame() %>%
mutate(p.value = round(p.value, digits = n_of_digits),
estimate = round(estimate, digits = n_of_digits),
SE = round(SE, digits = n_of_digits),
df = round(df, digits = n_of_digits),
t.ratio = round(t.ratio, digits = n_of_digits),
e = "",
e = ifelse(p.value > 0.1,
"",
e),
e = ifelse(p.value < 0.05,
"*",
e),
e = ifelse(p.value < 0.01,
"**",
e),
e = ifelse(p.value < 0.001,
"***",
e)) %>%
rename(" " = e)
# --- SHOW ECOSYSTEM TYPE CONSTRASTS --- #
contrasts
## contrast estimate SE df t.ratio p.value
## 1 high S_L - S 0.518 0.092 641 5.647 0.000 ***
## 2 high S_L - S_S 0.233 0.068 641 3.399 0.001 **
## 3 high S_S - S 0.285 0.084 641 3.382 0.001 **
## 4 high M_M - M 0.122 0.067 641 1.817 0.070
## 5 high L_S - L -0.115 0.077 641 -1.490 0.137
## 6 high L_S - L_L -0.093 0.067 641 -1.384 0.167
## 7 high L_L - L -0.023 0.067 641 -0.337 0.736
## 8 low S_L - S 0.434 0.078 641 5.562 0.000 ***
## 9 low S_L - S_S 0.407 0.067 641 6.071 0.000 ***
## 10 low S_S - S 0.027 0.068 641 0.402 0.688
## 11 low M_M - M -0.001 0.067 641 -0.009 0.993
## 12 low L_S - L -0.098 0.077 641 -1.261 0.208
## 13 low L_S - L_L -0.004 0.067 641 -0.060 0.952
## 14 low L_L - L -0.094 0.067 641 -1.395 0.163
# --- PLOT MODEL RESIDUALS --- #
# Simulate residuals from the fitted model
simulationOutput <- simulateResiduals(fittedModel = model,
n = 1000)
# Test for overdispersion in the model to check if variance exceeds mean
testDispersion(simulationOutput)
##
## DHARMa nonparametric dispersion test via sd of residuals fitted vs.
## simulated
##
## data: simulationOutput
## dispersion = 1.0037, p-value = 0.948
## alternative hypothesis: two.sided
# Plot Q-Q and Residuals vs Fitted plots
plot(simulationOutput)
response_variable_selected = "bioarea_mm2_per_ml"
# --- ORIGINAL DATA - PLOT MEAN ± 95% CI --- #
p1 = plot.all.patches.points(data = ds_ecosystems %>%
filter(disturbance == "high"),
response_variable_selected) +
annotate("text",
x = Inf,
y = Inf,
label = "High disturbance",
hjust = 1.1,
vjust = 1.1,
size = 5,
fontface = "bold") + # Adjust position and style
theme(axis.title.x = element_blank(), # Remove x-axis title
axis.text.x = element_blank()) # Remove x-axis text
p2 = plot.all.patches.points(data = ds_ecosystems %>%
filter(disturbance == "low"),
response_variable_selected) +
theme(legend.position = "none") +
annotate("text",
x = Inf,
y = Inf,
label = "Low disturbance",
hjust = 1.1,
vjust = 1.1,
size = 5,
fontface = "bold") # Adjust position and style
# Arrange the plots vertically
ggarrange(p1,
p2,
ncol = 1,
nrow = 2,
heights = c(1, 0.7))
# --- PREPARE DATA FOR ANALYSIS --- #
# Add baselines
baselines = ds_ecosystems %>%
filter(time_point == time_point_of_baselines) %>%
select(ecosystem_ID,
all_of(response_variable_selected)) %>%
rename(baseline = all_of(response_variable_selected))
data_for_analysis = ds_ecosystems %>%
left_join(baselines)
# Filter data and change level names
data_for_analysis = data_for_analysis %>%
filter(time_point %in% time_points_model,
#!is.na(water_addition_ml),
!is.na(!!sym(response_variable_selected)),
!is.infinite(!!sym(response_variable_selected))) %>%
mutate(ecosystem_type = case_when(ecosystem_type == "Small unconnected" ~ "S",
ecosystem_type == "Medium unconnected" ~ "M",
ecosystem_type == "Large unconnected" ~ "L",
ecosystem_type == "Small connected to small" ~ "S_S",
ecosystem_type == "Small connected to large" ~ "S_L",
ecosystem_type == "Medium connected to medium" ~ "M_M",
ecosystem_type == "Large connected to large" ~ "L_L",
ecosystem_type == "Large connected to small" ~ "L_S",
TRUE ~ ecosystem_type)) %>%
ungroup()
# --- DATA FOR ANALYSIS - PLOT MEAN ± 95% CI --- #
p1 = plot.all.patches.points(data = data_for_analysis %>%
filter(disturbance == "high"),
response_variable_selected) +
annotate("text",
x = Inf,
y = Inf,
label = "High disturbance",
hjust = 1.1,
vjust = 1.1,
size = 5,
fontface = "bold") + # Adjust position and style
theme(axis.title.x = element_blank(), # Remove x-axis title
axis.text.x = element_blank()) # Remove x-axis text
p2 = plot.all.patches.points(data = data_for_analysis %>%
filter(disturbance == "low"),
response_variable_selected) +
theme(legend.position = "none") +
annotate("text",
x = Inf,
y = Inf,
label = "Low disturbance",
hjust = 1.1,
vjust = 1.1,
size = 5,
fontface = "bold") # Adjust position and style
# Arrange the plots vertically
ggarrange(p1,
p2,
ncol = 1,
nrow = 2,
heights = c(1, 0.7))
# --- MODEL - CONSTRUCT --- #
# Define formula
formula = paste("get(response_variable_selected) ~",
"ecosystem_type * disturbance * day +",
"(day | ecosystem_ID) +",
"(day | baseline)") %>%
print()
## [1] "get(response_variable_selected) ~ ecosystem_type * disturbance * day + (day | ecosystem_ID) + (day | baseline)"
# Construct model
model = try.different.optimizers.ecos(data_for_analysis,
formula)
## [1] "Model successfully fitted with optimizer: bobyqa "
# --- MODEL - SUMMARY --- #
print(summary(model), digits = 1)
## Linear mixed model fit by maximum likelihood . t-tests use Satterthwaite's
## method [lmerModLmerTest]
## Formula: formula
## Data: data
## Control: lmerControl(optimizer = opt$optimizer)
##
## AIC BIC logLik deviance df.resid
## 1639.4 1814.3 -780.7 1561.4 615
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.1 -0.6 0.0 0.5 3.6
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## ecosystem_ID (Intercept) 2e-01 0.39
## day 2e-04 0.01 -1.00
## baseline (Intercept) 1e-01 0.34
## day 2e-04 0.01 -1.00
## Residual 6e-01 0.77
## Number of obs: 654, groups: ecosystem_ID, 109; baseline, 109
##
## Fixed effects:
## Estimate Std. Error df t value
## (Intercept) 5.94 0.46 122.57 12.9
## ecosystem_typeL_L -0.15 0.56 122.57 -0.3
## ecosystem_typeL_S -1.18 0.65 122.57 -1.8
## ecosystem_typeM -1.63 0.65 122.57 -2.5
## ecosystem_typeM_M -0.26 0.56 122.57 -0.5
## ecosystem_typeS -4.14 0.69 122.57 -6.0
## ecosystem_typeS_L -2.90 0.65 122.57 -4.5
## ecosystem_typeS_S -3.72 0.56 122.57 -6.6
## disturbancelow -0.99 0.65 122.57 -1.5
## day -0.16 0.02 167.67 -7.2
## ecosystem_typeL_L:disturbancelow 0.68 0.80 122.57 0.9
## ecosystem_typeL_S:disturbancelow 1.68 0.92 122.57 1.8
## ecosystem_typeM:disturbancelow 1.80 0.92 122.57 2.0
## ecosystem_typeM_M:disturbancelow 1.35 0.80 122.57 1.7
## ecosystem_typeS:disturbancelow 3.12 0.95 122.57 3.3
## ecosystem_typeS_L:disturbancelow 1.90 0.92 122.57 2.1
## ecosystem_typeS_S:disturbancelow 2.37 0.80 122.57 3.0
## ecosystem_typeL_L:day -0.01 0.03 167.67 -0.3
## ecosystem_typeL_S:day 0.01 0.03 167.67 0.4
## ecosystem_typeM:day 0.02 0.03 167.67 0.7
## ecosystem_typeM_M:day -0.03 0.03 167.67 -1.1
## ecosystem_typeS:day 0.09 0.03 167.67 2.5
## ecosystem_typeS_L:day 0.04 0.03 167.67 1.3
## ecosystem_typeS_S:day 0.07 0.03 167.67 2.7
## disturbancelow:day 0.07 0.03 167.67 2.2
## ecosystem_typeL_L:disturbancelow:day -0.05 0.04 167.67 -1.3
## ecosystem_typeL_S:disturbancelow:day -0.08 0.04 167.67 -1.7
## ecosystem_typeM:disturbancelow:day -0.10 0.04 167.67 -2.3
## ecosystem_typeM_M:disturbancelow:day -0.05 0.04 167.67 -1.4
## ecosystem_typeS:disturbancelow:day -0.15 0.05 167.67 -3.2
## ecosystem_typeS_L:disturbancelow:day -0.08 0.04 167.67 -1.8
## ecosystem_typeS_S:disturbancelow:day -0.12 0.04 167.67 -3.1
## Pr(>|t|)
## (Intercept) <2e-16 ***
## ecosystem_typeL_L 0.789
## ecosystem_typeL_S 0.073 .
## ecosystem_typeM 0.013 *
## ecosystem_typeM_M 0.643
## ecosystem_typeS 2e-08 ***
## ecosystem_typeS_L 2e-05 ***
## ecosystem_typeS_S 1e-09 ***
## disturbancelow 0.130
## day 2e-11 ***
## ecosystem_typeL_L:disturbancelow 0.395
## ecosystem_typeL_S:disturbancelow 0.070 .
## ecosystem_typeM:disturbancelow 0.052 .
## ecosystem_typeM_M:disturbancelow 0.093 .
## ecosystem_typeS:disturbancelow 0.001 **
## ecosystem_typeS_L:disturbancelow 0.041 *
## ecosystem_typeS_S:disturbancelow 0.004 **
## ecosystem_typeL_L:day 0.728
## ecosystem_typeL_S:day 0.695
## ecosystem_typeM:day 0.474
## ecosystem_typeM_M:day 0.258
## ecosystem_typeS:day 0.012 *
## ecosystem_typeS_L:day 0.203
## ecosystem_typeS_S:day 0.009 **
## disturbancelow:day 0.026 *
## ecosystem_typeL_L:disturbancelow:day 0.213
## ecosystem_typeL_S:disturbancelow:day 0.086 .
## ecosystem_typeM:disturbancelow:day 0.021 *
## ecosystem_typeM_M:disturbancelow:day 0.163
## ecosystem_typeS:disturbancelow:day 0.002 **
## ecosystem_typeS_L:disturbancelow:day 0.081 .
## ecosystem_typeS_S:disturbancelow:day 0.002 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (bobyqa) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
# --- MODEL - ANOVA --- #
car::Anova(model, type = "III")
## Analysis of Deviance Table (Type III Wald chisquare tests)
##
## Response: get(response_variable_selected)
## Chisq Df Pr(>Chisq)
## (Intercept) 166.6820 1 < 2.2e-16 ***
## ecosystem_type 124.6134 7 < 2.2e-16 ***
## disturbance 2.3252 1 0.12729
## day 51.2279 1 8.224e-13 ***
## ecosystem_type:disturbance 18.2609 7 0.01085 *
## ecosystem_type:day 33.5306 7 2.108e-05 ***
## disturbance:day 5.0218 1 0.02503 *
## ecosystem_type:disturbance:day 17.2032 7 0.01613 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# --- ESTIMATE MARGINAL MEANS --- #
emmeans_output = emmeans(model,
specs = ~ ecosystem_type * disturbance * day,
adjust = "sidak",
bias.adj = TRUE,
lmer.df = "satterthwaite")
emmeans_output
## ecosystem_type disturbance day emmean SE df lower.CL upper.CL
## L high 18 3.061 0.161 127 2.576 3.547
## L_L high 18 2.739 0.114 127 2.396 3.082
## L_S high 18 2.108 0.161 127 1.623 2.593
## M high 18 1.838 0.161 127 1.352 2.323
## M_M high 18 2.241 0.114 127 1.898 2.584
## S high 18 0.448 0.181 127 -0.094 0.991
## S_L high 18 0.891 0.161 127 0.406 1.376
## S_S high 18 0.647 0.114 127 0.304 0.990
## L low 18 3.343 0.161 127 2.858 3.828
## L_L low 18 2.831 0.114 127 2.488 3.174
## L_S low 18 2.682 0.161 127 2.196 3.167
## M low 18 2.057 0.161 127 1.572 2.543
## M_M low 18 2.898 0.114 127 2.555 3.242
## S low 18 1.214 0.161 127 0.728 1.699
## S_L low 18 1.662 0.161 127 1.176 2.147
## S_S low 18 1.154 0.114 127 0.811 1.497
##
## Degrees-of-freedom method: satterthwaite
## Results are given on the get (not the response) scale.
## Confidence level used: 0.95
## Conf-level adjustment: sidak method for 16 estimates
# --- CODE EACH LEVEL OF DISTURBANCE AND ECOSYSTEM TYPE TO THEN PRODUCE CONTRASTS --- #
high_L = c(1, rep(0,15))
high_L_L = c(rep(0,1), 1, rep(0,14))
high_L_S = c(rep(0,2), 1, rep(0,13))
high_M = c(rep(0,3), 1, rep(0,12))
high_M_M = c(rep(0,4), 1, rep(0,11))
high_S = c(rep(0,5), 1, rep(0,10))
high_S_L = c(rep(0,6), 1, rep(0,9))
high_S_S = c(rep(0,7), 1, rep(0,8))
low_L = c(rep(0,8), 1, rep(0,7))
low_L_L = c(rep(0,9), 1, rep(0,6))
low_L_S = c(rep(0,10), 1, rep(0,5))
low_M = c(rep(0,11), 1, rep(0,4))
low_M_M = c(rep(0,12), 1, rep(0,3))
low_S = c(rep(0,13), 1, rep(0,2))
low_S_L = c(rep(0,14), 1, rep(0,1))
low_S_S = c(rep(0,15), 1)
# --- PRODUCE ECOSYSTEM TYPE CONTRASTS --- #
# Set parameters
n_of_digits = 3
# Compute constrasts
contrasts = contrast(emmeans_output,
method = list("high S_L - S" = high_S_L - high_S,
"high S_L - S_S" = high_S_L - high_S_S,
"high S_S - S" = high_S_S - high_S,
"high M_M - M" = high_M_M - high_M,
"high L_S - L" = high_L_S - high_L,
"high L_S - L_L" = high_L_S - high_L_L,
"high L_L - L" = high_L_L - high_L,
"low S_L - S" = low_S_L - low_S,
"low S_L - S_S" = low_S_L - low_S_S,
"low S_S - S" = low_S_S - low_S,
"low M_M - M" = low_M_M - low_M,
"low L_S - L" = low_L_S - low_L,
"low L_S - L_L" = low_L_S - low_L_L,
"low L_L - L" = low_L_L - low_L)) %>%
as.data.frame() %>%
mutate(p.value = round(p.value, digits = n_of_digits),
estimate = round(estimate, digits = n_of_digits),
SE = round(SE, digits = n_of_digits),
df = round(df, digits = n_of_digits),
t.ratio = round(t.ratio, digits = n_of_digits),
e = "",
e = ifelse(p.value > 0.1,
"",
e),
e = ifelse(p.value < 0.05,
"*",
e),
e = ifelse(p.value < 0.01,
"**",
e),
e = ifelse(p.value < 0.001,
"***",
e)) %>%
rename(" " = e)
# --- SHOW ECOSYSTEM TYPE CONSTRASTS --- #
contrasts
## contrast estimate SE df t.ratio p.value
## 1 high S_L - S 0.442 0.242 126.838 1.826 0.070
## 2 high S_L - S_S 0.244 0.198 126.838 1.233 0.220
## 3 high S_S - S 0.199 0.214 126.838 0.930 0.354
## 4 high M_M - M 0.404 0.198 126.838 2.041 0.043 *
## 5 high L_S - L -0.953 0.228 126.838 -4.175 0.000 ***
## 6 high L_S - L_L -0.631 0.198 126.838 -3.190 0.002 **
## 7 high L_L - L -0.322 0.198 126.838 -1.631 0.105
## 8 low S_L - S 0.448 0.228 126.838 1.962 0.052
## 9 low S_L - S_S 0.507 0.198 126.838 2.565 0.011 *
## 10 low S_S - S -0.059 0.198 126.838 -0.300 0.765
## 11 low M_M - M 0.841 0.198 126.838 4.253 0.000 ***
## 12 low L_S - L -0.662 0.228 126.838 -2.897 0.004 **
## 13 low L_S - L_L -0.149 0.198 126.838 -0.755 0.452
## 14 low L_L - L -0.512 0.198 126.838 -2.591 0.011 *
# --- PLOT MODEL RESIDUALS --- #
# Simulate residuals from the fitted model
simulationOutput <- simulateResiduals(fittedModel = model,
n = 1000)
# Test for overdispersion in the model to check if variance exceeds mean
testDispersion(simulationOutput)
##
## DHARMa nonparametric dispersion test via sd of residuals fitted vs.
## simulated
##
## data: simulationOutput
## dispersion = 1.0057, p-value = 0.894
## alternative hypothesis: two.sided
# Plot Q-Q and Residuals vs Fitted plots
plot(simulationOutput)
response_variable_selected = "species_richness"
# --- ORIGINAL DATA - PLOT MEAN ± 95% CI --- #
p1 = plot.all.patches.points(data = ds_ecosystems %>%
filter(disturbance == "high"),
response_variable_selected) +
annotate("text",
x = Inf,
y = Inf,
label = "High disturbance",
hjust = 1.1,
vjust = 1.1,
size = 5,
fontface = "bold") + # Adjust position and style
theme(axis.title.x = element_blank(), # Remove x-axis title
axis.text.x = element_blank()) # Remove x-axis text
p2 = plot.all.patches.points(data = ds_ecosystems %>%
filter(disturbance == "low"),
response_variable_selected) +
theme(legend.position = "none") +
annotate("text",
x = Inf,
y = Inf,
label = "Low disturbance",
hjust = 1.1,
vjust = 1.1,
size = 5,
fontface = "bold") # Adjust position and style
# Arrange the plots vertically
ggarrange(p1,
p2,
ncol = 1,
nrow = 2,
heights = c(1, 0.7))
# --- PREPARE DATA FOR ANALYSIS --- #
# Add baselines
baselines = ds_ecosystems %>%
filter(time_point == time_point_of_baselines) %>%
select(ecosystem_ID,
all_of(response_variable_selected)) %>%
rename(baseline = all_of(response_variable_selected))
data_for_analysis = ds_ecosystems %>%
left_join(baselines)
# Filter data and change level names
data_for_analysis = data_for_analysis %>%
filter(time_point %in% time_points_model,
#!is.na(water_addition_ml),
!is.na(!!sym(response_variable_selected)),
!is.infinite(!!sym(response_variable_selected))) %>%
mutate(ecosystem_type = case_when(ecosystem_type == "Small unconnected" ~ "S",
ecosystem_type == "Medium unconnected" ~ "M",
ecosystem_type == "Large unconnected" ~ "L",
ecosystem_type == "Small connected to small" ~ "S_S",
ecosystem_type == "Small connected to large" ~ "S_L",
ecosystem_type == "Medium connected to medium" ~ "M_M",
ecosystem_type == "Large connected to large" ~ "L_L",
ecosystem_type == "Large connected to small" ~ "L_S",
TRUE ~ ecosystem_type)) %>%
ungroup()
# --- DATA FOR ANALYSIS - PLOT MEAN ± 95% CI --- #
p1 = plot.all.patches.points(data = data_for_analysis %>%
filter(disturbance == "high"),
response_variable_selected) +
annotate("text",
x = Inf,
y = Inf,
label = "High disturbance",
hjust = 1.1,
vjust = 1.1,
size = 5,
fontface = "bold") + # Adjust position and style
theme(axis.title.x = element_blank(), # Remove x-axis title
axis.text.x = element_blank()) # Remove x-axis text
p2 = plot.all.patches.points(data = data_for_analysis %>%
filter(disturbance == "low"),
response_variable_selected) +
theme(legend.position = "none") +
annotate("text",
x = Inf,
y = Inf,
label = "Low disturbance",
hjust = 1.1,
vjust = 1.1,
size = 5,
fontface = "bold") # Adjust position and style
# Arrange the plots vertically
ggarrange(p1,
p2,
ncol = 1,
nrow = 2,
heights = c(1, 0.7))
# --- MODEL - CONSTRUCT --- #
# Define formula
formula = paste("get(response_variable_selected) ~",
"ecosystem_type * disturbance * day +",
"(day | ecosystem_ID) +",
"(day | baseline)") %>%
print()
## [1] "get(response_variable_selected) ~ ecosystem_type * disturbance * day + (day | ecosystem_ID) + (day | baseline)"
# Construct model
model = try.different.optimizers.ecos(data_for_analysis,
formula)
## [1] "Model successfully fitted with optimizer: bobyqa "
# --- MODEL - SUMMARY --- #
print(summary(model), digits = 1)
## Linear mixed model fit by maximum likelihood . t-tests use Satterthwaite's
## method [lmerModLmerTest]
## Formula: formula
## Data: data
## Control: lmerControl(optimizer = opt$optimizer)
##
## AIC BIC logLik deviance df.resid
## 2273.8 2448.7 -1097.9 2195.8 615
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.6 -0.6 0.0 0.6 3.2
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## ecosystem_ID (Intercept) 7e-05 0.008
## day 9e-06 0.003 -1.00
## baseline (Intercept) 1e-01 0.321
## day 7e-05 0.009 -1.00
## Residual 2e+00 1.289
## Number of obs: 654, groups: ecosystem_ID, 109; baseline, 8
##
## Fixed effects:
## Estimate Std. Error df t value
## (Intercept) 7e+00 7e-01 3e+02 10.5
## ecosystem_typeL_L 3e-01 8e-01 5e+02 0.4
## ecosystem_typeL_S -8e-01 9e-01 5e+02 -0.9
## ecosystem_typeM 3e-01 9e-01 5e+02 0.4
## ecosystem_typeM_M 5e-01 8e-01 5e+02 0.6
## ecosystem_typeS -1e+00 1e+00 5e+02 -1.2
## ecosystem_typeS_L 1e+00 9e-01 5e+02 1.0
## ecosystem_typeS_S -9e-01 8e-01 5e+02 -1.1
## disturbancelow 5e-01 9e-01 5e+02 0.6
## day -2e-02 3e-02 5e+02 -0.5
## ecosystem_typeL_L:disturbancelow -8e-01 1e+00 5e+02 -0.7
## ecosystem_typeL_S:disturbancelow -5e-01 1e+00 5e+02 -0.4
## ecosystem_typeM:disturbancelow -6e-01 1e+00 5e+02 -0.5
## ecosystem_typeM_M:disturbancelow -5e-01 1e+00 5e+02 -0.5
## ecosystem_typeS:disturbancelow 2e+00 1e+00 5e+02 1.5
## ecosystem_typeS_L:disturbancelow -1e+00 1e+00 5e+02 -1.1
## ecosystem_typeS_S:disturbancelow 1e+00 1e+00 5e+02 0.8
## ecosystem_typeL_L:day -4e-02 4e-02 6e+02 -1.0
## ecosystem_typeL_S:day -4e-03 5e-02 6e+02 -0.1
## ecosystem_typeM:day -9e-02 5e-02 6e+02 -1.8
## ecosystem_typeM_M:day -8e-02 4e-02 6e+02 -1.9
## ecosystem_typeS:day -2e-01 5e-02 6e+02 -4.1
## ecosystem_typeS_L:day -2e-01 5e-02 6e+02 -5.1
## ecosystem_typeS_S:day -2e-01 4e-02 6e+02 -4.5
## disturbancelow:day -7e-03 5e-02 6e+02 -0.1
## ecosystem_typeL_L:disturbancelow:day 2e-02 6e-02 6e+02 0.3
## ecosystem_typeL_S:disturbancelow:day 3e-02 7e-02 6e+02 0.5
## ecosystem_typeM:disturbancelow:day 3e-02 7e-02 6e+02 0.4
## ecosystem_typeM_M:disturbancelow:day 4e-02 6e-02 6e+02 0.6
## ecosystem_typeS:disturbancelow:day -2e-02 7e-02 6e+02 -0.3
## ecosystem_typeS_L:disturbancelow:day 2e-01 7e-02 6e+02 2.5
## ecosystem_typeS_S:disturbancelow:day 7e-04 6e-02 6e+02 0.0
## Pr(>|t|)
## (Intercept) <2e-16 ***
## ecosystem_typeL_L 0.69
## ecosystem_typeL_S 0.37
## ecosystem_typeM 0.72
## ecosystem_typeM_M 0.53
## ecosystem_typeS 0.23
## ecosystem_typeS_L 0.31
## ecosystem_typeS_S 0.27
## disturbancelow 0.57
## day 0.59
## ecosystem_typeL_L:disturbancelow 0.49
## ecosystem_typeL_S:disturbancelow 0.69
## ecosystem_typeM:disturbancelow 0.64
## ecosystem_typeM_M:disturbancelow 0.65
## ecosystem_typeS:disturbancelow 0.15
## ecosystem_typeS_L:disturbancelow 0.27
## ecosystem_typeS_S:disturbancelow 0.40
## ecosystem_typeL_L:day 0.31
## ecosystem_typeL_S:day 0.93
## ecosystem_typeM:day 0.07 .
## ecosystem_typeM_M:day 0.06 .
## ecosystem_typeS:day 4e-05 ***
## ecosystem_typeS_L:day 5e-07 ***
## ecosystem_typeS_S:day 7e-06 ***
## disturbancelow:day 0.89
## ecosystem_typeL_L:disturbancelow:day 0.73
## ecosystem_typeL_S:disturbancelow:day 0.65
## ecosystem_typeM:disturbancelow:day 0.72
## ecosystem_typeM_M:disturbancelow:day 0.52
## ecosystem_typeS:disturbancelow:day 0.80
## ecosystem_typeS_L:disturbancelow:day 0.01 *
## ecosystem_typeS_S:disturbancelow:day 0.99
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (bobyqa) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
# --- MODEL - ANOVA --- #
car::Anova(model, type = "III")
## Analysis of Deviance Table (Type III Wald chisquare tests)
##
## Response: get(response_variable_selected)
## Chisq Df Pr(>Chisq)
## (Intercept) 110.2649 1 < 2.2e-16 ***
## ecosystem_type 11.8520 7 0.1055
## disturbance 0.3227 1 0.5700
## day 0.2915 1 0.5893
## ecosystem_type:disturbance 11.0533 7 0.1363
## ecosystem_type:day 63.3876 7 3.169e-11 ***
## disturbance:day 0.0199 1 0.8879
## ecosystem_type:disturbance:day 10.9139 7 0.1424
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# --- ESTIMATE MARGINAL MEANS --- #
emmeans_output = emmeans(model,
specs = ~ ecosystem_type * disturbance * day,
adjust = "sidak",
bias.adj = TRUE,
lmer.df = "satterthwaite")
emmeans_output
## ecosystem_type disturbance day emmean SE df lower.CL upper.CL
## L high 18 6.84 0.251 115.7 6.081 7.59
## L_L high 18 6.40 0.181 77.8 5.845 6.95
## L_S high 18 5.92 0.250 116.9 5.168 6.67
## M high 18 5.58 0.248 124.6 4.835 6.32
## M_M high 18 5.94 0.183 69.6 5.381 6.50
## S high 18 1.78 0.277 128.8 0.948 2.61
## S_L high 18 3.34 0.248 125.2 2.596 4.09
## S_S high 18 2.46 0.182 75.3 1.902 3.01
## L low 18 7.25 0.252 114.4 6.492 8.01
## L_L low 18 6.38 0.182 74.8 5.826 6.94
## L_S low 18 6.38 0.250 115.3 5.621 7.13
## M low 18 5.81 0.255 108.3 5.042 6.58
## M_M low 18 6.51 0.183 69.1 5.947 7.06
## S low 18 3.87 0.250 117.8 3.119 4.62
## S_L low 18 5.42 0.249 120.2 4.674 6.17
## S_S low 18 3.86 0.187 64.8 3.292 4.44
##
## Degrees-of-freedom method: satterthwaite
## Results are given on the get (not the response) scale.
## Confidence level used: 0.95
## Conf-level adjustment: sidak method for 16 estimates
# --- CODE EACH LEVEL OF DISTURBANCE AND ECOSYSTEM TYPE TO THEN PRODUCE CONTRASTS --- #
high_L = c(1, rep(0,15))
high_L_L = c(rep(0,1), 1, rep(0,14))
high_L_S = c(rep(0,2), 1, rep(0,13))
high_M = c(rep(0,3), 1, rep(0,12))
high_M_M = c(rep(0,4), 1, rep(0,11))
high_S = c(rep(0,5), 1, rep(0,10))
high_S_L = c(rep(0,6), 1, rep(0,9))
high_S_S = c(rep(0,7), 1, rep(0,8))
low_L = c(rep(0,8), 1, rep(0,7))
low_L_L = c(rep(0,9), 1, rep(0,6))
low_L_S = c(rep(0,10), 1, rep(0,5))
low_M = c(rep(0,11), 1, rep(0,4))
low_M_M = c(rep(0,12), 1, rep(0,3))
low_S = c(rep(0,13), 1, rep(0,2))
low_S_L = c(rep(0,14), 1, rep(0,1))
low_S_S = c(rep(0,15), 1)
# --- PRODUCE ECOSYSTEM TYPE CONTRASTS --- #
# Set parameters
n_of_digits = 3
# Compute constrasts
contrasts = contrast(emmeans_output,
method = list("high S_L - S" = high_S_L - high_S,
"high S_L - S_S" = high_S_L - high_S_S,
"high S_S - S" = high_S_S - high_S,
"high M_M - M" = high_M_M - high_M,
"high L_S - L" = high_L_S - high_L,
"high L_S - L_L" = high_L_S - high_L_L,
"high L_L - L" = high_L_L - high_L,
"low S_L - S" = low_S_L - low_S,
"low S_L - S_S" = low_S_L - low_S_S,
"low S_S - S" = low_S_S - low_S,
"low M_M - M" = low_M_M - low_M,
"low L_S - L" = low_L_S - low_L,
"low L_S - L_L" = low_L_S - low_L_L,
"low L_L - L" = low_L_L - low_L)) %>%
as.data.frame() %>%
mutate(p.value = round(p.value, digits = n_of_digits),
estimate = round(estimate, digits = n_of_digits),
SE = round(SE, digits = n_of_digits),
df = round(df, digits = n_of_digits),
t.ratio = round(t.ratio, digits = n_of_digits),
e = "",
e = ifelse(p.value > 0.1,
"",
e),
e = ifelse(p.value < 0.05,
"*",
e),
e = ifelse(p.value < 0.01,
"**",
e),
e = ifelse(p.value < 0.001,
"***",
e)) %>%
rename(" " = e)
# --- SHOW ECOSYSTEM TYPE CONSTRASTS --- #
contrasts
## contrast estimate SE df t.ratio p.value
## 1 high S_L - S 1.560 0.363 155.966 4.300 0.000 ***
## 2 high S_L - S_S 0.886 0.293 154.170 3.021 0.003 **
## 3 high S_S - S 0.674 0.316 153.687 2.133 0.035 *
## 4 high M_M - M 0.359 0.293 154.093 1.225 0.222
## 5 high L_S - L -0.916 0.336 151.815 -2.723 0.007 **
## 6 high L_S - L_L -0.474 0.294 154.833 -1.614 0.109
## 7 high L_L - L -0.442 0.295 155.519 -1.498 0.136
## 8 low S_L - S 1.550 0.338 153.410 4.587 0.000 ***
## 9 low S_L - S_S 1.557 0.291 151.585 5.348 0.000 ***
## 10 low S_S - S -0.007 0.293 153.952 -0.024 0.981
## 11 low M_M - M 0.694 0.295 155.458 2.350 0.020 *
## 12 low L_S - L -0.874 0.343 156.316 -2.551 0.012 *
## 13 low L_S - L_L -0.006 0.294 155.074 -0.021 0.983
## 14 low L_L - L -0.868 0.294 155.060 -2.949 0.004 **
# --- PLOT MODEL RESIDUALS --- #
# Simulate residuals from the fitted model
simulationOutput <- simulateResiduals(fittedModel = model,
n = 1000)
# Test for overdispersion in the model to check if variance exceeds mean
testDispersion(simulationOutput)
##
## DHARMa nonparametric dispersion test via sd of residuals fitted vs.
## simulated
##
## data: simulationOutput
## dispersion = 1.004, p-value = 0.96
## alternative hypothesis: two.sided
# Plot Q-Q and Residuals vs Fitted plots
plot(simulationOutput)
response_variable_selected = "evenness_pielou"
# --- ORIGINAL DATA - PLOT MEAN ± 95% CI --- #
p1 = plot.all.patches.points(data = ds_ecosystems %>%
filter(disturbance == "high"),
response_variable_selected) +
annotate("text",
x = Inf,
y = Inf,
label = "High disturbance",
hjust = 1.1,
vjust = 1.1,
size = 5,
fontface = "bold") + # Adjust position and style
theme(axis.title.x = element_blank(), # Remove x-axis title
axis.text.x = element_blank()) # Remove x-axis text
## Warning in qt(conf.interval/2 + 0.5, datac$N - 1): NaNs produced
p2 = plot.all.patches.points(data = ds_ecosystems %>%
filter(disturbance == "low"),
response_variable_selected) +
theme(legend.position = "none") +
annotate("text",
x = Inf,
y = Inf,
label = "Low disturbance",
hjust = 1.1,
vjust = 1.1,
size = 5,
fontface = "bold") # Adjust position and style
# Arrange the plots vertically
ggarrange(p1,
p2,
ncol = 1,
nrow = 2,
heights = c(1, 0.7))
# --- PREPARE DATA FOR ANALYSIS --- #
# Add baselines
baselines = ds_ecosystems %>%
filter(time_point == time_point_of_baselines) %>%
select(ecosystem_ID,
all_of(response_variable_selected)) %>%
rename(baseline = all_of(response_variable_selected))
data_for_analysis = ds_ecosystems %>%
left_join(baselines)
# Filter data and change level names
data_for_analysis = data_for_analysis %>%
filter(time_point %in% time_points_model,
#!is.na(water_addition_ml),
!is.na(!!sym(response_variable_selected)),
!is.infinite(!!sym(response_variable_selected))) %>%
mutate(ecosystem_type = case_when(ecosystem_type == "Small unconnected" ~ "S",
ecosystem_type == "Medium unconnected" ~ "M",
ecosystem_type == "Large unconnected" ~ "L",
ecosystem_type == "Small connected to small" ~ "S_S",
ecosystem_type == "Small connected to large" ~ "S_L",
ecosystem_type == "Medium connected to medium" ~ "M_M",
ecosystem_type == "Large connected to large" ~ "L_L",
ecosystem_type == "Large connected to small" ~ "L_S",
TRUE ~ ecosystem_type)) %>%
ungroup()
# --- DATA FOR ANALYSIS - PLOT MEAN ± 95% CI --- #
p1 = plot.all.patches.points(data = data_for_analysis %>%
filter(disturbance == "high"),
response_variable_selected) +
annotate("text",
x = Inf,
y = Inf,
label = "High disturbance",
hjust = 1.1,
vjust = 1.1,
size = 5,
fontface = "bold") + # Adjust position and style
theme(axis.title.x = element_blank(), # Remove x-axis title
axis.text.x = element_blank()) # Remove x-axis text
## Warning in qt(conf.interval/2 + 0.5, datac$N - 1): NaNs produced
p2 = plot.all.patches.points(data = data_for_analysis %>%
filter(disturbance == "low"),
response_variable_selected) +
theme(legend.position = "none") +
annotate("text",
x = Inf,
y = Inf,
label = "Low disturbance",
hjust = 1.1,
vjust = 1.1,
size = 5,
fontface = "bold") # Adjust position and style
# Arrange the plots vertically
ggarrange(p1,
p2,
ncol = 1,
nrow = 2,
heights = c(1, 0.7))
# --- MODEL - CONSTRUCT --- #
# Define formula
formula = paste("get(response_variable_selected) ~",
"ecosystem_type * disturbance * day +",
"(day | ecosystem_ID) +",
"(day | baseline)") %>%
print()
## [1] "get(response_variable_selected) ~ ecosystem_type * disturbance * day + (day | ecosystem_ID) + (day | baseline)"
# Construct model
model = try.different.optimizers.ecos(data_for_analysis,
formula)
## [1] "Model successfully fitted with optimizer: bobyqa "
# --- MODEL - SUMMARY --- #
print(summary(model), digits = 1)
## Linear mixed model fit by maximum likelihood . t-tests use Satterthwaite's
## method [lmerModLmerTest]
## Formula: formula
## Data: data
## Control: lmerControl(optimizer = opt$optimizer)
##
## AIC BIC logLik deviance df.resid
## -692.0 -519.8 385.0 -770.0 573
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -5.7 -0.5 0.1 0.6 3.9
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## ecosystem_ID (Intercept) 6e-16 2e-08
## day 1e-18 1e-09 -1.00
## baseline (Intercept) 4e-12 2e-06
## day 2e-14 1e-07 -1.00
## Residual 2e-02 1e-01
## Number of obs: 612, groups: ecosystem_ID, 109; baseline, 109
##
## Fixed effects:
## Estimate Std. Error df t value
## (Intercept) 8e-01 7e-02 6e+02 11.4
## ecosystem_typeL_L -6e-02 8e-02 6e+02 -0.8
## ecosystem_typeL_S -8e-02 9e-02 6e+02 -0.9
## ecosystem_typeM -2e-01 9e-02 6e+02 -2.2
## ecosystem_typeM_M -8e-02 8e-02 6e+02 -0.9
## ecosystem_typeS 5e-01 1e-01 6e+02 4.3
## ecosystem_typeS_L 6e-02 1e-01 6e+02 0.6
## ecosystem_typeS_S 5e-01 8e-02 6e+02 5.5
## disturbancelow 2e-01 9e-02 6e+02 1.6
## day 5e-04 3e-03 6e+02 0.2
## ecosystem_typeL_L:disturbancelow -9e-02 1e-01 6e+02 -0.8
## ecosystem_typeL_S:disturbancelow -1e-01 1e-01 6e+02 -0.9
## ecosystem_typeM:disturbancelow -8e-02 1e-01 6e+02 -0.6
## ecosystem_typeM_M:disturbancelow -2e-01 1e-01 6e+02 -1.5
## ecosystem_typeS:disturbancelow -5e-01 1e-01 6e+02 -3.5
## ecosystem_typeS_L:disturbancelow -3e-01 1e-01 6e+02 -2.2
## ecosystem_typeS_S:disturbancelow -6e-01 1e-01 6e+02 -5.3
## ecosystem_typeL_L:day 5e-03 4e-03 6e+02 1.1
## ecosystem_typeL_S:day 5e-03 5e-03 6e+02 1.0
## ecosystem_typeM:day 1e-02 5e-03 6e+02 2.3
## ecosystem_typeM_M:day 5e-03 4e-03 6e+02 1.1
## ecosystem_typeS:day -5e-02 6e-03 6e+02 -8.0
## ecosystem_typeS_L:day 4e-03 5e-03 6e+02 0.7
## ecosystem_typeS_S:day -3e-02 4e-03 6e+02 -6.8
## disturbancelow:day -8e-03 5e-03 6e+02 -1.6
## ecosystem_typeL_L:disturbancelow:day 4e-03 6e-03 6e+02 0.7
## ecosystem_typeL_S:disturbancelow:day 6e-03 7e-03 6e+02 0.9
## ecosystem_typeM:disturbancelow:day 6e-03 7e-03 6e+02 0.9
## ecosystem_typeM_M:disturbancelow:day 6e-03 6e-03 6e+02 1.0
## ecosystem_typeS:disturbancelow:day 5e-02 8e-03 6e+02 6.3
## ecosystem_typeS_L:disturbancelow:day 1e-02 7e-03 6e+02 1.6
## ecosystem_typeS_S:disturbancelow:day 4e-02 6e-03 6e+02 6.7
## Pr(>|t|)
## (Intercept) <2e-16 ***
## ecosystem_typeL_L 0.44
## ecosystem_typeL_S 0.37
## ecosystem_typeM 0.03 *
## ecosystem_typeM_M 0.35
## ecosystem_typeS 2e-05 ***
## ecosystem_typeS_L 0.52
## ecosystem_typeS_S 7e-08 ***
## disturbancelow 0.10
## day 0.88
## ecosystem_typeL_L:disturbancelow 0.42
## ecosystem_typeL_S:disturbancelow 0.38
## ecosystem_typeM:disturbancelow 0.53
## ecosystem_typeM_M:disturbancelow 0.13
## ecosystem_typeS:disturbancelow 6e-04 ***
## ecosystem_typeS_L:disturbancelow 0.03 *
## ecosystem_typeS_S:disturbancelow 1e-07 ***
## ecosystem_typeL_L:day 0.26
## ecosystem_typeL_S:day 0.30
## ecosystem_typeM:day 0.02 *
## ecosystem_typeM_M:day 0.25
## ecosystem_typeS:day 7e-15 ***
## ecosystem_typeS_L:day 0.47
## ecosystem_typeS_S:day 3e-11 ***
## disturbancelow:day 0.11
## ecosystem_typeL_L:disturbancelow:day 0.50
## ecosystem_typeL_S:disturbancelow:day 0.37
## ecosystem_typeM:disturbancelow:day 0.37
## ecosystem_typeM_M:disturbancelow:day 0.30
## ecosystem_typeS:disturbancelow:day 6e-10 ***
## ecosystem_typeS_L:disturbancelow:day 0.10
## ecosystem_typeS_S:disturbancelow:day 6e-11 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (bobyqa) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
# --- MODEL - ANOVA --- #
car::Anova(model, type = "III")
## Analysis of Deviance Table (Type III Wald chisquare tests)
##
## Response: get(response_variable_selected)
## Chisq Df Pr(>Chisq)
## (Intercept) 130.1357 1 < 2.2e-16 ***
## ecosystem_type 121.9831 7 < 2.2e-16 ***
## disturbance 2.6800 1 0.1016
## day 0.0240 1 0.8769
## ecosystem_type:disturbance 53.2690 7 3.28e-09 ***
## ecosystem_type:day 225.4252 7 < 2.2e-16 ***
## disturbance:day 2.5267 1 0.1119
## ecosystem_type:disturbance:day 111.4767 7 < 2.2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# --- ESTIMATE MARGINAL MEANS --- #
emmeans_output = emmeans(model,
specs = ~ ecosystem_type * disturbance * day,
adjust = "sidak",
bias.adj = TRUE,
lmer.df = "satterthwaite")
emmeans_output
## ecosystem_type disturbance day emmean SE df lower.CL upper.CL
## L high 17.7 0.767 0.0236 612 0.697 0.836
## L_L high 17.7 0.789 0.0167 612 0.739 0.838
## L_S high 17.7 0.772 0.0236 612 0.702 0.842
## M high 17.7 0.756 0.0236 612 0.687 0.826
## M_M high 17.7 0.777 0.0167 612 0.728 0.826
## S high 17.7 0.415 0.0349 612 0.312 0.518
## S_L high 17.7 0.899 0.0276 612 0.817 0.981
## S_S high 17.7 0.687 0.0199 612 0.629 0.746
## L low 17.7 0.783 0.0236 612 0.713 0.853
## L_L low 17.7 0.783 0.0167 612 0.734 0.832
## L_S low 17.7 0.782 0.0236 612 0.712 0.852
## M low 17.7 0.799 0.0236 612 0.730 0.869
## M_M low 17.7 0.729 0.0167 612 0.680 0.779
## S low 17.7 0.783 0.0249 612 0.709 0.856
## S_L low 17.7 0.823 0.0236 612 0.753 0.893
## S_S low 17.7 0.814 0.0176 612 0.762 0.866
##
## Degrees-of-freedom method: satterthwaite
## Results are given on the get (not the response) scale.
## Confidence level used: 0.95
## Conf-level adjustment: sidak method for 16 estimates
# --- CODE EACH LEVEL OF DISTURBANCE AND ECOSYSTEM TYPE TO THEN PRODUCE CONTRASTS --- #
high_L = c(1, rep(0,15))
high_L_L = c(rep(0,1), 1, rep(0,14))
high_L_S = c(rep(0,2), 1, rep(0,13))
high_M = c(rep(0,3), 1, rep(0,12))
high_M_M = c(rep(0,4), 1, rep(0,11))
high_S = c(rep(0,5), 1, rep(0,10))
high_S_L = c(rep(0,6), 1, rep(0,9))
high_S_S = c(rep(0,7), 1, rep(0,8))
low_L = c(rep(0,8), 1, rep(0,7))
low_L_L = c(rep(0,9), 1, rep(0,6))
low_L_S = c(rep(0,10), 1, rep(0,5))
low_M = c(rep(0,11), 1, rep(0,4))
low_M_M = c(rep(0,12), 1, rep(0,3))
low_S = c(rep(0,13), 1, rep(0,2))
low_S_L = c(rep(0,14), 1, rep(0,1))
low_S_S = c(rep(0,15), 1)
# --- PRODUCE ECOSYSTEM TYPE CONTRASTS --- #
# Set parameters
n_of_digits = 3
# Compute constrasts
contrasts = contrast(emmeans_output,
method = list("high S_L - S" = high_S_L - high_S,
"high S_L - S_S" = high_S_L - high_S_S,
"high S_S - S" = high_S_S - high_S,
"high M_M - M" = high_M_M - high_M,
"high L_S - L" = high_L_S - high_L,
"high L_S - L_L" = high_L_S - high_L_L,
"high L_L - L" = high_L_L - high_L,
"low S_L - S" = low_S_L - low_S,
"low S_L - S_S" = low_S_L - low_S_S,
"low S_S - S" = low_S_S - low_S,
"low M_M - M" = low_M_M - low_M,
"low L_S - L" = low_L_S - low_L,
"low L_S - L_L" = low_L_S - low_L_L,
"low L_L - L" = low_L_L - low_L)) %>%
as.data.frame() %>%
mutate(p.value = round(p.value, digits = n_of_digits),
estimate = round(estimate, digits = n_of_digits),
SE = round(SE, digits = n_of_digits),
df = round(df, digits = n_of_digits),
t.ratio = round(t.ratio, digits = n_of_digits),
e = "",
e = ifelse(p.value > 0.1,
"",
e),
e = ifelse(p.value < 0.05,
"*",
e),
e = ifelse(p.value < 0.01,
"**",
e),
e = ifelse(p.value < 0.001,
"***",
e)) %>%
rename(" " = e)
# --- SHOW ECOSYSTEM TYPE CONSTRASTS --- #
contrasts
## contrast estimate SE df t.ratio p.value
## 1 high S_L - S 0.484 0.044 612 10.869 0.000 ***
## 2 high S_L - S_S 0.211 0.034 612 6.207 0.000 ***
## 3 high S_S - S 0.272 0.040 612 6.786 0.000 ***
## 4 high M_M - M 0.021 0.029 612 0.715 0.475
## 5 high L_S - L 0.006 0.033 612 0.166 0.868
## 6 high L_S - L_L -0.017 0.029 612 -0.575 0.566
## 7 high L_L - L 0.022 0.029 612 0.766 0.444
## 8 low S_L - S 0.040 0.034 612 1.173 0.241
## 9 low S_L - S_S 0.009 0.029 612 0.299 0.765
## 10 low S_S - S 0.031 0.030 612 1.032 0.303
## 11 low M_M - M -0.070 0.029 612 -2.423 0.016 *
## 12 low L_S - L -0.001 0.033 612 -0.027 0.978
## 13 low L_S - L_L -0.001 0.029 612 -0.023 0.982
## 14 low L_L - L 0.000 0.029 612 -0.009 0.993
# --- PLOT MODEL RESIDUALS --- #
# Simulate residuals from the fitted model
simulationOutput <- simulateResiduals(fittedModel = model,
n = 1000)
# Test for overdispersion in the model to check if variance exceeds mean
testDispersion(simulationOutput)
##
## DHARMa nonparametric dispersion test via sd of residuals fitted vs.
## simulated
##
## data: simulationOutput
## dispersion = 1.0036, p-value = 0.944
## alternative hypothesis: two.sided
# Plot Q-Q and Residuals vs Fitted plots
plot(simulationOutput)
response_variable_selected = "median_body_area_µm2"
# --- ORIGINAL DATA - PLOT MEAN ± 95% CI --- #
p1 = plot.all.patches.points(data = ds_ecosystems %>%
filter(disturbance == "high"),
response_variable_selected) +
annotate("text",
x = Inf,
y = Inf,
label = "High disturbance",
hjust = 1.1,
vjust = 1.1,
size = 5,
fontface = "bold") + # Adjust position and style
theme(axis.title.x = element_blank(), # Remove x-axis title
axis.text.x = element_blank()) # Remove x-axis text
## Warning in qt(conf.interval/2 + 0.5, datac$N - 1): NaNs produced
p2 = plot.all.patches.points(data = ds_ecosystems %>%
filter(disturbance == "low"),
response_variable_selected) +
theme(legend.position = "none") +
annotate("text",
x = Inf,
y = Inf,
label = "Low disturbance",
hjust = 1.1,
vjust = 1.1,
size = 5,
fontface = "bold") # Adjust position and style
# Arrange the plots vertically
ggarrange(p1,
p2,
ncol = 1,
nrow = 2,
heights = c(1, 0.7))
# --- PREPARE DATA FOR ANALYSIS --- #
# Add baselines
baselines = ds_ecosystems %>%
filter(time_point == time_point_of_baselines) %>%
select(ecosystem_ID,
all_of(response_variable_selected)) %>%
rename(baseline = all_of(response_variable_selected))
data_for_analysis = ds_ecosystems %>%
left_join(baselines)
# Filter data and change level names
data_for_analysis = data_for_analysis %>%
filter(time_point %in% time_points_model,
#!is.na(water_addition_ml),
!is.na(!!sym(response_variable_selected)),
!is.infinite(!!sym(response_variable_selected))) %>%
mutate(ecosystem_type = case_when(ecosystem_type == "Small unconnected" ~ "S",
ecosystem_type == "Medium unconnected" ~ "M",
ecosystem_type == "Large unconnected" ~ "L",
ecosystem_type == "Small connected to small" ~ "S_S",
ecosystem_type == "Small connected to large" ~ "S_L",
ecosystem_type == "Medium connected to medium" ~ "M_M",
ecosystem_type == "Large connected to large" ~ "L_L",
ecosystem_type == "Large connected to small" ~ "L_S",
TRUE ~ ecosystem_type)) %>%
ungroup()
# --- DATA FOR ANALYSIS - PLOT MEAN ± 95% CI --- #
p1 = plot.all.patches.points(data = data_for_analysis %>%
filter(disturbance == "high"),
response_variable_selected) +
annotate("text",
x = Inf,
y = Inf,
label = "High disturbance",
hjust = 1.1,
vjust = 1.1,
size = 5,
fontface = "bold") + # Adjust position and style
theme(axis.title.x = element_blank(), # Remove x-axis title
axis.text.x = element_blank()) # Remove x-axis text
## Warning in qt(conf.interval/2 + 0.5, datac$N - 1): NaNs produced
p2 = plot.all.patches.points(data = data_for_analysis %>%
filter(disturbance == "low"),
response_variable_selected) +
theme(legend.position = "none") +
annotate("text",
x = Inf,
y = Inf,
label = "Low disturbance",
hjust = 1.1,
vjust = 1.1,
size = 5,
fontface = "bold") # Adjust position and style
# Arrange the plots vertically
ggarrange(p1,
p2,
ncol = 1,
nrow = 2,
heights = c(1, 0.7))
# --- MODEL - CONSTRUCT --- #
# Define formula
formula = paste("get(response_variable_selected) ~",
"ecosystem_type * disturbance * day +",
"(day | ecosystem_ID) +",
"(day | baseline)") %>%
print()
## [1] "get(response_variable_selected) ~ ecosystem_type * disturbance * day + (day | ecosystem_ID) + (day | baseline)"
# Construct model
model = try.different.optimizers.ecos(data_for_analysis,
formula)
## [1] "Model successfully fitted with optimizer: bobyqa "
# --- MODEL - SUMMARY --- #
print(summary(model), digits = 1)
## Linear mixed model fit by maximum likelihood . t-tests use Satterthwaite's
## method [lmerModLmerTest]
## Formula: formula
## Data: data
## Control: lmerControl(optimizer = opt$optimizer)
##
## AIC BIC logLik deviance df.resid
## 10359.9 10534.0 -5141.0 10281.9 602
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -4.3 -0.5 0.0 0.5 3.8
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## ecosystem_ID (Intercept) 7e+03 83
## day 8e+01 9 -1.00
## baseline (Intercept) 4e+04 204
## day 5e+02 21 -1.00
## Residual 5e+05 702
## Number of obs: 641, groups: ecosystem_ID, 109; baseline, 109
##
## Fixed effects:
## Estimate Std. Error df t value
## (Intercept) 3e+03 4e+02 3e+02 8.9
## ecosystem_typeL_L -4e+02 5e+02 3e+02 -1.0
## ecosystem_typeL_S 3e+02 5e+02 3e+02 0.5
## ecosystem_typeM -2e+01 5e+02 3e+02 0.0
## ecosystem_typeM_M 7e+01 5e+02 3e+02 0.1
## ecosystem_typeS -1e+03 6e+02 3e+02 -2.1
## ecosystem_typeS_L -1e+03 5e+02 3e+02 -1.8
## ecosystem_typeS_S -1e+01 5e+02 3e+02 0.0
## disturbancelow -1e+02 5e+02 3e+02 -0.2
## day -7e+00 2e+01 2e+02 -0.3
## ecosystem_typeL_L:disturbancelow -4e+02 6e+02 3e+02 -0.6
## ecosystem_typeL_S:disturbancelow -1e+03 7e+02 3e+02 -1.5
## ecosystem_typeM:disturbancelow 6e+01 7e+02 3e+02 0.1
## ecosystem_typeM_M:disturbancelow 6e+01 6e+02 3e+02 0.1
## ecosystem_typeS:disturbancelow 1e+03 8e+02 3e+02 1.5
## ecosystem_typeS_L:disturbancelow 9e+02 7e+02 3e+02 1.2
## ecosystem_typeS_S:disturbancelow -2e+02 7e+02 3e+02 -0.3
## ecosystem_typeL_L:day 6e+01 3e+01 2e+02 2.1
## ecosystem_typeL_S:day -3e-01 3e+01 2e+02 0.0
## ecosystem_typeM:day 3e+01 3e+01 2e+02 1.0
## ecosystem_typeM_M:day 2e+01 3e+01 2e+02 0.8
## ecosystem_typeS:day 7e+01 4e+01 2e+02 1.9
## ecosystem_typeS_L:day 9e+01 3e+01 2e+02 3.0
## ecosystem_typeS_S:day -4e+00 3e+01 2e+02 -0.1
## disturbancelow:day 2e+01 3e+01 2e+02 0.8
## ecosystem_typeL_L:disturbancelow:day -1e+00 4e+01 2e+02 0.0
## ecosystem_typeL_S:disturbancelow:day 5e+01 4e+01 2e+02 1.1
## ecosystem_typeM:disturbancelow:day -2e+01 4e+01 2e+02 -0.6
## ecosystem_typeM_M:disturbancelow:day -3e+01 4e+01 2e+02 -0.7
## ecosystem_typeS:disturbancelow:day -6e+01 5e+01 2e+02 -1.3
## ecosystem_typeS_L:disturbancelow:day -7e+01 4e+01 2e+02 -1.7
## ecosystem_typeS_S:disturbancelow:day 2e+01 4e+01 2e+02 0.6
## Pr(>|t|)
## (Intercept) <2e-16 ***
## ecosystem_typeL_L 0.333
## ecosystem_typeL_S 0.584
## ecosystem_typeM 0.968
## ecosystem_typeM_M 0.882
## ecosystem_typeS 0.036 *
## ecosystem_typeS_L 0.067 .
## ecosystem_typeS_S 0.979
## disturbancelow 0.850
## day 0.734
## ecosystem_typeL_L:disturbancelow 0.535
## ecosystem_typeL_S:disturbancelow 0.146
## ecosystem_typeM:disturbancelow 0.933
## ecosystem_typeM_M:disturbancelow 0.932
## ecosystem_typeS:disturbancelow 0.146
## ecosystem_typeS_L:disturbancelow 0.218
## ecosystem_typeS_S:disturbancelow 0.802
## ecosystem_typeL_L:day 0.037 *
## ecosystem_typeL_S:day 0.993
## ecosystem_typeM:day 0.303
## ecosystem_typeM_M:day 0.423
## ecosystem_typeS:day 0.059 .
## ecosystem_typeS_L:day 0.003 **
## ecosystem_typeS_S:day 0.895
## disturbancelow:day 0.417
## ecosystem_typeL_L:disturbancelow:day 0.978
## ecosystem_typeL_S:disturbancelow:day 0.257
## ecosystem_typeM:disturbancelow:day 0.562
## ecosystem_typeM_M:disturbancelow:day 0.485
## ecosystem_typeS:disturbancelow:day 0.192
## ecosystem_typeS_L:disturbancelow:day 0.099 .
## ecosystem_typeS_S:disturbancelow:day 0.551
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (bobyqa) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
# --- MODEL - ANOVA --- #
car::Anova(model, type = "III")
## Analysis of Deviance Table (Type III Wald chisquare tests)
##
## Response: get(response_variable_selected)
## Chisq Df Pr(>Chisq)
## (Intercept) 79.3960 1 < 2.2e-16 ***
## ecosystem_type 13.9140 7 0.052733 .
## disturbance 0.0358 1 0.849879
## day 0.1156 1 0.733849
## ecosystem_type:disturbance 12.4010 7 0.088118 .
## ecosystem_type:day 20.7691 7 0.004127 **
## disturbance:day 0.6627 1 0.415605
## ecosystem_type:disturbance:day 13.0090 7 0.071889 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# --- ESTIMATE MARGINAL MEANS --- #
emmeans_output = emmeans(model,
specs = ~ ecosystem_type * disturbance * day,
adjust = "sidak",
bias.adj = TRUE,
lmer.df = "satterthwaite")
emmeans_output
## ecosystem_type disturbance day emmean SE df lower.CL upper.CL
## L high 17.8 3207 155 126 2741 3672
## L_L high 17.8 3747 109 126 3418 4076
## L_S high 17.8 3492 155 126 3027 3958
## M high 17.8 3745 155 126 3280 4211
## M_M high 17.8 3651 109 126 3322 3980
## S high 17.8 3165 198 202 2574 3756
## S_L high 17.8 3853 155 126 3387 4318
## S_S high 17.8 3130 115 146 2784 3476
## L low 17.8 3547 155 126 3082 4012
## L_L low 17.8 3667 109 126 3338 3996
## L_S low 17.8 3614 155 126 3148 4079
## M low 17.8 3704 155 126 3238 4169
## M_M low 17.8 3583 109 126 3254 3912
## S low 17.8 3569 157 131 3098 4041
## S_L low 17.8 3849 155 126 3383 4314
## S_S low 17.8 3710 109 126 3380 4039
##
## Degrees-of-freedom method: satterthwaite
## Results are given on the get (not the response) scale.
## Confidence level used: 0.95
## Conf-level adjustment: sidak method for 16 estimates
# --- CODE EACH LEVEL OF DISTURBANCE AND ECOSYSTEM TYPE TO THEN PRODUCE CONTRASTS --- #
high_L = c(1, rep(0,15))
high_L_L = c(rep(0,1), 1, rep(0,14))
high_L_S = c(rep(0,2), 1, rep(0,13))
high_M = c(rep(0,3), 1, rep(0,12))
high_M_M = c(rep(0,4), 1, rep(0,11))
high_S = c(rep(0,5), 1, rep(0,10))
high_S_L = c(rep(0,6), 1, rep(0,9))
high_S_S = c(rep(0,7), 1, rep(0,8))
low_L = c(rep(0,8), 1, rep(0,7))
low_L_L = c(rep(0,9), 1, rep(0,6))
low_L_S = c(rep(0,10), 1, rep(0,5))
low_M = c(rep(0,11), 1, rep(0,4))
low_M_M = c(rep(0,12), 1, rep(0,3))
low_S = c(rep(0,13), 1, rep(0,2))
low_S_L = c(rep(0,14), 1, rep(0,1))
low_S_S = c(rep(0,15), 1)
# --- PRODUCE ECOSYSTEM TYPE CONTRASTS --- #
# Set parameters
n_of_digits = 3
# Compute constrasts
contrasts = contrast(emmeans_output,
method = list("high S_L - S" = high_S_L - high_S,
"high S_L - S_S" = high_S_L - high_S_S,
"high S_S - S" = high_S_S - high_S,
"high M_M - M" = high_M_M - high_M,
"high L_S - L" = high_L_S - high_L,
"high L_S - L_L" = high_L_S - high_L_L,
"high L_L - L" = high_L_L - high_L,
"low S_L - S" = low_S_L - low_S,
"low S_L - S_S" = low_S_L - low_S_S,
"low S_S - S" = low_S_S - low_S,
"low M_M - M" = low_M_M - low_M,
"low L_S - L" = low_L_S - low_L,
"low L_S - L_L" = low_L_S - low_L_L,
"low L_L - L" = low_L_L - low_L)) %>%
as.data.frame() %>%
mutate(p.value = round(p.value, digits = n_of_digits),
estimate = round(estimate, digits = n_of_digits),
SE = round(SE, digits = n_of_digits),
df = round(df, digits = n_of_digits),
t.ratio = round(t.ratio, digits = n_of_digits),
e = "",
e = ifelse(p.value > 0.1,
"",
e),
e = ifelse(p.value < 0.05,
"*",
e),
e = ifelse(p.value < 0.01,
"**",
e),
e = ifelse(p.value < 0.001,
"***",
e)) %>%
rename(" " = e)
# --- SHOW ECOSYSTEM TYPE CONSTRASTS --- #
contrasts
## contrast estimate SE df t.ratio p.value
## 1 high S_L - S 687.553 251.380 167.153 2.735 0.007 **
## 2 high S_L - S_S 723.004 193.148 132.515 3.743 0.000 ***
## 3 high S_S - S -35.451 229.229 185.647 -0.155 0.877
## 4 high M_M - M -93.928 189.642 125.539 -0.495 0.621
## 5 high L_S - L 285.749 218.980 125.539 1.305 0.194
## 6 high L_S - L_L -254.951 189.642 125.539 -1.344 0.181
## 7 high L_L - L 540.699 189.642 125.539 2.851 0.005 **
## 8 low S_L - S 279.243 220.580 128.428 1.266 0.208
## 9 low S_L - S_S 139.105 189.642 125.539 0.734 0.465
## 10 low S_S - S 140.138 191.487 129.392 0.732 0.466
## 11 low M_M - M -120.492 189.642 125.539 -0.635 0.526
## 12 low L_S - L 66.693 218.980 125.539 0.305 0.761
## 13 low L_S - L_L -53.114 189.642 125.539 -0.280 0.780
## 14 low L_L - L 119.807 189.642 125.539 0.632 0.529
# --- PLOT MODEL RESIDUALS --- #
# Simulate residuals from the fitted model
simulationOutput <- simulateResiduals(fittedModel = model,
n = 1000)
# Test for overdispersion in the model to check if variance exceeds mean
testDispersion(simulationOutput)
##
## DHARMa nonparametric dispersion test via sd of residuals fitted vs.
## simulated
##
## data: simulationOutput
## dispersion = 1.0018, p-value = 0.96
## alternative hypothesis: two.sided
# Plot Q-Q and Residuals vs Fitted plots
plot(simulationOutput)
response_variable_selected = "photo_hetero_ratio"
# --- ORIGINAL DATA - PLOT MEAN ± 95% CI --- #
p1 = plot.all.patches.points(data = ds_ecosystems %>%
filter(disturbance == "high"),
response_variable_selected) +
annotate("text",
x = Inf,
y = Inf,
label = "High disturbance",
hjust = 1.1,
vjust = 1.1,
size = 5,
fontface = "bold") + # Adjust position and style
theme(axis.title.x = element_blank(), # Remove x-axis title
axis.text.x = element_blank()) # Remove x-axis text
## Warning in qt(conf.interval/2 + 0.5, datac$N - 1): NaNs produced
p2 = plot.all.patches.points(data = ds_ecosystems %>%
filter(disturbance == "low"),
response_variable_selected) +
theme(legend.position = "none") +
annotate("text",
x = Inf,
y = Inf,
label = "Low disturbance",
hjust = 1.1,
vjust = 1.1,
size = 5,
fontface = "bold") # Adjust position and style
# Arrange the plots vertically
ggarrange(p1,
p2,
ncol = 1,
nrow = 2,
heights = c(1, 0.7))
## Warning: Removed 2 rows containing non-finite outside the scale range
## (`stat_summary()`).
## Warning: Removed 2 rows containing non-finite outside the scale range
## (`stat_summary()`).
# --- PREPARE DATA FOR ANALYSIS --- #
# Add baselines
baselines = ds_ecosystems %>%
filter(time_point == time_point_of_baselines) %>%
select(ecosystem_ID,
all_of(response_variable_selected)) %>%
rename(baseline = all_of(response_variable_selected))
data_for_analysis = ds_ecosystems %>%
left_join(baselines)
# Filter data and change level names
data_for_analysis = data_for_analysis %>%
filter(time_point %in% time_points_model,
#!is.na(water_addition_ml),
!is.na(!!sym(response_variable_selected)),
!is.infinite(!!sym(response_variable_selected))) %>%
mutate(ecosystem_type = case_when(ecosystem_type == "Small unconnected" ~ "S",
ecosystem_type == "Medium unconnected" ~ "M",
ecosystem_type == "Large unconnected" ~ "L",
ecosystem_type == "Small connected to small" ~ "S_S",
ecosystem_type == "Small connected to large" ~ "S_L",
ecosystem_type == "Medium connected to medium" ~ "M_M",
ecosystem_type == "Large connected to large" ~ "L_L",
ecosystem_type == "Large connected to small" ~ "L_S",
TRUE ~ ecosystem_type)) %>%
ungroup()
# --- DATA FOR ANALYSIS - PLOT MEAN ± 95% CI --- #
p1 = plot.all.patches.points(data = data_for_analysis %>%
filter(disturbance == "high"),
response_variable_selected) +
annotate("text",
x = Inf,
y = Inf,
label = "High disturbance",
hjust = 1.1,
vjust = 1.1,
size = 5,
fontface = "bold") + # Adjust position and style
theme(axis.title.x = element_blank(), # Remove x-axis title
axis.text.x = element_blank()) # Remove x-axis text
## Warning in qt(conf.interval/2 + 0.5, datac$N - 1): NaNs produced
p2 = plot.all.patches.points(data = data_for_analysis %>%
filter(disturbance == "low"),
response_variable_selected) +
theme(legend.position = "none") +
annotate("text",
x = Inf,
y = Inf,
label = "Low disturbance",
hjust = 1.1,
vjust = 1.1,
size = 5,
fontface = "bold") # Adjust position and style
# Arrange the plots vertically
ggarrange(p1,
p2,
ncol = 1,
nrow = 2,
heights = c(1, 0.7))
# --- MODEL - CONSTRUCT --- #
# Define formula
formula = paste("get(response_variable_selected) ~",
"ecosystem_type * disturbance * day +",
"(day | ecosystem_ID) +",
"(day | baseline)") %>%
print()
## [1] "get(response_variable_selected) ~ ecosystem_type * disturbance * day + (day | ecosystem_ID) + (day | baseline)"
# Construct model
model = try.different.optimizers.ecos(data_for_analysis,
formula)
## [1] "Model successfully fitted with optimizer: bobyqa "
# --- MODEL - SUMMARY --- #
print(summary(model), digits = 1)
## Linear mixed model fit by maximum likelihood . t-tests use Satterthwaite's
## method [lmerModLmerTest]
## Formula: formula
## Data: data
## Control: lmerControl(optimizer = opt$optimizer)
##
## AIC BIC logLik deviance df.resid
## -447.3 -273.4 262.7 -525.3 600
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.5 -0.5 -0.1 0.3 8.0
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## ecosystem_ID (Intercept) 1e-09 3e-05
## day 6e-12 2e-06 -1.00
## baseline (Intercept) 1e-02 1e-01
## day 9e-05 9e-03 -1.00
## Residual 2e-02 1e-01
## Number of obs: 639, groups: ecosystem_ID, 109; baseline, 104
##
## Fixed effects:
## Estimate Std. Error df t value
## (Intercept) -2e-01 9e-02 2e+02 -1.7
## ecosystem_typeL_L 2e-01 1e-01 2e+02 1.9
## ecosystem_typeL_S 1e-01 1e-01 2e+02 0.9
## ecosystem_typeM 2e-01 1e-01 2e+02 1.7
## ecosystem_typeM_M 1e-01 1e-01 2e+02 1.2
## ecosystem_typeS 3e-01 1e-01 2e+02 2.2
## ecosystem_typeS_L 4e-01 1e-01 2e+02 2.9
## ecosystem_typeS_S 3e-01 1e-01 2e+02 3.0
## disturbancelow 4e-01 1e-01 2e+02 3.1
## day 2e-02 6e-03 1e+02 4.1
## ecosystem_typeL_L:disturbancelow -4e-01 2e-01 2e+02 -2.6
## ecosystem_typeL_S:disturbancelow -3e-01 2e-01 2e+02 -1.8
## ecosystem_typeM:disturbancelow -4e-01 2e-01 2e+02 -2.4
## ecosystem_typeM_M:disturbancelow -4e-01 2e-01 2e+02 -2.4
## ecosystem_typeS:disturbancelow -5e-01 2e-01 2e+02 -2.7
## ecosystem_typeS_L:disturbancelow -6e-01 2e-01 2e+02 -3.1
## ecosystem_typeS_S:disturbancelow -6e-01 2e-01 2e+02 -3.7
## ecosystem_typeL_L:day -2e-02 7e-03 1e+02 -2.7
## ecosystem_typeL_S:day -8e-03 8e-03 1e+02 -1.0
## ecosystem_typeM:day -2e-02 8e-03 1e+02 -2.7
## ecosystem_typeM_M:day -1e-02 7e-03 1e+02 -1.9
## ecosystem_typeS:day -3e-02 9e-03 1e+02 -3.3
## ecosystem_typeS_L:day -3e-02 8e-03 2e+02 -3.9
## ecosystem_typeS_S:day -3e-02 7e-03 1e+02 -4.5
## disturbancelow:day -3e-02 8e-03 1e+02 -3.5
## ecosystem_typeL_L:disturbancelow:day 3e-02 1e-02 1e+02 3.1
## ecosystem_typeL_S:disturbancelow:day 2e-02 1e-02 1e+02 1.7
## ecosystem_typeM:disturbancelow:day 4e-02 1e-02 1e+02 3.1
## ecosystem_typeM_M:disturbancelow:day 3e-02 1e-02 1e+02 2.7
## ecosystem_typeS:disturbancelow:day 4e-02 1e-02 1e+02 3.2
## ecosystem_typeS_L:disturbancelow:day 4e-02 1e-02 2e+02 3.3
## ecosystem_typeS_S:disturbancelow:day 4e-02 1e-02 1e+02 4.2
## Pr(>|t|)
## (Intercept) 0.098 .
## ecosystem_typeL_L 0.056 .
## ecosystem_typeL_S 0.375
## ecosystem_typeM 0.095 .
## ecosystem_typeM_M 0.228
## ecosystem_typeS 0.030 *
## ecosystem_typeS_L 0.004 **
## ecosystem_typeS_S 0.003 **
## disturbancelow 0.002 **
## day 7e-05 ***
## ecosystem_typeL_L:disturbancelow 0.009 **
## ecosystem_typeL_S:disturbancelow 0.070 .
## ecosystem_typeM:disturbancelow 0.016 *
## ecosystem_typeM_M:disturbancelow 0.016 *
## ecosystem_typeS:disturbancelow 0.008 **
## ecosystem_typeS_L:disturbancelow 0.002 **
## ecosystem_typeS_S:disturbancelow 2e-04 ***
## ecosystem_typeL_L:day 0.007 **
## ecosystem_typeL_S:day 0.298
## ecosystem_typeM:day 0.008 **
## ecosystem_typeM_M:day 0.066 .
## ecosystem_typeS:day 0.001 **
## ecosystem_typeS_L:day 1e-04 ***
## ecosystem_typeS_S:day 2e-05 ***
## disturbancelow:day 6e-04 ***
## ecosystem_typeL_L:disturbancelow:day 0.002 **
## ecosystem_typeL_S:disturbancelow:day 0.093 .
## ecosystem_typeM:disturbancelow:day 0.003 **
## ecosystem_typeM_M:disturbancelow:day 0.008 **
## ecosystem_typeS:disturbancelow:day 0.002 **
## ecosystem_typeS_L:disturbancelow:day 0.001 **
## ecosystem_typeS_S:disturbancelow:day 4e-05 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (bobyqa) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
# --- MODEL - ANOVA --- #
car::Anova(model, type = "III")
## Analysis of Deviance Table (Type III Wald chisquare tests)
##
## Response: get(response_variable_selected)
## Chisq Df Pr(>Chisq)
## (Intercept) 2.7670 1 0.096224 .
## ecosystem_type 15.6134 7 0.028893 *
## disturbance 9.6489 1 0.001895 **
## day 17.0660 1 3.610e-05 ***
## ecosystem_type:disturbance 16.4222 7 0.021527 *
## ecosystem_type:day 32.9062 7 2.756e-05 ***
## disturbance:day 12.3798 1 0.000434 ***
## ecosystem_type:disturbance:day 22.2662 7 0.002285 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# --- ESTIMATE MARGINAL MEANS --- #
emmeans_output = emmeans(model,
specs = ~ ecosystem_type * disturbance * day,
adjust = "sidak",
bias.adj = TRUE,
lmer.df = "satterthwaite")
emmeans_output
## ecosystem_type disturbance day emmean SE df lower.CL upper.CL
## L high 17.8 0.2681 0.0349 135 0.16348 0.373
## L_L high 17.8 0.1483 0.0238 182 0.07714 0.219
## L_S high 17.8 0.2331 0.0349 135 0.12846 0.338
## M high 17.8 0.0943 0.0349 135 -0.01038 0.199
## M_M high 17.8 0.1727 0.0247 135 0.09868 0.247
## S high 17.8 0.0432 0.0439 202 -0.08773 0.174
## S_L high 17.8 0.1013 0.0330 251 0.00313 0.199
## S_S high 17.8 0.0389 0.0255 196 -0.03734 0.115
## L low 17.8 0.1648 0.0349 135 0.06019 0.269
## L_L low 17.8 0.1655 0.0238 182 0.09432 0.237
## L_S low 17.8 0.1403 0.0349 135 0.03565 0.245
## M low 17.8 0.1682 0.0349 135 0.06355 0.273
## M_M low 17.8 0.1581 0.0238 182 0.08700 0.229
## S low 17.8 0.1202 0.0354 141 0.01408 0.226
## S_L low 17.8 0.0773 0.0327 236 -0.01993 0.175
## S_S low 17.8 0.0918 0.0247 135 0.01782 0.166
##
## Degrees-of-freedom method: satterthwaite
## Results are given on the get (not the response) scale.
## Confidence level used: 0.95
## Conf-level adjustment: sidak method for 16 estimates
# --- CODE EACH LEVEL OF DISTURBANCE AND ECOSYSTEM TYPE TO THEN PRODUCE CONTRASTS --- #
high_L = c(1, rep(0,15))
high_L_L = c(rep(0,1), 1, rep(0,14))
high_L_S = c(rep(0,2), 1, rep(0,13))
high_M = c(rep(0,3), 1, rep(0,12))
high_M_M = c(rep(0,4), 1, rep(0,11))
high_S = c(rep(0,5), 1, rep(0,10))
high_S_L = c(rep(0,6), 1, rep(0,9))
high_S_S = c(rep(0,7), 1, rep(0,8))
low_L = c(rep(0,8), 1, rep(0,7))
low_L_L = c(rep(0,9), 1, rep(0,6))
low_L_S = c(rep(0,10), 1, rep(0,5))
low_M = c(rep(0,11), 1, rep(0,4))
low_M_M = c(rep(0,12), 1, rep(0,3))
low_S = c(rep(0,13), 1, rep(0,2))
low_S_L = c(rep(0,14), 1, rep(0,1))
low_S_S = c(rep(0,15), 1)
# --- PRODUCE ECOSYSTEM TYPE CONTRASTS --- #
# Set parameters
n_of_digits = 3
# Compute constrasts
contrasts = contrast(emmeans_output,
method = list("high L - S" = high_L - high_S,
"high M - S" = high_M - high_S,
"low L - S" = low_L - low_S,
"low M - S" = low_M - low_S)) %>%
as.data.frame() %>%
mutate(p.value = round(p.value, digits = n_of_digits),
estimate = round(estimate, digits = n_of_digits),
SE = round(SE, digits = n_of_digits),
df = round(df, digits = n_of_digits),
t.ratio = round(t.ratio, digits = n_of_digits),
e = "",
e = ifelse(p.value > 0.1,
"",
e),
e = ifelse(p.value < 0.05,
"*",
e),
e = ifelse(p.value < 0.01,
"**",
e),
e = ifelse(p.value < 0.001,
"***",
e)) %>%
rename(" " = e)
# --- SHOW ECOSYSTEM TYPE CONSTRASTS --- #
contrasts
## contrast estimate SE df t.ratio p.value
## 1 high L - S 0.225 0.056 172.002 4.013 0.000 ***
## 2 high M - S 0.051 0.056 172.002 0.911 0.364
## 3 low L - S 0.045 0.050 137.957 0.899 0.370
## 4 low M - S 0.048 0.050 137.957 0.967 0.335
# --- PLOT MODEL RESIDUALS --- #
# Simulate residuals from the fitted model
simulationOutput <- simulateResiduals(fittedModel = model,
n = 1000)
# Test for overdispersion in the model to check if variance exceeds mean
testDispersion(simulationOutput)
##
## DHARMa nonparametric dispersion test via sd of residuals fitted vs.
## simulated
##
## data: simulationOutput
## dispersion = 0.99756, p-value = 0.998
## alternative hypothesis: two.sided
# Plot Q-Q and Residuals vs Fitted plots
plot(simulationOutput)
# --- PLOT BIOMASS-SPECIES RICHNESS RELATIONSHIP --- #
ds_ecosystems %>%
filter(is.na(species_richness) != TRUE) %>%
ggplot(aes(x = species_richness,
y = bioarea_mm2_per_ml)) +
geom_point() +
xlim(0, length(protist_species)) +
labs(x = axis_names$axis_name[axis_names$variable == "species_richness"],
y = axis_names$axis_name[axis_names$variable == "bioarea_mm2_per_ml"]) +
theme_bw() +
theme(panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = legend_position,
legend.key.width = unit(legend_width_cm, "cm"))
# --- PLOT BIOMASS-SHANNON RELATIONSHIP --- #
ds_ecosystems %>%
filter(is.na(shannon) != TRUE) %>%
ggplot(aes(x = shannon,
y = bioarea_mm2_per_ml)) +
geom_point() +
labs(x = axis_names$axis_name[axis_names$variable == "shannon"],
y = axis_names$axis_name[axis_names$variable == "bioarea_mm2_per_ml"]) +
theme_bw() +
theme(panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = legend_position,
legend.key.width = unit(legend_width_cm, "cm"))
# --- PLOT BIOMASS-EVENESS RELATIONSHIP --- #
ds_ecosystems %>%
filter(is.na(evenness_pielou) != TRUE) %>%
ggplot(aes(x = evenness_pielou,
y = bioarea_mm2_per_ml)) +
geom_point() +
labs(x = axis_names$axis_name[axis_names$variable == "evenness_pielou"],
y = axis_names$axis_name[axis_names$variable == "bioarea_mm2_per_ml"]) +
theme_bw() +
theme(panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = legend_position,
legend.key.width = unit(legend_width_cm, "cm"))
disturbance_selected = "high"
# --- PREPARE DATA FOR PLOTTING --- #
# Define what you want to plot
metaecosystem_type_selected = c("Medium-Medium",
"Small-Large")
# Filter dataset
data_for_plotting = ds_metaecosystems %>%
filter(metaecosystem_type %in% metaecosystem_type_selected,
disturbance == disturbance_selected)
# Write function to plot a response variable. Afterwards you can use this function to plot alpha, beta, gamma diversity, and biomass.
plot.single.plot = function(response_variable_selected){
data_for_plotting %>%
filter(metaecosystem_type %in% metaecosystem_type_selected,
!is.na(!!sym(response_variable_selected))) %>%
summarySE(measurevar = response_variable_selected,
groupvars = c("day", "ecosystem_size_symmetry", "connection")) %>%
ggplot(aes(x = day,
y = get(response_variable_selected),
group = interaction(day, ecosystem_size_symmetry, connection),
color = ecosystem_size_symmetry,
linetype = connection)) +
geom_point(stat = "summary",
fun = "mean",
position = position_dodge(dodging),
size = treatment_points_size) +
geom_line(stat = "summary",
fun = "mean",
aes(group = interaction(ecosystem_size_symmetry, connection)),
position = position_dodge(dodging),
linewidth = treatment_lines_linewidth) +
geom_errorbar(aes(ymax = get(response_variable_selected) + ci,
ymin = get(response_variable_selected) - ci),
width = width_errorbar,
position = position_dodge(dodging)) +
labs(x = axis_names$axis_name[axis_names$variable == "day"],
y = axis_names$axis_name[axis_names$variable == response_variable_selected],
color = "") +
scale_color_manual(values = treatment_colours_paper) +
scale_linetype_manual(values = treatment_linetype_paper) +
geom_vline(xintercept = resource_flow_days,
linetype = resource_flow_line_type,
color = resource_flow_line_colour,
linewidth = resource_flow_line_width) +
theme_bw() +
theme(panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = legend_position,
legend.key.width = unit(legend_width_cm, "cm")) +
guides(color = guide_legend(title = NULL,
nrow = 2),
linetype = guide_legend(title = NULL,
nrow = 2)) +
theme(plot.margin = unit(c(ggarrange_margin_left,
ggarrange_margin_right,
ggarrange_margin_bottom,
ggarrange_margin_left),
"cm")) +
geom_rect(xmin = grey_background_xmin,
xmax = grey_background_xmax,
ymin = grey_background_ymin,
ymax = grey_background_ymax,
fill = grey_background_fill,
alpha = grey_background_alpha,
color = grey_background_color)
}
# Combine plots of alpha, beta, gamma biodiversity and biomass.
p_combined = ggarrange(plot.single.plot("mean_shannon") +
rremove("xlab") +
theme(axis.text.x = element_blank(),
axis.ticks.x = element_blank()) +
font("legend.text", size = paper_labels_size) +
font("ylab", size = paper_labels_size),
plot.single.plot("bray_curtis") +
rremove("xlab") +
theme(axis.text.x = element_blank(),
axis.ticks.x = element_blank()) +
font("legend.text",
size = paper_labels_size) +
font("ylab",
size = paper_labels_size),
plot.single.plot("metaecosystem_richness") +
rremove("xlab") +
theme(axis.text.x = element_blank(),
axis.ticks.x = element_blank()) +
font("legend.text",
size = paper_labels_size) +
font("ylab",
size = paper_labels_size),
plot.single.plot("total_metaecosystem_bioarea_mm2") +
font("legend.text",
size = paper_labels_size) +
font("xlab",
size = paper_labels_size) +
font("ylab",
size = paper_labels_size) +
scale_x_continuous(breaks = unique(data_for_plotting$day)),
heights = c(0.8, 0.8, 0.8, 1),
nrow = 4,
common.legend = TRUE,
align = "v",
labels = c("(a)", "(b)", "(c)", "(d)"),
label.x = 0.1,
label.y = 0.8) %>%
print()
# --- PREPARE DATA FOR PLOTTING --- #
# Define parameters
ecosystem_type_selected = c("Small connected to large",
"Small connected to small",
"Small unconnected",
"Large connected to small",
"Large connected to large",
"Large unconnected")
# Filter data
data_for_plotting = ds_ecosystems %>%
filter(ecosystem_type %in% ecosystem_type_selected,
disturbance == disturbance_selected)
# --- CONSTRUCT FUNCTION TO PLOT BIOMASS/SHANNON OF SMALL AND LARGE ECOSYSTEMS --- #
plot.single.plot = function(response_variable_selected){
data_for_plotting %>%
filter(!is.na(!!sym(response_variable_selected))) %>%
summarySE(measurevar = response_variable_selected,
groupvars = c("day", "time_point", "ecosystem_type", "ecosystem_size", "connection")) %>%
ggplot(aes(x = day,
y = get(response_variable_selected),
group = interaction(day, ecosystem_type),
color = ecosystem_type,
linetype = ecosystem_type)) +
geom_point(stat = "summary",
fun = "mean",
position = position_dodge(dodging),
size = treatment_points_size) +
geom_line(stat = "summary",
fun = "mean",
aes(group = ecosystem_type),
position = position_dodge(dodging),
linewidth = treatment_lines_linewidth) +
geom_errorbar(aes(ymax = get(response_variable_selected) + ci,
ymin = get(response_variable_selected) - ci),
width = width_errorbar,
position = position_dodge(dodging)) +
labs(x = axis_names$axis_name[axis_names$variable == "day"],
y = axis_names$axis_name[axis_names$variable == response_variable_selected],
color = "") +
scale_color_manual(values = c("#993404",
"#993404",
"#993404",
"#3182bd",
"#3182bd",
"#3182bd"),
label = expression(S[L],
S[S],
S,
L[S],
L[L],
L)) +
scale_linetype_manual(values = c("solid",
"dashed",
"dotted",
"solid",
"dashed",
"dotted"),
label = expression(S[L],
S[S],
S,
L[S],
L[L],
L)) +
geom_vline(xintercept = resource_flow_days,
linetype = resource_flow_line_type,
color = resource_flow_line_colour,
linewidth = resource_flow_line_width) +
geom_hline(yintercept = 0,
color = zero_line_colour,
linetype = zero_line_line_type,
linewidth = zero_line_line_width) +
theme_bw() +
theme(panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = legend_position,
legend.key.width = unit(legend_width_cm, "cm")) +
guides(color = guide_legend(title = NULL,
nrow = 3),
linetype = guide_legend(title = NULL,
nrow = 3)) +
geom_rect(xmin = grey_background_xmin,
xmax = grey_background_xmax,
ymin = grey_background_ymin,
ymax = grey_background_ymax,
fill = grey_background_fill,
alpha = grey_background_alpha,
color = grey_background_color)
}
# --- COMBINE PLOTS OF SHANNON AND BIOMASS --- #
p_combined = ggarrange(plot.single.plot("shannon") +
rremove("xlab") +
theme(axis.text.x = element_blank(),
axis.ticks.x = element_blank()) +
font("legend.text",
size = paper_labels_size) +
font("ylab",
size = paper_labels_size),
plot.single.plot("bioarea_mm2_per_ml") +
font("legend.text",
size = paper_labels_size) +
font("xlab",
size = paper_labels_size) +
font("ylab",
size = paper_labels_size) +
scale_x_continuous(breaks = unique(data_for_plotting$day)),
heights = c(0.8, 0.8, 1),
nrow = 2,
align = "v",
labels = c("(a)", "(b)"),
label.x = 0.1,
label.y = 0.8,
common.legend = TRUE) %>%
print()
## Warning in qt(conf.interval/2 + 0.5, datac$N - 1): NaNs produced
# --- PREPARE DATA FOR PLOTTING --- #
# Define parameters
ecosystem_type_selected = c("Medium connected to medium",
"Medium unconnected")
# Filter data
data_for_plotting = ds_ecosystems %>%
filter(ecosystem_type %in% ecosystem_type_selected,
disturbance == disturbance_selected,
!is.na(!!sym(response_variable_selected)))
# --- CONSTRUCT FUNCTION TO PLOT BIOMASS/SHANNON OF MEDIUM ECOSYSTEMS --- #
plot.single.plot = function(response_variable_selected){
data_for_plotting %>%
summarySE(measurevar = response_variable_selected,
groupvars = c("day", "time_point", "ecosystem_type", "ecosystem_size", "connection")) %>%
ggplot(aes(x = day,
y = get(response_variable_selected),
group = interaction(day, ecosystem_type),
color = ecosystem_type,
linetype = ecosystem_type)) +
geom_point(stat = "summary",
fun = "mean",
position = position_dodge(dodging),
size = treatment_points_size) +
geom_line(stat = "summary",
fun = "mean",
aes(group = ecosystem_type),
position = position_dodge(dodging),
linewidth = treatment_lines_linewidth) +
geom_errorbar(aes(ymax = get(response_variable_selected) + ci,
ymin = get(response_variable_selected) - ci),
width = width_errorbar,
position = position_dodge(dodging)) +
labs(x = axis_names$axis_name[axis_names$variable == "day"],
y = axis_names$axis_name[axis_names$variable == response_variable_selected],
color = "") +
scale_color_manual(values = c("#d95f0e",
"#d95f0e"),
label = expression(M[M],
M)) +
scale_linetype_manual(values = c("dashed",
"dotted"),
label = expression(M[M],
M)) +
geom_vline(xintercept = resource_flow_days,
linetype = resource_flow_line_type,
color = resource_flow_line_colour,
linewidth = resource_flow_line_width) +
geom_hline(yintercept = 0,
color = zero_line_colour,
linetype = zero_line_line_type,
linewidth = zero_line_line_width) +
theme_bw() +
theme(panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = legend_position,
legend.key.width = unit(legend_width_cm, "cm")) +
guides(color = guide_legend(title = NULL,
nrow = 3),
linetype = guide_legend(title = NULL,
nrow = 3)) +
geom_rect(xmin = grey_background_xmin,
xmax = grey_background_xmax,
ymin = grey_background_ymin,
ymax = grey_background_ymax,
fill = grey_background_fill,
alpha = grey_background_alpha,
color = grey_background_color)
}
# --- COMBINE PLOTS OF SHANNON AND BIOMASS --- #
p_combined = ggarrange(plot.single.plot("shannon") +
rremove("xlab") +
theme(axis.text.x = element_blank(),
axis.ticks.x = element_blank()) +
font("legend.text",
size = paper_labels_size) +
font("ylab",
size = paper_labels_size),
plot.single.plot("bioarea_mm2_per_ml") +
font("legend.text",
size = paper_labels_size) +
font("xlab",
size = paper_labels_size) +
font("ylab",
size = paper_labels_size) +
scale_x_continuous(breaks = unique(data_for_plotting$day)),
heights = c(0.8, 0.8, 1),
nrow = 2,
align = "v",
labels = c("(a)", "(b)"),
label.x = 0.1,
label.y = 0.8,
common.legend = TRUE) %>%
print()
# --- DEFINE RESPONSE VARIABLE YOU WANT TO PLOT --- #
response_variable = "photo_hetero_ratio"
# --- PREPARE DATA FOR PLOTTING --- #
# Define parameters
ecosystem_type_selected = c("S",
"M",
"L")
# Manipulate data
data_for_plotting = ds_ecosystems %>%
mutate(ecosystem_type = case_when(ecosystem_type == "Small unconnected" ~ "S",
ecosystem_type == "Medium unconnected" ~ "M",
ecosystem_type == "Large unconnected" ~ "L")) %>%
filter(ecosystem_type %in% ecosystem_type_selected,
disturbance == disturbance_selected,
!is.na(!!sym(response_variable)))
# --- CONSTRUCT PLOT --- #
p = data_for_plotting %>%
# Manipulate
summarySE(measurevar = response_variable,
groupvars = c("day", "ecosystem_type", "ecosystem_size", "connection")) %>%
# Create plot
ggplot(aes(x = day,
y = get(response_variable),
group = interaction(day, ecosystem_type),
color = ecosystem_type)) +
# Points
geom_point(stat = "summary",
fun = "mean",
position = position_dodge(dodging),
size = treatment_points_size) +
geom_errorbar(aes(ymax = get(response_variable) + ci,
ymin = get(response_variable) - ci),
width = width_errorbar,
position = position_dodge(dodging)) +
# Lines
geom_line(stat = "summary",
fun = "mean",
aes(group = ecosystem_type),
position = position_dodge(dodging),
linewidth = treatment_lines_linewidth) +
# Axes and legend
labs(x = axis_names$axis_name[axis_names$variable == "day"],
y = axis_names$axis_name[axis_names$variable == response_variable],
color = "") +
scale_x_continuous(breaks = unique(data_for_plotting$day)) +
guides(color = guide_legend(title = NULL,
nrow = 1),
linetype = guide_legend(title = NULL,
nrow = 1)) +
scale_color_manual(values = c("#000000",
"#737373",
"#bdbdbd")) +
# Extra graphic elements
theme_bw() +
theme(panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = legend_position,
legend.key.width = unit(legend_width_cm, "cm"),
axis.title.x = element_text(size = paper_labels_size),
axis.title.y = element_text(size = paper_labels_size),
legend.text = element_text(size = paper_labels_size)) +
geom_rect(xmin = grey_background_xmin,
xmax = grey_background_xmax,
ymin = grey_background_ymin,
ymax = grey_background_ymax,
fill = grey_background_fill,
alpha = grey_background_alpha,
color = grey_background_color) +
geom_hline(yintercept = 0,
color = zero_line_colour,
linetype = zero_line_line_type,
linewidth = zero_line_line_width) +
geom_vline(xintercept = resource_flow_days,
linetype = resource_flow_line_type,
color = resource_flow_line_colour,
linewidth = resource_flow_line_width)
## Warning in qt(conf.interval/2 + 0.5, datac$N - 1): NaNs produced
p
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
# --- DEFINE PLOTTING PARAMETERS --- #
legend_row_n_input = 2
size_y_axis = 22
x_min = -0.2
x_max = 30
y_min = -0.8
y_max = 3
# --- PREPARE DATA FOR PLOTTING --- #
# Define parameters
ecosystem_type_all = c("Small connected to large",
"Small unconnected",
"Small connected to small",
"Large connected to small",
"Large unconnected",
"Large connected to large")
response_variable_selected = "shannon"
# Filter data
data_for_plotting = ds_ecosystems %>%
filter(ecosystem_type %in% ecosystem_type_all,
disturbance == disturbance_selected)
# --- CONSTRUCT PLOTS --- #
# Define parameters
plots = NULL
# Construct plots
plots[[1]] = plot.ecosystems.empty.presentations(y_min_alpha,
y_max_alpha,
"shannon")
for (i in 1:length(ecosystem_type_all)+1) {
plots[[i+1]] = plot.ecosystems.points.presentations(data = data_for_plotting,
ecosystem_type_selected = ecosystem_type_all[1:i],
response_variable_selected) +
theme(plot.margin = unit(c(ggarrange_margin_left,
ggarrange_margin_right,
ggarrange_margin_bottom,
ggarrange_margin_left),
"cm"),
legend.position = "none") +
scale_y_continuous(labels = scales::number_format(accuracy = 0.01)) +
xlim(x_min, x_max) +
ylim(y_min, y_max)
}
## Warning in qt(conf.interval/2 + 0.5, datac$N - 1): NaNs produced
## Warning in qt(conf.interval/2 + 0.5, datac$N - 1): NaNs produced
## Warning in qt(conf.interval/2 + 0.5, datac$N - 1): NaNs produced
## Warning in qt(conf.interval/2 + 0.5, datac$N - 1): NaNs produced
## Warning in qt(conf.interval/2 + 0.5, datac$N - 1): NaNs produced
## Warning in qt(conf.interval/2 + 0.5, datac$N - 1): NaNs produced
# --- COMBINE PLOTS --- #
# Define parameters
p_combined = NULL
p_combined[[1]] = plots[[1]]
# Combine plots
for(i in 1:length(ecosystem_type_all)+1){
p_combined[[i]] = ggarrange(plots[[i]] +
theme(axis.text = element_text(size = presentation_axes_size)) +
font("legend.text", size = size_legend) +
font("xlab", size = size_y_axis) +
font("ylab", size = size_y_axis),
nrow = 1,
align = "v",
label.x = 0.1,
label.y = 0.8)
}
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: Removed 1 row containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 1 row containing missing values or values outside the scale range
## (`geom_line()`).
# --- SAVE COMBINED PLOTS --- #
for(i in 1:length(ecosystem_type_all)+1){
png(file = here("..",
"3_results",
"figures",
disturbance_selected,
"presentations",
paste0("ecosystems_connected_diversity_", i, ".png")),
width = presentation_figure_width,
height = presentation_figure_height,
units = presentation_figure_units,
res = presentation_figure_res)
print(p_combined[[i]])
dev.off()
}
disturbance_selected = "low"
# --- PREPARE DATA FOR PLOTTING --- #
# Define what you want to plot
metaecosystem_type_selected = c("Medium-Medium",
"Small-Large")
# Filter dataset
data_for_plotting = ds_metaecosystems %>%
filter(metaecosystem_type %in% metaecosystem_type_selected,
disturbance == disturbance_selected)
# Write function to plot a response variable. Afterwards you can use this function to plot alpha, beta, gamma diversity, and biomass.
plot.single.plot = function(response_variable_selected){
data_for_plotting %>%
filter(metaecosystem_type %in% metaecosystem_type_selected,
!is.na(!!sym(response_variable_selected))) %>%
summarySE(measurevar = response_variable_selected,
groupvars = c("day", "ecosystem_size_symmetry", "connection")) %>%
ggplot(aes(x = day,
y = get(response_variable_selected),
group = interaction(day, ecosystem_size_symmetry, connection),
color = ecosystem_size_symmetry,
linetype = connection)) +
geom_point(stat = "summary",
fun = "mean",
position = position_dodge(dodging),
size = treatment_points_size) +
geom_line(stat = "summary",
fun = "mean",
aes(group = interaction(ecosystem_size_symmetry, connection)),
position = position_dodge(dodging),
linewidth = treatment_lines_linewidth) +
geom_errorbar(aes(ymax = get(response_variable_selected) + ci,
ymin = get(response_variable_selected) - ci),
width = width_errorbar,
position = position_dodge(dodging)) +
labs(x = axis_names$axis_name[axis_names$variable == "day"],
y = axis_names$axis_name[axis_names$variable == response_variable_selected],
color = "") +
scale_color_manual(values = treatment_colours_paper) +
scale_linetype_manual(values = treatment_linetype_paper) +
geom_vline(xintercept = resource_flow_days,
linetype = resource_flow_line_type,
color = resource_flow_line_colour,
linewidth = resource_flow_line_width) +
theme_bw() +
theme(panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = legend_position,
legend.key.width = unit(legend_width_cm, "cm")) +
guides(color = guide_legend(title = NULL,
nrow = 2),
linetype = guide_legend(title = NULL,
nrow = 2)) +
theme(plot.margin = unit(c(ggarrange_margin_left,
ggarrange_margin_right,
ggarrange_margin_bottom,
ggarrange_margin_left),
"cm")) +
geom_rect(xmin = grey_background_xmin,
xmax = grey_background_xmax,
ymin = grey_background_ymin,
ymax = grey_background_ymax,
fill = grey_background_fill,
alpha = grey_background_alpha,
color = grey_background_color)
}
# Combine plots of alpha, beta, gamma biodiversity and biomass.
p_combined = ggarrange(plot.single.plot("mean_shannon") +
rremove("xlab") +
theme(axis.text.x = element_blank(),
axis.ticks.x = element_blank()) +
font("legend.text", size = paper_labels_size) +
font("ylab", size = paper_labels_size),
plot.single.plot("bray_curtis") +
rremove("xlab") +
theme(axis.text.x = element_blank(),
axis.ticks.x = element_blank()) +
font("legend.text",
size = paper_labels_size) +
font("ylab",
size = paper_labels_size),
plot.single.plot("metaecosystem_richness") +
rremove("xlab") +
theme(axis.text.x = element_blank(),
axis.ticks.x = element_blank()) +
font("legend.text",
size = paper_labels_size) +
font("ylab",
size = paper_labels_size),
plot.single.plot("total_metaecosystem_bioarea_mm2") +
font("legend.text",
size = paper_labels_size) +
font("xlab",
size = paper_labels_size) +
font("ylab",
size = paper_labels_size) +
scale_x_continuous(breaks = unique(data_for_plotting$day)),
heights = c(0.8, 0.8, 0.8, 1),
nrow = 4,
common.legend = TRUE,
align = "v",
labels = c("(a)", "(b)", "(c)", "(d)"),
label.x = 0.1,
label.y = 0.8) %>%
print()
# --- PREPARE DATA FOR PLOTTING --- #
# Define parameters
ecosystem_type_selected = c("Small connected to large",
"Small connected to small",
"Small unconnected",
"Large connected to small",
"Large connected to large",
"Large unconnected")
# Filter data
data_for_plotting = ds_ecosystems %>%
filter(ecosystem_type %in% ecosystem_type_selected,
disturbance == disturbance_selected)
# --- CONSTRUCT FUNCTION TO PLOT BIOMASS/SHANNON OF SMALL AND LARGE ECOSYSTEMS --- #
plot.single.plot = function(response_variable_selected){
data_for_plotting %>%
filter(!is.na(!!sym(response_variable_selected))) %>%
summarySE(measurevar = response_variable_selected,
groupvars = c("day", "time_point", "ecosystem_type", "ecosystem_size", "connection")) %>%
ggplot(aes(x = day,
y = get(response_variable_selected),
group = interaction(day, ecosystem_type),
color = ecosystem_type,
linetype = ecosystem_type)) +
geom_point(stat = "summary",
fun = "mean",
position = position_dodge(dodging),
size = treatment_points_size) +
geom_line(stat = "summary",
fun = "mean",
aes(group = ecosystem_type),
position = position_dodge(dodging),
linewidth = treatment_lines_linewidth) +
geom_errorbar(aes(ymax = get(response_variable_selected) + ci,
ymin = get(response_variable_selected) - ci),
width = width_errorbar,
position = position_dodge(dodging)) +
labs(x = axis_names$axis_name[axis_names$variable == "day"],
y = axis_names$axis_name[axis_names$variable == response_variable_selected],
color = "") +
scale_color_manual(values = c("#993404",
"#993404",
"#993404",
"#3182bd",
"#3182bd",
"#3182bd"),
label = expression(S[L],
S[S],
S,
L[S],
L[L],
L)) +
scale_linetype_manual(values = c("solid",
"dashed",
"dotted",
"solid",
"dashed",
"dotted"),
label = expression(S[L],
S[S],
S,
L[S],
L[L],
L)) +
geom_vline(xintercept = resource_flow_days,
linetype = resource_flow_line_type,
color = resource_flow_line_colour,
linewidth = resource_flow_line_width) +
geom_hline(yintercept = 0,
color = zero_line_colour,
linetype = zero_line_line_type,
linewidth = zero_line_line_width) +
theme_bw() +
theme(panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = legend_position,
legend.key.width = unit(legend_width_cm, "cm")) +
guides(color = guide_legend(title = NULL,
nrow = 3),
linetype = guide_legend(title = NULL,
nrow = 3)) +
geom_rect(xmin = grey_background_xmin,
xmax = grey_background_xmax,
ymin = grey_background_ymin,
ymax = grey_background_ymax,
fill = grey_background_fill,
alpha = grey_background_alpha,
color = grey_background_color)
}
# --- COMBINE PLOTS OF SHANNON AND BIOMASS --- #
p_combined = ggarrange(plot.single.plot("shannon") +
rremove("xlab") +
theme(axis.text.x = element_blank(),
axis.ticks.x = element_blank()) +
font("legend.text",
size = paper_labels_size) +
font("ylab",
size = paper_labels_size),
plot.single.plot("bioarea_mm2_per_ml") +
font("legend.text",
size = paper_labels_size) +
font("xlab",
size = paper_labels_size) +
font("ylab",
size = paper_labels_size) +
scale_x_continuous(breaks = unique(data_for_plotting$day)),
heights = c(0.8, 0.8, 1),
nrow = 2,
align = "v",
labels = c("(a)", "(b)"),
label.x = 0.1,
label.y = 0.8,
common.legend = TRUE) %>%
print()
# --- PREPARE DATA FOR PLOTTING --- #
# Define parameters
ecosystem_type_selected = c("Medium connected to medium",
"Medium unconnected")
# Filter data
data_for_plotting = ds_ecosystems %>%
filter(ecosystem_type %in% ecosystem_type_selected,
disturbance == disturbance_selected,
!is.na(!!sym(response_variable_selected)))
# --- CONSTRUCT FUNCTION TO PLOT BIOMASS/SHANNON OF MEDIUM ECOSYSTEMS --- #
plot.single.plot = function(response_variable_selected){
data_for_plotting %>%
summarySE(measurevar = response_variable_selected,
groupvars = c("day", "time_point", "ecosystem_type", "ecosystem_size", "connection")) %>%
ggplot(aes(x = day,
y = get(response_variable_selected),
group = interaction(day, ecosystem_type),
color = ecosystem_type,
linetype = ecosystem_type)) +
geom_point(stat = "summary",
fun = "mean",
position = position_dodge(dodging),
size = treatment_points_size) +
geom_line(stat = "summary",
fun = "mean",
aes(group = ecosystem_type),
position = position_dodge(dodging),
linewidth = treatment_lines_linewidth) +
geom_errorbar(aes(ymax = get(response_variable_selected) + ci,
ymin = get(response_variable_selected) - ci),
width = width_errorbar,
position = position_dodge(dodging)) +
labs(x = axis_names$axis_name[axis_names$variable == "day"],
y = axis_names$axis_name[axis_names$variable == response_variable_selected],
color = "") +
scale_color_manual(values = c("#d95f0e",
"#d95f0e"),
label = expression(M[M],
M)) +
scale_linetype_manual(values = c("dashed",
"dotted"),
label = expression(M[M],
M)) +
geom_vline(xintercept = resource_flow_days,
linetype = resource_flow_line_type,
color = resource_flow_line_colour,
linewidth = resource_flow_line_width) +
geom_hline(yintercept = 0,
color = zero_line_colour,
linetype = zero_line_line_type,
linewidth = zero_line_line_width) +
theme_bw() +
theme(panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = legend_position,
legend.key.width = unit(legend_width_cm, "cm")) +
guides(color = guide_legend(title = NULL,
nrow = 3),
linetype = guide_legend(title = NULL,
nrow = 3)) +
geom_rect(xmin = grey_background_xmin,
xmax = grey_background_xmax,
ymin = grey_background_ymin,
ymax = grey_background_ymax,
fill = grey_background_fill,
alpha = grey_background_alpha,
color = grey_background_color)
}
# --- COMBINE PLOTS OF SHANNON AND BIOMASS --- #
p_combined = ggarrange(plot.single.plot("shannon") +
rremove("xlab") +
theme(axis.text.x = element_blank(),
axis.ticks.x = element_blank()) +
font("legend.text",
size = paper_labels_size) +
font("ylab",
size = paper_labels_size),
plot.single.plot("bioarea_mm2_per_ml") +
font("legend.text",
size = paper_labels_size) +
font("xlab",
size = paper_labels_size) +
font("ylab",
size = paper_labels_size) +
scale_x_continuous(breaks = unique(data_for_plotting$day)),
heights = c(0.8, 0.8, 1),
nrow = 2,
align = "v",
labels = c("(a)", "(b)"),
label.x = 0.1,
label.y = 0.8,
common.legend = TRUE) %>%
print()
# --- DEFINE RESPONSE VARIABLE YOU WANT TO PLOT --- #
response_variable = "photo_hetero_ratio"
# --- PREPARE DATA FOR PLOTTING --- #
# Define parameters
ecosystem_type_selected = c("S",
"M",
"L")
# Manipulate data
data_for_plotting = ds_ecosystems %>%
mutate(ecosystem_type = case_when(ecosystem_type == "Small unconnected" ~ "S",
ecosystem_type == "Medium unconnected" ~ "M",
ecosystem_type == "Large unconnected" ~ "L")) %>%
filter(ecosystem_type %in% ecosystem_type_selected,
disturbance == disturbance_selected,
!is.na(!!sym(response_variable)))
# --- CONSTRUCT PLOT --- #
p = data_for_plotting %>%
# Manipulate
summarySE(measurevar = response_variable,
groupvars = c("day", "ecosystem_type", "ecosystem_size", "connection")) %>%
# Create plot
ggplot(aes(x = day,
y = get(response_variable),
group = interaction(day, ecosystem_type),
color = ecosystem_type)) +
# Points
geom_point(stat = "summary",
fun = "mean",
position = position_dodge(dodging),
size = treatment_points_size) +
geom_errorbar(aes(ymax = get(response_variable) + ci,
ymin = get(response_variable) - ci),
width = width_errorbar,
position = position_dodge(dodging)) +
# Lines
geom_line(stat = "summary",
fun = "mean",
aes(group = ecosystem_type),
position = position_dodge(dodging),
linewidth = treatment_lines_linewidth) +
# Axes and legend
labs(x = axis_names$axis_name[axis_names$variable == "day"],
y = axis_names$axis_name[axis_names$variable == response_variable],
color = "") +
scale_x_continuous(breaks = unique(data_for_plotting$day)) +
guides(color = guide_legend(title = NULL,
nrow = 1),
linetype = guide_legend(title = NULL,
nrow = 1)) +
scale_color_manual(values = c("#000000",
"#737373",
"#bdbdbd")) +
# Extra graphic elements
theme_bw() +
theme(panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = legend_position,
legend.key.width = unit(legend_width_cm, "cm"),
axis.title.x = element_text(size = paper_labels_size),
axis.title.y = element_text(size = paper_labels_size),
legend.text = element_text(size = paper_labels_size)) +
geom_rect(xmin = grey_background_xmin,
xmax = grey_background_xmax,
ymin = grey_background_ymin,
ymax = grey_background_ymax,
fill = grey_background_fill,
alpha = grey_background_alpha,
color = grey_background_color) +
geom_hline(yintercept = 0,
color = zero_line_colour,
linetype = zero_line_line_type,
linewidth = zero_line_line_width) +
geom_vline(xintercept = resource_flow_days,
linetype = resource_flow_line_type,
color = resource_flow_line_colour,
linewidth = resource_flow_line_width)
p
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
# --- DEFINE PLOTTING PARAMETERS --- #
legend_row_n_input = 2
size_y_axis = 22
x_min = -0.2
x_max = 30
y_min = -0.8
y_max = 3
# --- PREPARE DATA FOR PLOTTING --- #
# Define parameters
ecosystem_type_all = c("Small connected to large",
"Small unconnected",
"Small connected to small",
"Large connected to small",
"Large unconnected",
"Large connected to large")
response_variable_selected = "shannon"
# Filter data
data_for_plotting = ds_ecosystems %>%
filter(ecosystem_type %in% ecosystem_type_all,
disturbance == disturbance_selected)
# --- CONSTRUCT PLOTS --- #
# Define parameters
plots = NULL
# Construct plots
plots[[1]] = plot.ecosystems.empty.presentations(y_min_alpha,
y_max_alpha,
"shannon")
for (i in 1:length(ecosystem_type_all)+1) {
plots[[i+1]] = plot.ecosystems.points.presentations(data = data_for_plotting,
ecosystem_type_selected = ecosystem_type_all[1:i],
response_variable_selected) +
theme(plot.margin = unit(c(ggarrange_margin_left,
ggarrange_margin_right,
ggarrange_margin_bottom,
ggarrange_margin_left),
"cm"),
legend.position = "none") +
scale_y_continuous(labels = scales::number_format(accuracy = 0.01)) +
xlim(x_min, x_max) +
ylim(y_min, y_max)
}
# --- COMBINE PLOTS --- #
# Define parameters
p_combined = NULL
p_combined[[1]] = plots[[1]]
# Combine plots
for(i in 1:length(ecosystem_type_all)+1){
p_combined[[i]] = ggarrange(plots[[i]] +
theme(axis.text = element_text(size = presentation_axes_size)) +
font("legend.text", size = size_legend) +
font("xlab", size = size_y_axis) +
font("ylab", size = size_y_axis),
nrow = 1,
align = "v",
label.x = 0.1,
label.y = 0.8)
}
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's colour values.
## Warning: No shared levels found between `names(values)` of the manual scale and the
## data's linetype values.
## Warning: Removed 1 row containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 1 row containing missing values or values outside the scale range
## (`geom_line()`).
# --- SAVE COMBINED PLOTS --- #
for(i in 1:length(ecosystem_type_all)+1){
png(file = here("..",
"3_results",
"figures",
disturbance_selected,
"presentations",
paste0("ecosystems_connected_diversity_", i, ".png")),
width = presentation_figure_width,
height = presentation_figure_height,
units = presentation_figure_units,
res = presentation_figure_res)
print(p_combined[[i]])
dev.off()
}
sessionInfo()
## R version 4.4.1 (2024-06-14)
## Platform: aarch64-apple-darwin20
## Running under: macOS Sonoma 14.2.1
##
## Matrix products: default
## BLAS: /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/lib/libRblas.0.dylib
## LAPACK: /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/lib/libRlapack.dylib; LAPACK version 3.12.0
##
## locale:
## [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
##
## time zone: Europe/Zurich
## tzcode source: internal
##
## attached base packages:
## [1] stats graphics grDevices utils datasets methods base
##
## other attached packages:
## [1] conflicted_1.2.0 optimx_2023-10.21 broom.mixed_0.2.9.6
## [4] emmeans_1.10.5 combinat_0.0-8 Rmisc_1.5.1
## [7] betapart_1.6 vegan_2.6-8 lattice_0.22-6
## [10] permute_0.9-7 glmmTMB_1.1.10 lmerTest_3.1-3
## [13] lme4_1.1-35.5 Matrix_1.7-0 DHARMa_0.4.7
## [16] GGally_2.2.1 gridExtra_2.3 plotly_4.10.4
## [19] ggpubr_0.6.0 lubridate_1.9.3 forcats_1.0.0
## [22] stringr_1.5.1 dplyr_1.1.4 purrr_1.0.2
## [25] readr_2.1.5 tidyr_1.3.1 tibble_3.2.1
## [28] ggplot2_3.5.1 tidyverse_2.0.0 plyr_1.8.9
## [31] renv_1.0.11 testthat_3.2.1.1 here_1.0.1
##
## loaded via a namespace (and not attached):
## [1] RColorBrewer_1.1-3 rstudioapi_0.17.1 jsonlite_1.8.9
## [4] magrittr_2.0.3 estimability_1.5.1 farver_2.1.2
## [7] nloptr_2.1.1 rmarkdown_2.28 vctrs_0.6.5
## [10] memoise_2.0.1 minqa_1.2.8 rstatix_0.7.2
## [13] htmltools_0.5.8.1 itertools_0.1-3 broom_1.0.7
## [16] Formula_1.2-5 pracma_2.4.4 sass_0.4.9
## [19] parallelly_1.38.0 bslib_0.8.0 desc_1.4.3
## [22] htmlwidgets_1.6.4 cachem_1.1.0 TMB_1.9.15
## [25] mime_0.12 lifecycle_1.0.4 minpack.lm_1.2-4
## [28] iterators_1.0.14 pkgconfig_2.0.3 gap_1.6
## [31] R6_2.5.1 fastmap_1.2.0 shiny_1.9.1
## [34] rbibutils_2.3 future_1.34.0 magic_1.6-1
## [37] digest_0.6.37 numDeriv_2016.8-1.1 colorspace_2.1-1
## [40] furrr_0.3.1 rprojroot_2.0.4 pkgload_1.4.0
## [43] qgam_1.3.4 labeling_0.4.3 fansi_1.0.6
## [46] timechange_0.3.0 httr_1.4.7 abind_1.4-8
## [49] mgcv_1.9-1 compiler_4.4.1 doParallel_1.0.17
## [52] withr_3.0.2 backports_1.5.0 carData_3.0-5
## [55] ggstats_0.7.0 highr_0.11 ggsignif_0.6.4
## [58] MASS_7.3-60.2 tools_4.4.1 ape_5.8
## [61] httpuv_1.6.15 glue_1.8.0 rcdd_1.6
## [64] promises_1.3.0 nlme_3.1-164 grid_4.4.1
## [67] cluster_2.1.6 generics_0.1.3 snow_0.4-4
## [70] gtable_0.3.6 tzdb_0.4.0 data.table_1.16.2
## [73] hms_1.1.3 car_3.1-3 utf8_1.2.4
## [76] foreach_1.5.2 pillar_1.9.0 later_1.3.2
## [79] splines_4.4.1 tidyselect_1.2.1 knitr_1.48
## [82] reformulas_0.3.0 xfun_0.49 brio_1.1.5
## [85] stringi_1.8.4 lazyeval_0.2.2 yaml_2.3.10
## [88] boot_1.3-30 evaluate_1.0.1 codetools_0.2-20
## [91] cli_3.6.3 xtable_1.8-4 geometry_0.5.0
## [94] Rdpack_2.6.1 munsell_0.5.1 jquerylib_0.1.4
## [97] Rcpp_1.0.13 doSNOW_1.0.20 globals_0.16.3
## [100] coda_0.19-4.1 parallel_4.4.1 picante_1.8.2
## [103] gap.datasets_0.0.6 listenv_0.9.1 viridisLite_0.4.2
## [106] mvtnorm_1.3-1 scales_1.3.0 rlang_1.1.4
## [109] cowplot_1.1.3 fastmatch_1.1-4
## Time difference of 20.8 mins
If you want to change a certain part of the code using the following code in Unix:
#Rmd script
cd /Users/Ema/Documents/Github/PatchSize/3_r_files
sed -i '' 's/old_string/new_string/g' *.Rmd
#R script
cd /Users/ema/Documents/GitHub/PatchSize/3_r_files/functions
sed -i '' 's/old_string/new_string/g' *.R