У меня есть две случайные величины, где - равномерное распределение 0-1.
Затем они дают процесс, скажем:
Теперь мне было интересно, существует ли выражение для замкнутой формы для теоретического 75-процентного квантиля P ( x ) для данного x ∈ ( 0 , 2 π ) - я предполагаю, что i могу сделать это с помощью компьютера и многих реализаций P ( x ) , но я бы предпочел закрытую форму.
quant = function(n,p,x) return( quantile(runif(n)*sin(x)+runif(n)*cos(x),p) )
иquant(100000,0.75,1)
.Ответы:
This problem can quickly be reduced to one of finding the quantile of a trapezoidal distribution.
Let us rewrite the process as
Quantiles of a trapezoidal distribution
LetY=X1+X2 where X1 and X2 are independent U(−a,a) and U(−b,b) distributions. Assume without loss of generality that a≥b . Then, the density of Y is formed by convolving the densities of X1 and X2 . This is readily seen to be a trapezoid with vertices (−a−b,0) , (−a+b,1/2a) (a−b,1/2a) (a+b,0) .
Back to the case at hand
The above already provides enough to give a closed-form expression. All we need is to break into two cases|sinx|≥|cosx| and |sinx|<|cosx| to determine which plays the role of 2a and which plays the role of 2b above. (The factor of 2 here is only to compensate for the divisions by two in the definition of P¯¯¯¯(x) .)
Forp<1/2 , on |sinx|≥|cosx| , we set a=|sinx|/2 and b=|cosx|/2 and get
The quantiles
Below are two heatmaps. The first shows the quantiles of the distribution ofP(x) for a grid of x running from 0 to 2π . The y -coordinate gives the probability p associated with each quantile. The colors indicate the value of the quantile with dark red indicating very large (positive) values and dark blue indicating large negative values. Thus each vertical strip is a (marginal) quantile plot associated with P(x) .
The second heatmap below shows the quantiles themselves, colored by the corresponding probability. For example, dark red corresponds top=1/2 and dark blue corresponds to p=0 and p=1 . Cyan is roughly p=1/4 and p=3/4 . This more clearly shows the support of each distribution and the shape.
Some sample
R
codeThe functionP(x) for a given x . It uses the more general
qproc
below calculates the quantile function ofqtrap
to generate the quantiles.Below is a test with the corresponding output.
источник