psRisk-methods: Methods: Pedersen-Satchell Family of Risk Measures

Description Usage Arguments Value Note Examples

Description

Function implementing the Pedersen and Satchell risk measure which captures a wide variety of the most popular financial risk measures.

Usage

1
psRisk(A, b, a ,h, W, distribution, subdivisions=100000, ...)

Arguments

A

The upper bound for integration.

b

The theshold value.

a

The moment power value.

h

The outer moment power value (usually a standardizing value such that h=1/a)

W

An additional function passed to the risk measure during the integration (usually the cdf function).

distribution

The distribution name.

subdivisions

(Optional) parameter passed to the integration function.

...

The additional distribution fit parameters passed to the integration function.

Value

An object of class PSRISK

Note

The risk measure is defined as:

R[A,b,a,θ ,W(.)] = [\int_{ - ∞ }^A {| {x - b}|^a W(.)f(x)dx]^θ}


See the paper for more details. The example help in explaining its use.

Examples

 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
## Not run: 
# psRisk Extensive Examples:
# We use both a fictional and a real series
library(RBestFit)
data(djiaret)
x=as.numeric(djiaret[,2])
fit<-fitghypuv(x)
xnorm=rnorm(10000,mean=0,sd=1)

# Standard Deviation
psr.ghyp.sd<-psRisk(A=Inf, b=fit@mu, a=2 ,h=0.5, distribution="ghypuv", fit=fit)
psr.norm.sd<-psRisk(A=Inf, b=0, a=2 ,h=0.5, distribution="norm", mean=0,sd=1)

# Variance
psr.ghyp.var<-psRisk(A=Inf, b=fit@mu, a=2 ,h=1, distribution="ghypuv", fit=fit)
psr.norm.var<-psRisk(A=Inf, b=0, a=2 ,h=1, distribution="norm", mean=0,sd=1)

# Semistandard deviation:
psr.ssd<-psRisk(A=fit@mu, b=fit@mu, a=2 ,h=0.5, distribution="ghypuv", fit=fit)
psr.norm.ssd<-psRisk(A=0, b=0, a=2 ,h=0.5, distribution="norm", mean=0,sd=1)

# Semi-Variance
psr.ghyp.svar<-psRisk(A=fit@mu, b=fit@mu, a=2 ,h=1, distribution="ghypuv", fit=fit)
psr.norm.svar<-psRisk(A=0, b=0, a=2 ,h=1, distribution="norm", mean=0,sd=1)
# Mean absolute deviation
psr.ghyp.mad<-psRisk( A=Inf, b=fit@mu, a=1 ,h=1, distribution="ghypuv", fit=fit)
psr.norm.mad<-psRisk(A=Inf, b=0, a=1 ,h=1, distribution="norm", mean=0,sd=1)

# Kijima and Ohshini<92>s first measure, with a varying a (here we test for a=2/3)
psr.ghyp.ko1<-psRisk( A=Inf, b=fit@mu, a=2/3 ,h=3/2, distribution="ghypuv", fit=fit)
psr.norm.ko1<-psRisk(A=Inf, b=0, a=2/3 ,h=3/2, distribution="norm", mean=0,sd=1)


# Lower Partial Moments in General (Alpha=b=threshold, a=moment h=1/a(standardization))
# here we test with a threshold=0 and moment=1 and cross check with pmExpectations:
# Test ghyp
psr.ghyp.lpm1<-psRisk(A=0, b=0, a=1 ,h=1, distribution="ghypuv", fit=fit)
lpm1.ghyp<-pmExpectation(f="ghypuv", method="analytical", fit=list(fit), threshold=0, 
		moment=1, type="lower", standardize=TRUE, data.names = "X")

# Test N(0,1)
psr.norm.lpm1<-psRisk(A=0, b=0, a=1 ,h=1, distribution="norm", mean=0,sd=1)
# we quickly make a wrapper for dnorm to conform to requirements of pmExpectation function of taking
# a single fit argument
dNorm<-function(x,fit){dnorm(x, mean=fit[1],sd=fit[2])}
lpm1.norm<-pmExpectation(f="Norm", method="analytical", fit=list(fit=c(0,1)), threshold=0, 
		moment=1, type="lower", standardize=TRUE, data.names = "X")


# Now we make use of W in the specification which is a weighting function
# Probability Weighted Momentes PWM:
# NB: can cross check with lmomco sample estimation where r = (nmom+1) in lmomco's pwm notation
gf=function(x,mean,sd) x*(pnorm(x,mean,sd)^5)*(1-pnorm(x,mean,sd))^0
psr.norm.pwm<-psRisk(A=Inf, b=0, a=0 ,h=1, W=gf, distribution="norm", mean=0, sd=1)
psr.norm.pwm
#library(lmomco)
#pwm(rnorm(10000,0,1),nmom=6,sort=TRUE)$betas[6]

# Some Interesting Financial Measures Arrived at Through Lower Partial Moments:
# CVaR, alpha=0.01
# first we create an artificial dataset:
mean=0.03
sd=0.15
x=rnorm(10000,0.03,0.15)
# to find the 1
VaR = qnorm(0.01,0.03,0.15)
# we subtract since psRisk will always return positive number (abs)
CVaR=VaR - psRisk(A=VaR, b=VaR, a=1 ,h=1, distribution="norm", mean=0.03, sd=0.15)@riskMeasure/0.01

# Expected Shortfall Probability (MAR=0)
MAR=0
esfall<-psRisk(A=MAR, b=MAR, a=0 ,h=1, distribution="norm", mean=0.03, sd=0.15)

# Average Underperformance
avunder<-psRisk(A=MAR, b=MAR, a=1 ,h=1, distribution="norm", mean=0.03, sd=0.15)

# ShortFall Variance 
svar<-psRisk(A=MAR, b=MAR, a=2 ,h=1, distribution="norm", mean=0.03, sd=0.15)

# ShortFall standard deviation 
ssd<-psRisk(A=MAR, b=MAR, a=2 ,h=1, distribution="norm", mean=0.03, sd=0.15)@riskMeasure^(1/2)

# Average Conditional Loss:
AcondLoss  = avunder@riskMeasure/esfall@riskMeasure

## End(Not run)

pmoments documentation built on May 2, 2019, 4:42 p.m.