R中正态分布函数的反向/反向 [英] The reverse/inverse of the normal distribution function in R

查看:167
本文介绍了R中正态分布函数的反向/反向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

要在R中绘制正态分布曲线,我们可以使用:

To plot a normal distribution curve in R we can use:

(x = seq(-4,4, length=100))
y = dnorm(x)
plot(x, y)

如果 dnorm 将y作为x的函数进行计算,R是否具有将x作为y的函数进行计算的函数?如果不是,最好的方法是什么?

If dnorm calculates y as a function of x, does R have a function that calculates x as a function of y? If not what is the best way to approach this?

推荐答案

我不确定是否内置了密度函数的逆函数-它的使用频率不及累积分布函数的逆函数.我不能认为反密度函数很有用的太多情况.当然,这并不意味着没有,所以如果您确定这是您需要的功能,则可以执行以下操作:

I'm not sure if the inverse of the density function is built in -- it's not used nearly as often as the inverse of the cumulative distribution function. I can't think offhand of too many situation where the inverse density function is useful. Of course, that doesn't mean there aren't any, so if you are sure this is the function you need, you could just do:

dnorminv<-function(y) sqrt(-2*log(sqrt(2*pi)*y))

plot(x, y)
points(dnorminv(y),y,pch=3)

这篇关于R中正态分布函数的反向/反向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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