r - 如何找到标准误差在正态分布中的特定数量的概率?
问题描述
我试图找到标准误差的概率等于或大于 0.01 的正态分布的 CLT(中心极限定理)近似值?
计算误差为 0.01 或更大的概率
鉴于:
N= 样本数为 100
X = 样本平均值为 0.51
SE = 我通过 sqrt(X * (1-X)/N) 计算了标准误差
然后我使用了这个pnorm()
功能。请看下面的代码。当我运行编译器时,它给了我一个函数的参数错误pnorm()
。
R代码
# `N` is the number of people polled
N <-100
# `X` is the sample average
X <- 0.51
# `se` is the standard error of the sample average
se <- sqrt(X*(1-X)/N)
# Calculating the probability that the error is 0.01 or larger
1-(pnorm(0.01/se) - pnorm(-0.01/se))
当我运行代码时,编译器给我一个函数的参数错误pnorm()
。
解决方案
你的代码很好,这是我运行你的代码时得到的。没有错误。
> N <-100
> X <- 0.51
> se <- sqrt(X*(1-X)/N)
> 1-(pnorm(0.01/se) - pnorm(-0.01/se))
[1] 0.8414493
推荐阅读
- java - 使用 Dagger 注入接口的所有实现
- ubuntu - Certbot 使用 XAMPP 在 Ubuntu 16.04 上自动生成证书
- amazon-web-services - 如何删除亚马逊 ECR 中的旧图像
- css - css的循环动画
- android - 如何使用 NavigationView 在工具栏中添加另一个图标
- bash - 在bash中按字典顺序比较两个包含'_'的字符串
- javascript - 如何在 Angular 9 项目中安装 request-promise
- java - 如何从字节数组创建输出文件,以便在打开输出文件时,显示的数据与字节数组中的数据相同?
- javascript - 即使我遵循了许多使用相同代码的示例,this.setState is not a function 错误仍然存在
- character - 制表符是否被视为一个字符?