根据分位数信息确定正态分布

编程入门 行业动态 更新时间:2024-10-28 14:31:44
本文介绍了根据分位数信息确定正态分布的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想知道如何让 R 告诉我 SD(作为 R 内置的 qnorm() 中的一个参数)正态分布的 95% 限制值是否已知?

I was wondering how I could have R tell me the SD (as an argument in the qnorm() built in R) for a normal distribution whose 95% limit values are already known?

举个例子,我知道我的法线的两个 95% 极限值分别是 158 和 168.因此,在下面的 R 代码 SD 中显示为x".如果y"(这个简单的qnorm()函数的答案)需要是(158, 168),那么 R可以告诉我x 应该是什么?

As an example, I know the two 95% limit values for my normal are 158, and 168, respectively. So, in the below R code SD is shown as "x". If "y" (the answer of this simple qnorm() function) needs to be (158, 168), then can R tell me what should be x?

y <- qnorm(c(.025,.975), 163, x)

推荐答案

正态分布的一般过程

假设我们有一个正态分布 X ~ N(mu, sigma),具有未知的均值 mu 和未知的标准偏差 sigma.我们的目标是求解 mu 和 sigma,给定两个分位数方程:

A general procedure for Normal distribution

Suppose we have a Normal distribution X ~ N(mu, sigma), with unknown mean mu and unknown standard deviation sigma. And we aim to solve for mu and sigma, given two quantile equations:

Pr(X < q1) = alpha1 Pr(X < q2) = alpha2

我们考虑标准化:Z = (X - mu)/sigma,所以

We consider standardization: Z = (X - mu) / sigma, so that

Pr(Z < (q1 - mu) / sigma) = alpha1 Pr(Z < (q2 - mu) / sigma) = alpha2

换句话说,

(q1 - mu) / sigma = qnorm(alpha1) (q2 - mu) / sigma = qnorm(alpha2)

RHS 是明确已知的,我们定义 beta1 = qnorm(alpha1), beta2 = qnorm(alpha2).现在,上面简化为 2 个线性方程组:

The RHS is explicitly known, and we define beta1 = qnorm(alpha1), beta2 = qnorm(alpha2). Now, the above simplifies to a system of 2 linear equations:

mu + beta1 * sigma = q1 mu + beta2 * sigma = q2

这个系统有系数矩阵:

1 beta1 1 beta2

具有行列式 beta2 - beta1.奇点的唯一情况是beta2 = beta1.只要系统是非奇异的,我们就可以使用solve来求解mu和sigma.

with determinant beta2 - beta1. The only situation for singularity is beta2 = beta1. As long as the system is non-singular, we can use solve to solve for mu and sigma.

想想奇点情况意味着什么.qnorm 对于正态分布是严格单调的.所以beta1 = beta2 和alpha1 = alpha2 是一样的.但这很容易避免,因为它在您的规范下,所以在下面我不会检查奇异性.

Think about what the singularity situation means. qnorm is strictly monotone for Normal distribution. So beta1 = beta2 is as same as alpha1 = alpha2. But this can be easily avoided as it is under your specification, so in the following I will not check singularity.

将上面总结成一个估计函数:

Wrap up above into an estimation function:

est <- function(q, alpha) { beta <- qnorm(alpha) setNames(solve(cbind(1, beta), q), c("mu", "sigma")) }

让我们测试一下:

x <- est(c(158, 168), c(0.025, 0.975)) # mu sigma #163.000000 2.551067 ## verification qnorm(c(0.025, 0.975), x[1], x[2]) # [1] 158 168

我们也可以随意:


We can also do something arbitrary:

x <- est(c(1, 5), c(0.1, 0.4)) # mu sigma #5.985590 3.890277 ## verification qnorm(c(0.1, 0.4), x[1], x[2]) # [1] 1 5

更多推荐

根据分位数信息确定正态分布

本文发布于:2023-07-26 11:50:03,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1216034.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:正态分布   位数   信息

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!