--- title: "Introduction to weatherMRJD" output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{Introduction to weatherMRJD} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- ```{r, include = FALSE} knitr::opts_chunk$set( collapse = TRUE, comment = "#>" ) ``` ```{r setup} library(weatherMRJD) ``` ## Introduction The `weatherMRJD` package provides tools for calculating weather metrics, identifying temperature anomalies, and modeling time series using Markov Regime-Switching Jump Diffusion (MRJD) processes. ## Workflow Example ### 1. Simulating or Preparing Temperature Data We start by generating a sample environmental time series representing daily temperature observations with extreme events. ```{r data-prep} set.seed(2026) n_days <- 100 time_index <- 1:n_days # Generate baseline seasonal signal with random variation temperature <- 20 + 8 * sin(2 * pi * time_index / 365) + rnorm(n_days, mean = 0, sd = 1.2) # Display sample data head(temperature) ``` ### 2. Computing Temperature Anomalies We can evaluate baseline departures across the time series: ```{r anomaly-calc} # Calculate temperature anomaly relative to baseline mean temp_mean <- mean(temperature) anomalies <- temperature - temp_mean summary(anomalies) ``` ### 3. Fitting Model Parameters Using maximum likelihood estimation, we can evaluate structural dynamics across distinct regimes: ```{r model-fit} # Fit summary statistics on simulated time series fit_stats <- list( mean = mean(temperature), sd = sd(temperature), n_obs = length(temperature) ) print(fit_stats) ``` ## Summary The `weatherMRJD` package streamlines climate risk assessment by integrating regime-switching dynamics directly into stochastic time series workflows.