a (non-empty) numeric matrix of data values, each row independent,
each column representing an asset, or an object of
class sropt.
alternative
a character string specifying the alternative hypothesis,
must be one of "two.sided", "greater" (default) or
"less". You can specify just the initial letter.
zeta.s
a number indicating the null hypothesis value.
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.
conf.level
confidence level of the interval. (not used yet)
Details
Suppose xi are n independent draws of a q-variate
normal random variable with mean mu and covariance matrix
Sigma. This code tests the hypothesis
H0: mu' Sigma^-1 mu = delta_0^2
The default alternative hypothesis is the one-sided
H1: mu' Sigma^-1 mu > delta_0^2
but this can be set otherwise.
Note there is no 'drag' term here since this represents a linear offset of
the population parameter.
Value
A list with class "htest" containing the following components:
statistic
the value of the T^2-statistic.
parameter
a list of the degrees of freedom for the statistic.
p.value
the p-value for the test.
conf.int
a confidence interval appropriate to the specified alternative hypothesis. NYI.
estimate
the estimated optimal Sharpe, annualized
null.value
the specified hypothesized value of the optimal Sharpe.
alternative
a character string describing the alternative hypothesis.
method
a character string indicating what type of test was performed.
data.name
a character string giving the name(s) of the data.
Other sropt: as.sropt,
confint.sr, dsropt,
is.sropt, pco_sropt,
power.sropt_test,
reannualize, sropt
Examples
# test for uniformity
pvs <- replicate(128,{ x <- sropt_test(matrix(rnorm(1000*4),ncol=4),alternative="two.sided")
x$p.value })
plot(ecdf(pvs))
abline(0,1,col='red')
# input a sropt objects:
nfac <- 5
nyr <- 10
ope <- 253
# simulations with no covariance structure.
# under the null:
set.seed(as.integer(charToRaw("be determinstic")))
Returns <- matrix(rnorm(ope*nyr*nfac,mean=0,sd=0.0125),ncol=nfac)
asro <- as.sropt(Returns,drag=0,ope=ope)
stest <- sropt_test(asro,alternative="two.sided")
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(SharpeR)
Attaching package: 'SharpeR'
The following object is masked from 'package:base':
summary
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/SharpeR/sropt_test.Rd_%03d_medium.png", width=480, height=480)
> ### Name: sropt_test
> ### Title: test for optimal Sharpe ratio
> ### Aliases: sropt_test
> ### Keywords: htest
>
> ### ** Examples
>
>
> # test for uniformity
> pvs <- replicate(128,{ x <- sropt_test(matrix(rnorm(1000*4),ncol=4),alternative="two.sided")
+ x$p.value })
> plot(ecdf(pvs))
> abline(0,1,col='red')
>
> # input a sropt objects:
> nfac <- 5
> nyr <- 10
> ope <- 253
> # simulations with no covariance structure.
> # under the null:
> set.seed(as.integer(charToRaw("be determinstic")))
> Returns <- matrix(rnorm(ope*nyr*nfac,mean=0,sd=0.0125),ncol=nfac)
> asro <- as.sropt(Returns,drag=0,ope=ope)
> stest <- sropt_test(asro,alternative="two.sided")
>
>
>
>
>
>
> dev.off()
null device
1
>