Chapter 1 Introduction
“Mathematics is the languange in which God has written the Universe”
— Galileo Galilei
Scientists major challenge is to create a logical line of inference extending from what we know about a system in light of our observations and create new insight tempered by some uncertainty. Using the scientific method, mathematical modeling and statistics have gone to great lengths to establish this domain of truth, resulting in the dramatic leaps forward in scientific knowledge and the with the availability of statistical software has pioneered a scientific revolution in technological progress.

Figure 1.1: The scientific method is the cornerstone of scientific research, and when paired with mathematics and modern statistical methods, has revolutionized the rate of discovery.
However, the same structures that have afforded remarkable scientific progress are also inherently limiting. Many common statistical methodologies are designed around bespoke experimental designs, assumptions of data type and distributions, and are sensitive to the number of observations taken using various sampling methods (Wasserstein and Lazar 2016; Johnson 2016), and generated some concern regarding the reliability of published research findings (Ioannidis 2005), with alternatives to null hypothesis testing yielding marginal success, with many statisticians pleas to correctly utilize the p-value falling on researchers deaf ears (Matthews 2021). Perhaps more importantly, there is an ever decreasing suite of novel questions which may be asked by a single investigator, even if they are particularly advanced and talented. This problem becomes even more intimidating for young investigators. The ability to write new and unique models using the creativity of inter-disciplinary teams increases the depth and breadth of available questions (Hobbs and Hooten 2015).
Additional training should increase comfort with functional modeling and a deeper perspective of natural stochastic and modeling probability in complex ecological systems. The overarching goal of this class is to both increase scientists comfort with writing mathematical process models which describe their system, and basic statistical principles needed to describe the probability inherent to their system. There are many technical aspects surrounding this methodology, and my belief is that no matter whether you consider yourself a Frequentist, Bayesian, or Pragmatic statistitian, that their is tremendous value in pursuing deeper intelectual knowledge of system stoichasticiy and probability which will inevitably increase the intellectual satisfaction we take from our work.
1.1 Install Jags
Before installing rjags, we have to install Jags for it to interface with. Refer to mcmc-jags.sourceforge.io and download the appropriate files for your machine type and install.
1.2 Install these packages
# Libraries to install
# List of packages to check/install
packages <- c("data.table", "tidyverse", "rjags", "MCMCvis", "ggExtra")
# Function to check and install packages
install_if_missing = function(pkg) {
if (!require(pkg, character.only = TRUE)) {
install.packages(pkg, dependencies = TRUE)
library(pkg, character.only = TRUE)
} else {
cat(paste("Package", pkg, "is already installed.\n"))
}
}
# Apply the function to each package in the list
lapply(packages, install_if_missing)
## Loading required package: data.table
## data.table 1.17.4 using 8 threads (see ?getDTthreads). Latest news: r-datatable.com
## Package data.table is already installed.
## Loading required package: tidyverse
## ── Attaching core tidyverse packages ─────────────────────────────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.4 ✔ readr 2.1.5
## ✔ forcats 1.0.0 ✔ stringr 1.5.1
## ✔ ggplot2 3.5.2 ✔ tibble 3.2.1
## ✔ lubridate 1.9.4 ✔ tidyr 1.3.1
## ✔ purrr 1.0.4 ── Conflicts ───────────────────────────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::between() masks data.table::between()
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::first() masks data.table::first()
## ✖ lubridate::hour() masks data.table::hour()
## ✖ lubridate::isoweek() masks data.table::isoweek()
## ✖ dplyr::lag() masks stats::lag()
## ✖ dplyr::last() masks data.table::last()
## ✖ lubridate::mday() masks data.table::mday()
## ✖ lubridate::minute() masks data.table::minute()
## ✖ lubridate::month() masks data.table::month()
## ✖ lubridate::quarter() masks data.table::quarter()
## ✖ lubridate::second() masks data.table::second()
## ✖ purrr::transpose() masks data.table::transpose()
## ✖ lubridate::wday() masks data.table::wday()
## ✖ lubridate::week() masks data.table::week()
## ✖ lubridate::yday() masks data.table::yday()
## ✖ lubridate::year() masks data.table::year()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
## Package tidyverse is already installed.
## Loading required package: rjags
## Loading required package: coda
## Linked to JAGS 4.3.2
## Loaded modules: basemod,bugs
## Package rjags is already installed.
## Loading required package: MCMCvis
## Package MCMCvis is already installed.
## Loading required package: ggExtra
## Package ggExtra is already installed.
## [[1]]
## NULL
##
## [[2]]
## NULL
##
## [[3]]
## NULL
##
## [[4]]
## NULL
##
## [[5]]
## NULL