Espressione in forma chiusa per i quantili di


16

Ho due variabili casuali, αiiid U(0,1),i=1,2 doveU(0,1) è la distribuzione uniforme 0-1.

Quindi, questi producono un processo, ad esempio:

P(x)=α1sin(x)+α2cos(x),x(0,2π)

Ora, mi chiedevo se esiste un'espressione in forma chiusa per F1(P(x);0.75) il quantile teorico del 75 percento di P(x) per un dato x(0,2π) - suppongo che i posso farlo con un computer e molte realizzazioni di P(x) , ma preferirei forma chiusa--.


1
Penso che tu voglia supporre che α 1 e α 2 siano statisticamente indipendenti. 12
Michael R. Chernick,

@Procrastinator: puoi scrivere questo come una risposta?
user603

4
(+1) Il punto di vista del "processo" sembra essere un po 'un'aringa rossa qui. Scrivi Dove β i = α i - 1 / 2 ~ U ( - 1 / 2 , 1 / 2 ) . Quindi, per ogni x fissa, i primi due termini determinano unafunzione di densitàtrapezoidalee l'ultimo termine è solo un offset medio. Per la determinazione della densità trapezoidale, dobbiamo considerare solo x [ 0 , π / 2 ) .
P(x)=β1sinx+β2cosx+12(sinx+cosx),
βi=αi1/2U(1/2,1/2)xx[0,π/2)
cardinale il

2
Numericamente questo può essere fatto semplicemente usando quant = function(n,p,x) return( quantile(runif(n)*sin(x)+runif(n)*cos(x),p) )e quant(100000,0.75,1).

Risposte:


19

Questo problema può essere rapidamente ridotto a quello di trovare il quantile di una distribuzione trapezoidale .

Riscriviamo il processo come dove U 1 e U 2 sono iid U ( - 1 , 1 ) variabili casuali; e, per simmetria, questo ha la stessadistribuzionemarginaledel processo ¯ P ( x ) = U 1| 1

P(x)=U112sinx+U212cosx+12(sinx+cosx),
U1U2U(1,1)
P¯(x)=U1|12sinx|+U2|12cosx|+12(sinx+cosx).
The first two terms determine a symmetric trapezoidal density since this is the sum of two mean-zero uniform random variables (with, in general, different half-widths). The last term just results in a translate of this density and the quantile is equivariant with respect to this translate (i.e., the quantile of the shifted distribution is the shifted quantile of the centered distribution).

Quantiles of a trapezoidal distribution

Let Y=X1+X2 where X1 and X2 are independent U(a,a) and U(b,b) distributions. Assume without loss of generality that ab. 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 (ab,0), (a+b,1/2a), (ab,1/2a) and (a+b,0).

The quantile of the distribution of Y, for any p<1/2 is, thus,

q(p):=q(p;a,b)={8abp(a+b),p<b/2a(2p1)a,b/2ap1/2.
By symmetry, for p>1/2, we have q(p)=q(1p).

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).)

For p<1/2, on |sinx||cosx|, we set a=|sinx|/2 and b=|cosx|/2 and get

qx(p)=q(p;a,b)+12(sinx+cosx),
and on |sinx|<|cosx| the roles reverse. Similarly, for p1/2
qx(p)=q(1p;a,b)+12(sinx+cosx),

The quantiles

Below are two heatmaps. The first shows the quantiles of the distribution of P(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).

Quantiles as a function of x

The second heatmap below shows the quantiles themselves, colored by the corresponding probability. For example, dark red corresponds to p=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.

Quantile plot

Some sample R code

The function qproc below calculates the quantile function of P(x) for a given x. It uses the more general qtrap to generate the quantiles.

# Pointwise quantiles of a random process: 
# P(x) = a_1 sin(x) + a_2 cos(x)

# Trapezoidal distribution quantile
# Assumes X = U + V where U~Uni(-a,a), V~Uni(-b,b) and a >= b
qtrap <- function(p, a, b)
{
    if( a < b) stop("I need a >= b.")
    s <- 2*(p<=1/2) - 1
    p <- ifelse(p<= 1/2, p, 1-p)
    s * ifelse( p < b/2/a, sqrt(8*a*b*p)-a-b, (2*p-1)*a )
}

# Now, here is the process's quantile function.
qproc <- function(p, x)
{
    s <- abs(sin(x))
    c <- abs(cos(x))
    a <- ifelse(s>c, s, c)
    b <- ifelse(s<c, s, c)
    qtrap(p,a/2, b/2) + 0.5*(sin(x)+cos(x))
} 

Below is a test with the corresponding output.

# Test case
set.seed(17)
n <- 1e4
x <- -pi/8
r <- runif(n) * sin(x) + runif(n) * cos(x)

# Sample quantiles, then actual.
> round(quantile(r,(0:10)/10),3)
    0%    10%    20%    30%    40%    50%    60%    70%    80%    90%   100%
-0.380 -0.111 -0.002  0.093  0.186  0.275  0.365  0.453  0.550  0.659  0.917
> round(qproc((0:10)/10, x),3)
 [1] -0.383 -0.117 -0.007  0.086  0.178  0.271  0.363  0.455  0.548
[10]  0.658  0.924

3
I wish i could upvote more. This is the reason i love this website: the power of specialization. i didn't know of the trapezoid distribution. It would have taken me some time to figure this out. Or I would have had to settle for using Gaussians instead of Uniforms. Anyhow, it's awesome.
user603
Utilizzando il nostro sito, riconosci di aver letto e compreso le nostre Informativa sui cookie e Informativa sulla privacy.
Licensed under cc by-sa 3.0 with attribution required.