forked from awdesch/20150801-quantnet-MSM
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MSMpdfasymetric.R
42 lines (37 loc) · 1.82 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
# ------------------------------------------------------------------------------
# Course: MSM - Selected Topics of Mathematical Statistics
# ------------------------------------------------------------------------------
# Quantlet: MSMpdfasymetric
# ------------------------------------------------------------------------------
# Description: plot left and right skewed normal distributions
# ------------------------------------------------------------------------------
# Usage:
# ------------------------------------------------------------------------------
# Inputs:
# ------------------------------------------------------------------------------
# Output:
# ------------------------------------------------------------------------------
# Keywords: skewed normal distribution
# ------------------------------------------------------------------------------
# See also:
# ------------------------------------------------------------------------------
# Author: Xiu Xu 20150603
# ------------------------------------------------------------------------------
graphics.off()
rm(list=ls()) #remove variable definitions
library(sn)
getwd()
setwd("")
name=paste("Fig_MSMpdfasymmetric",".pdf",sep="")
pdf(name)
par(mfrow=c(2,4))
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(x, 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(x, 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(x, xi=0, omega=1, alpha=5)))
dev.off()