您如何在R中的分布函数中找到未知数?

问题描述 投票:2回答:1

例如,我需要找到均值0.02

我如何找到x? R能够解方程吗?

r statistics data-analysis normal-distribution stochastic
1个回答
3
投票

您可能需要erfinv中的pracma才能获得平均值mu,例如

p <- 0.02
x <- 400
sgm <- 4
mu <- x - sgm*sqrt(2)*pracma::erfinv(2*p-1)

诸如此类

> mu
[1] 408.215

> pnorm(400,mu,sgm) # check the obtained value of mu
[1] 0.02

更聪明的方法是通过qnorm(感谢@ user20650)

mu <- qnorm(p,x,sgm,FALSE)
© www.soinside.com 2019 - 2024. All rights reserved.