Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

If data is truly normal, it should have a skewness value of 0 and a kurtosis value of 3. Write an R function that conducts

If data is truly normal, it should have a skewness value of 0 and a kurtosis value of 3. Write an R function that conducts a normality test as follows: it takes as input a data set, calculates a bootstrap confidence interval for the skewness, calculates a bootstrap confidence interval for the kurtosis, then sees if 0 is in the skewness interval and 3 is in the kurtosis interval. If so, your routine prints that the data is normally distributed, otherwise your routine should print that the data is not normally distributed. Test your routine on random data from normal (rnorm), uniform (runif), and exponential (rexp) , with sample sizes of n=10,30,70 and 100. (R programming)

Here is my coding, I don't why it doesn't return correct answer, please help!! Thank you

```{r} library(moments)

mynormtest = function(x){ CIskew <- quantile(replicate(10000, skewness(x)), c(0.025, .975),names=FALSE) CIkur <- quantile(replicate(10000, kurtosis(x)), c(0.025, .975),names=FALSE) if(( CIskew[1]<=0 & CIskew[2]>=0) & (CIkur[1]<= 3 & CIkur[2]>=3)) { return('The data is normally distributed') } else { return('the data is not normally distributed') } } mynormtest(rnorm(10000)) mynormtest(rnorm(10)) mynormtest(rnorm(30)) mynormtest(rnorm(70)) mynormtest(rnorm(100)) mynormtest(runif(10)) mynormtest(runif(30)) mynormtest(runif(70)) mynormtest(runif(100)) mynormtest(rexp(10)) mynormtest(rexp(30)) mynormtest(rexp(70)) mynormtest(rexp(100))

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Expert Systems Applications 19th International Conference Dexa 2008 Turin Italy September 2008 Proceedings Lncs 5181

Authors: Sourav S. Bhowmick ,Josef Kung ,Roland Wagner

2008th Edition

3540856536, 978-3540856535

More Books

Students also viewed these Databases questions

Question

8. Have you addressed credibility issues?

Answered: 1 week ago

Question

7. List behaviors to improve effective leadership in meetings

Answered: 1 week ago

Question

6. Explain the six-step group decision process

Answered: 1 week ago