How can we create skewed normal distribution curve in R ?
My aim is to produce skewed normal distribution to represent accounting CVA (expcted losses) and regulatory CVA (99% quantile). I want to have these in a same figure and shaded
These are the codes that I have used, to produce the figure. However, when i introduce shade function, the skew despair.
Can anyone please help
library(sn)
X <- seq(-1, 2, 0.01)
plot(X, dsn(X, xi = 0.1, omega = 0.3, alpha = 5), type = "l")
abline(v = 0.2)
shadenorm()
shadenorm(below=1, justbelow = TRUE, color = 'blue')
I would also like to label axis, y labelled as probability while x labelled exposure.
I know that there is similar post [quote="AbhishekHP, post:1, topic:39115, full:true"]
How can we create skewed normal distribution curve in R ?
How to vary the skewedness using a variable ?
i.e. height of the peak and tail of the plot ?
Although many links say that they have an answer but non worked
This is in addition to earlier question:
How to calculate the cumulative area of the overlapped normal distribution curve in R ? solved by @Yarnabrina
# Tried
library(fGarch)
library(tidyverse)
N <- 10000
x <- rnbinom(N, 10, .5)
dsnorm(x, mean = 0, sd = 1, xi = 1.5, log = FALSE)
# psnorm(x, mean = 0, sd = 1, xi = 1.5) %>% plot()
# qsnorm(x, mean = 0, sd = 1, xi = 1.5) %>% plot()
# rsnorm(x, mean = 0, sd = 1, xi = 1.5) %>% plot()
plot(dsnorm(x, mean = 0, sd = 1, xi = 1.5, log = FALSE))
[/quote]
but it does not answer my question