esgplotshocks: Visualize the dependence between Gaussian shocks

View source: R/plots.R

esgplotshocksR Documentation

Visualize the dependence between Gaussian shocks

Description

Creates a scatter plot with marginal density plots to visualize the relationship between two sets of Gaussian shocks.

Usage

esgplotshocks(x, y = NULL)

Arguments

x

A matrix or list containing two columns of Gaussian shocks

y

Optional second matrix or list of Gaussian shocks to compare with x

Details

The function creates a scatter plot of the shocks with marginal density plots on the top and right sides. If y is provided, both sets of shocks are plotted with different colors (blue for x, red for y). The marginal density plots show the distribution of shocks along each dimension.

Value

A ggplot2 object containing the scatter plot with marginal densities

Examples

# Generate sample Gaussian shocks
x <- matrix(rnorm(1000), 500, 2)

# Plot single set of shocks
esgplotshocks(x)

# Plot two sets of shocks for comparison
y <- matrix(rnorm(1000), 500, 2)
esgplotshocks(x, y)


Techtonique/ESGtoolkit documentation built on June 11, 2025, 6:24 p.m.