在 R 中重复 1000 次的正态性测试:Shapiro Wilk、Jarque Bera、Lilliefors [英] Normality tests repeating 1000 times in R: Shapiro Wilk, Jarque Bera, Lilliefors

查看:57
本文介绍了在 R 中重复 1000 次的正态性测试:Shapiro Wilk、Jarque Bera、Lilliefors的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

学生和专业人士

我目前正在尝试为随机样本大小 (T=10,30,50,100,500) 编写正态性检验.

I am currently trying to program normality tests for random sample sizes (T=10,30,50,100,500).

我用于正态性测试的函数如下:

The functions I use for the normality tests are the following:

sim1 <- rnorm(10)

sw10 <- shapiro.test(sim1)

这对于每个样本大小

这会生成一个包含测试信息的列表,这些信息必须以 90%、95% 和 99% 的置信度进行解释.

This results in a list with test information that has to be interpreted with confidence levels 90%, 95% and 99%.

我面临的问题是我需要重复这个过程 1000 次.但是在计算相同 p 值的情况下,使用相同的样本 sim1 在这种情况下没有帮助.

The problem I am facing is that I need to repeat this process 1000 times.. But using the same sample sim1 does not help in this case while the same p-values are computed.

那么我要使用以下内容吗?

so do I use the following?

rsw10 <- replicate(shapiro.test(rnorm(10))

另外,我必须计算相对拒绝频率,我如何提取该信息?

Plus I have to compute relative rejection frequencies, how do I extract that information?

最好的问候

推荐答案

如果我没猜错的话,大概是这样,首先是代表的数量,然后是函数:

If I get you correct, it goes something like, you have the number of reps first, followed by the function:

sim = replicate(1000,shapiro.test(rnorm(10)))

拒绝是这样的,假设 alpha 为 0.05:

rejections go like, assuming an alpha of 0.05 :

table(sim["p.value",]<0.05)

FALSE  TRUE 
  961    39 

这篇关于在 R 中重复 1000 次的正态性测试:Shapiro Wilk、Jarque Bera、Lilliefors的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆