pco_sropt: The 'confidence distribution' for maximal Sharpe ratio.

Description Usage Arguments Details Value Note Author(s) See Also Examples

View source: R/distributions.r

Description

Distribution function and quantile function for the 'confidence distribution' of the maximal Sharpe ratio. This is just an inversion to perform inference on zeta* given observed statistic z*.

Usage

1
2
3
pco_sropt(q,df1,df2,z.s,ope,lower.tail=TRUE,log.p=FALSE) 

qco_sropt(p,df1,df2,z.s,ope,lower.tail=TRUE,log.p=FALSE,lb=0,ub=Inf)

Arguments

q

vector of quantiles.

df1

the number of assets in the portfolio.

df2

the number of observations.

z.s

an observed Sharpe ratio statistic, annualized.

ope

the number of observations per 'epoch'. For convenience of interpretation, The Sharpe ratio is typically quoted in 'annualized' units for some epoch, that is, 'per square root epoch', though returns are observed at a frequency of ope per epoch. The default value is 1, meaning the code will not attempt to guess what the observation frequency is, and no annualization adjustments will be made.

lower.tail

logical; if TRUE (default), probabilities are P[X <= x], otherwise, P[X > x].

log.p

logical; if TRUE, probabilities p are given as log(p).

p

vector of probabilities.

lb

the lower bound for the output of qco_sropt.

ub

the upper bound for the output of qco_sropt.

Details

Suppose z* follows a Maximal Sharpe ratio distribution (see SharpeR-package) for known degrees of freedom, and unknown non-centrality parameter zeta*. The 'confidence distribution' views zeta* as a random quantity once z* is observed. As such, the CDF of the confidence distribution is the same as that of the Maximal Sharpe ratio (up to a flip of lower.tail); while the quantile function is used to compute confidence intervals on zeta* given z*.

Value

pco_sropt gives the distribution function, and qco_sropt gives the quantile function.

Invalid arguments will result in return value NaN with a warning.

Note

When lower.tail is true, pco_sropt is monotonic increasing with respect to q, and decreasing in sropt; these are reversed when lower.tail is false. Similarly, qco_sropt is increasing in sign(as.double(lower.tail) - 0.5) * p and - sign(as.double(lower.tail) - 0.5) * sropt.

Author(s)

Steven E. Pav shabbychef@gmail.com

See Also

reannualize

dsropt,psropt,qsropt,rsropt

Other sropt: as.sropt(), confint.sr(), dsropt(), is.sropt(), power.sropt_test(), reannualize(), sropt_test(), sropt

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
zeta.s <- 2.0
ope <- 253
ntest <- 50
df1 <- 4
df2 <- 6 * ope
rvs <- rsropt(ntest,df1=df1,df2=df2,zeta.s=zeta.s)
qvs <- seq(0,10,length.out=51)
pps <- pco_sropt(qvs,df1,df2,rvs[1],ope)

if (require(txtplot))
 txtplot(qvs,pps)

pps <- pco_sropt(qvs,df1,df2,rvs[1],ope,lower.tail=FALSE)

if (require(txtplot))
 txtplot(qvs,pps)


svs <- seq(0,4,length.out=51)
pps <- pco_sropt(2,df1,df2,svs,ope)
pps <- pco_sropt(2,df1,df2,svs,ope,lower.tail=FALSE)

pps <- pco_sropt(qvs,df1,df2,rvs[1],ope,lower.tail=FALSE)
pco_sropt(-1,df1,df2,rvs[1],ope)

qvs <- qco_sropt(0.05,df1=df1,df2=df2,z.s=rvs)
mean(qvs > zeta.s)
qvs <- qco_sropt(0.5,df1=df1,df2=df2,z.s=rvs)
mean(qvs > zeta.s)
qvs <- qco_sropt(0.95,df1=df1,df2=df2,z.s=rvs)
mean(qvs > zeta.s)
# test vectorization:
qv <- qco_sropt(0.1,df1,df2,rvs)
qv <- qco_sropt(c(0.1,0.2),df1,df2,rvs)
qv <- qco_sropt(c(0.1,0.2),c(df1,2*df1),df2,rvs)
qv <- qco_sropt(c(0.1,0.2),c(df1,2*df1),c(df2,2*df2),rvs)

SharpeR documentation built on Aug. 18, 2021, 5:08 p.m.