-1

I need to test the null hypothesis that my steady returns have a zero skewness with a confidence level of 95%. Do you have any ideas which formula I can take for this kind of test ? I tried the Agostino test for skewness, but think it's not the best way, because I can't set a confidence level.

library(moments)
?agostino.test
Ben Bolker
  • 211,554
  • 25
  • 370
  • 453
Kindou
  • 23
  • 1
  • 6

2 Answers2

2

If I understand your question correctly, all you have to do is compare the p-value from agostino.test() (which can be extracted from the returned object) with a specified alpha, i.e.

library(moments)
set.seed(1234)
x <- rnorm(1000)
a <- agostino.test(x)
a$p.value < 0.05  ## FALSE, fail to reject

(In case it's not clear, the 0.05 here is 1-(your confidence level)=1-0.95.) Or to simulate a case where the null hypothesis is false:

y <- rexp(1000,1)
agostino.test(y)$p.value < 0.05 ## TRUE, reject
Ben Bolker
  • 211,554
  • 25
  • 370
  • 453
  • Hey Ben, thank you very much for your answer, i need to the the null hypothesis that my steady returns have a zero skew. For that i need to take a confidence level from 95%. ( I just thought the agostino.test was a good solution for it). – Kindou Dec 29 '17 at 22:31
  • I believe my answer does what you want. If you don't think it does, can you communicate (by editing your question or commenting) why not or what you find unclear? – Ben Bolker Dec 29 '17 at 22:33
1

Here is an example taken from https://www.statmethods.net/advstats/bootstrapping.html I made a small modification to use the skew statistic. You don't provide a data set, so I just used the one in the example on the web page reference.

The following shows and example of getting a confidence interval for a skew statistic. You can test a hypothesis using a CI if you check to see if the null value is in the confidence interval.

library(boot)
skew_f <- function(data, indices) {
  d <- data[indices] # allows boot to select sample
  return(e1071::skewness(d))
}


# bootstrapping with 1000 replications
results <- boot(data=faithful$eruptions, statistic=skew_f,
   R=1000)

boot.ci(results, type="bca")
Harlan Nelson
  • 1,394
  • 1
  • 10
  • 22