未知累积函数的反函数 [英] Inverse function of an unknown cumulative function

查看:99
本文介绍了未知累积函数的反函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在处理一个数据文件,里面的观察值是随机值.在这种情况下,我不知道x的分布(我的观察).我使用函数密度来估计密度,因为必须应用内核估计.

I'm working with a data file, the observations inside are random values. In this case I don't know the distribution of x (my observations). I'm using the function density in order to estimate the density, because I must apply a kernel estimation.

T=density(datafile[,1],bw=sj,kernel="epanechnikov")

在此之后,我必须将其整合,因为我正在寻找分位数(类似于95%的VaR). 为此,我有2个选择:

After this I must integrate this because I'm looking for a quantile (similar to VaR, 95%). For this I have 2 options:

ecdf()
quantile()

现在我有分位数95的值,但这是内核估计的数据.

Now I have the value of the quantile 95, but this is the data estimated by kernel.

是否可以使用一个函数来了解原始数据的分位数95的值?

我指出这是一个未知的分布,为此,我想将一种非参数方法想象为Newton,就像SAS solve()

I remark that this is a distribution unknown, for this I would like to imagine a non parametric method as Newton, like the one that is in SAS solve()

推荐答案

您可以使用

You can use quantile() for this. Here is an example using random data:

> data<-runif(1000)

> q<-quantile(data, .95)
> q
      95% 
0.9450324 

这里,数据均匀地分布在0和1之间,因此第95个百分位数接近0.95.

Here, the data is uniformly distributed between 0 and 1, so the 95th percentile is close to 0.95.

要执行逆变换:

> ecdf(data)(q)
[1] 0.95

这篇关于未知累积函数的反函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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