J'ai deux variables aléatoires, où est la distribution uniforme de 0-1.
Ensuite, cela donne un processus, disons:
Maintenant, je me demandais s'il y avait une expression de forme fermée pour le quantile théorique à 75% de pour un donné - je suppose que i peut le faire avec un ordinateur et de nombreuses réalisations de , mais je préfère la forme fermée.
quant = function(n,p,x) return( quantile(runif(n)*sin(x)+runif(n)*cos(x),p) )
etquant(100000,0.75,1)
.Réponses:
Ce problème peut être rapidement réduit à celui de trouver le quantile d'une distribution trapézoïdale .
Réécrivons le processus comme où U 1 et U 2 sont iid U ( - 1 , 1 ) variables aléatoires; et, par symétrie, cela a la mêmedistributionmarginaleque le processus ¯ P ( x ) = U 1 ⋅ | 1
Quantiles of a trapezoidal distribution
The quantile of the distribution ofY , for any p<1/2 is, thus,
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.
la source