forked from awdesch/20150801-quantnet-MSM
-
Notifications
You must be signed in to change notification settings - Fork 1
/
MSMpdfasymetric.R
48 lines (42 loc) · 2.23 KB
/
MSMpdfasymetric.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# ------------------------------------------------------------------------------
# Course: MSM - Selected Topics of Mathematical Statistics
# ------------------------------------------------------------------------------
# Quantlet: MSMpdfasymetric
# ------------------------------------------------------------------------------
# Description: Plots of left skewed normal distribution (shape parameter
# alpha = - 5), symmetric normal and right skewed normal
# distribution (shape parameter alpha = 5).
# ------------------------------------------------------------------------------
# Inputs:
# ------------------------------------------------------------------------------
# Output:
# ------------------------------------------------------------------------------
# Keywords: simulation, pdf, plot, normal, standard, normal-distribution,
# distribution
# ------------------------------------------------------------------------------
# See also: MSMpdfmultinormal, MSMpdfmultinormal, MSMpdfasymmetric,
# MSMpdfasymmetric, MSMasprob, SFEbinomv, SFEBinomial
# ------------------------------------------------------------------------------
# Author: Xiu Xu 20150603
# ------------------------------------------------------------------------------
graphics.off()
rm(list=ls())
# install and load packages
libraries = c("sn")
lapply(libraries, function(x) if (!(x %in% installed.packages())) {
install.packages(x)
})
lapply(libraries, library, quietly = TRUE, character.only = TRUE)
par(mfrow = c(1, 3))
x1 = seq(-3, 1, 0.001)
x2 = seq(-2, 2, 0.001)
x3 = seq(-1, 3, 0.001)
plot(x1, dsn(x1, xi = 0, omega = 1, alpha = -5, log = FALSE), type = "l",
lwd = 2.5, ylab = "PDF", xlab = "X", col = "chocolate3", ylim = c(0, 0.9))
abline(v = median(rsn(x1, xi = 0, omega = 1, alpha = -5)))
plot(x2, dsn(x2, xi = 0, omega = 0.55, alpha = 0, log = FALSE), type = "l",
lwd = 2.5, ylab = "", xlab = "X", col = "chartreuse4", ylim = c(0, 0.9))
abline(v = median(rsn(x2, xi = 0, omega = 0.55, alpha = 0)))
plot(x3, dsn(x3, xi = 0, omega = 1, alpha = 5, log = FALSE), type = "l",
lwd = 2.5, ylab = "", xlab = "X", col = "blue3", ylim = c(0, 0.9))
abline(v = median(rsn(x3, xi = 0, omega = 1, alpha = 5)))