[R] Adding parameters for Benchmark normal distribution in shapiro.test

Ben Bolker bbo|ker @end|ng |rom gm@||@com
Tue Sep 3 02:22:08 CEST 2024


   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 using 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.



More information about the R-help mailing list