esgplotshocks | R Documentation |
Creates a scatter plot with marginal density plots to visualize the relationship between two sets of Gaussian shocks.
esgplotshocks(x, y = NULL)
x |
A matrix or list containing two columns of Gaussian shocks |
y |
Optional second matrix or list of Gaussian shocks to compare with x |
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.
A ggplot2 object containing the scatter plot with marginal densities
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.