Christofer Bogaso
2024-Sep-02 23:26 UTC
[R] Adding parameters for Benchmark normal distribution in shapiro.test
Hi, In ?shapiro.test, there seems to be no option to pass mean and sd information of the Normal distribution which I want to compare my sample data to. For example in the code below, I want to test my sample to N(0, 10). shapiro.test(rnorm(100, mean = 5, sd = 3)) Is there any way to pass the information of the benchmark normal distribution?
Jeff Newmiller
2024-Sep-02 23:53 UTC
[R] Adding parameters for Benchmark normal distribution in shapiro.test
Wouldn't that be because the sample is not being compared to a specific distribution but rather to many possible distributions by MC? [1] If you think that need not be the case, perhaps you can write your own test... but then it will probably be answering a different question? [1] https://en.m.wikipedia.org/wiki/Shapiro%E2%80%93Wilk_test On September 2, 2024 4:26:17 PM PDT, Christofer Bogaso <bogaso.christofer at gmail.com> wrote:>Hi, > >In ?shapiro.test, there seems to be no option to pass mean and sd >information of the Normal distribution which I want to compare my >sample data to. > >For example in the code below, I want to test my sample to N(0, 10). > >shapiro.test(rnorm(100, mean = 5, sd = 3)) > >Is there any way to pass the information of the benchmark normal distribution? > >______________________________________________ >R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see >https://stat.ethz.ch/mailman/listinfo/r-help >PLEASE do read the posting guide https://www.R-project.org/posting-guide.html >and provide commented, minimal, self-contained, reproducible code.-- Sent from my phone. Please excuse my brevity.
Ben Bolker
2024-Sep-03 00:22 UTC
[R] Adding parameters for Benchmark normal distribution in shapiro.test
From Shapiro and Wilk's paper: > The objective is to derive a test for the hypothesis that this is a sample from a normal distribution with unknown mean mu and unknown variance sigma^2 That is, the estimates of the mean and SD are folded into the derivation of the test statistic. If you want to test against a specified alternative you could try e.g. a Kolmogorov-Smirnov test set.seed(101) x <- rnorm(100, mean = 5, sd = 3) ks.test(x, "pnorm", 0, 10) On 2024-09-02 7:26 p.m., Christofer Bogaso wrote:> Hi, > > In ?shapiro.test, there seems to be no option to pass mean and sd > information of the Normal distribution which I want to compare my > sample data to. > > For example in the code below, I want to test my sample to N(0, 10). > > shapiro.test(rnorm(100, mean = 5, sd = 3)) > > Is there any way to pass the information of the benchmark normal distribution? > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide https://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.-- Dr. Benjamin Bolker Professor, Mathematics & Statistics and Biology, McMaster University Director, School of Computational Science and Engineering > E-mail is sent at my convenience; I don't expect replies outside of working hours.