我需要这个统计程序的帮助 . 这是我第一次使用R-Code,想要一些帮助来验证我的编码是否正确 .

我的程序是否输出了问题要求的正确值?

这是我的任务

生成y,这是一个U(0,1)数 . 通过x = 1 /(1-y)^ 0.25找到帕累托数

从Pareto分布生成1000个大小为40000个随机整数的样本(见下文) . 对于这1000个样本中的每一个,计算平均值 .

一个 . 找出平均值在30到33之间的模拟概率 .

湾找出均值的模拟均值 .

C . 找出平均值的模拟标准差 .

d . 绘制平均值的直方图 .

这是我的代码

> mu=c()
> n = 40000
> for (i in 1:1000)
+ {
+ y=runif(n,0,1)
+ x=1/((1-y)^0.25)
+ mu[i]=mean(x)
+ }
> # Probability that the mean is between 30 and 33 exclusive.
> mean(mu)
[1] 1.333303
> # Simulated mean of the means.
> mean (mu)
[1] 1.333303
> # Simulated Standard Deviation of the means.
> sqrt(var(mu))
[1] 0.002328507
> # Histogram of the means.
> hist (mu)
>