Intervallo di previsione per variabile casuale binomiale


14

Qual è la formula (approssimativa o esatta) per un intervallo di previsione per una variabile casuale binomiale?

Supponiamo YBinom(n,p) e osserviamo y (tratto da Y ). La n è nota.

Il nostro obiettivo è quello di ottenere un intervallo di previsione al 95% per un nuovo pareggio da Y .

La stima puntuale è np^ , dove p = yp^=yn . Un intervallo di confidenza per p è semplice, ma non riesco a trovare una formula per un intervallo di previsione per l'Y. Se sapessimop(piuttosto che p ), poi un intervallo di previsione del 95% solo consiste nel trovare i quantili di un binomio. C'è qualcosa di ovvio che sto trascurando?p^Ypp^


1
Vedi quali metodi non bayesiani esistono per l'inferenza predittiva? . In questo caso il metodo che utilizza i pivot non è disponibile (non credo) ma potresti usare una delle probabilità predittive. O ovviamente, un approccio bayesiano.
Scortchi - Ripristina Monica

1
Ciao ragazzi, vorrei prendere un momento per rispondere alle preoccupazioni sollevate. - riguardo alla fiducia per p: non mi interessa. - considerando che le previsioni sono il 95% della distribuzione: sì, questo è esattamente ciò che gli intervalli di previsione sono indipendentemente dal contesto (nella regressione devi assumere errori normali, dove gli intervalli di confidenza si basano su CLT - sì, l'esempio di prevedere il numero di teste in il lancio della moneta è corretto. Ciò che rende difficile questo problema è che ora non "p", ma abbiamo una stima.
Statseeker,

3
@Addison Leggi il libro Intervalli statistici di G. Hahn e W. Meeker. Spiegano la differenza tra intervalli di confidenza, intervalli di previsione, intervalli di tolleranza e intervalli credibili bayesiani. Un intervallo di previsione del 95% non contiene il 95% della distribuzione. Fa quello che fanno gli intervalli più frequenti. Se si esegue ripetutamente il campionamento da B (n, p) e si utilizza ogni volta lo stesso metodo per produrre un intervallo di previsione del 95% per p, il 95% degli intervalli di previsione conterrà il valore reale di p. Se si desidera coprire il 95% della distribuzione, costruire un intervallo di tolleranza.
Michael R. Chernick,

Gli intervalli di tolleranza coprono una percentuale della distribuzione. Per un intervallo di tolleranza del 95% per il 90% della distribuzione, ripetere nuovamente il processo più volte e utilizzare lo stesso metodo per generare l'intervallo ogni volta, quindi in circa il 95% dei casi almeno il 90% della distribuzione cadrà nell'intervallo e il 5% delle volte meno del 90% della distribuzione sarà contenuto nell'intervallo.
Michael R. Chernick,

Risposte:


24

Ok, proviamo questo. Darò due risposte: quella bayesiana, che secondo me è semplice e naturale, e una delle possibili frequentazioni.

Soluzione bayesiana

Assumiamo una prima Beta su , i, e., P ~ B e t un ( α , β ) , perché il modello Beta-binomiale è coniugato, il che significa che la distribuzione posteriore è anche una distribuzione beta con parametri α = α + k , β = β + n - k , (sto usando k per indicare il numero di successi in n prove, invece di y ). Pertanto, l'inferenza è notevolmente semplificata. Ora, se hai qualche conoscenza preliminare sui probabili valori dippBeta(α,β)α^=α+k,β^=β+nkkny , potresti usarlo per impostare i valori di α e β , cioè per definire il tuo beta precedente, altrimenti potresti assumere un precedente uniforme (non informativo), con α = β = 1 , o altri priori non informativi (vedi ad esempioqui). In ogni caso, il tuo posteriore èpαβα=β=1

Pr(p|n,k)=Beta(α+k,β+nk)

Nell'inferenza bayesiana, tutto ciò che conta è la probabilità posteriore, nel senso che una volta che lo sai, puoi fare inferenze per tutte le altre quantità nel tuo modello. Vuoi fare inferenza sugli osservabili : in particolare, su un vettore di nuovi risultati y = y 1 , , y m , dove m non è necessariamente uguale a n . In particolare, per ogni j = 0 , ... , m , vogliamo calcolare la probabilità di avere esattamente j successi nelle successive m prove, dato che abbiamo ottenuto kyy=y1,,ymmnj=0,,mjmksuccessi nelle precedenti prove; la funzione di massa predittiva posteriore:n

Pr(j|m,y)=Pr(j|m,n,k)=01Pr(j,p|m,n,k)dp=01Pr(j|p,m,n,k)Pr(p|n,k)dp

Tuttavia, il nostro modello binomiale per significa che, a condizione che p abbia un certo valore, la probabilità di avere j successi in m prove non dipende dai risultati passati: è semplicementeYpjm

f(j|m,p)=(jm)pj(1p)j

Così l'espressione diventa

Pr(j|m,n,k)=01(jm)pj(1p)jPr(p|n,k)dp=01(jm)pj(1p)jBeta(α+k,β+nk)dp

The result of this integral is a well-known distribution called the Beta-Binomial distribution: skipping the passages, we get the horrible expression

Pr(j|m,n,k)=m!j!(mj)!Γ(α+β+n)Γ(α+k)Γ(β+nk)Γ(α+k+j)Γ(β+n+mkj)Γ(α+β+n+m)

Our point estimate for j, given quadratic loss, is of course the mean of this distribution, i.e.,

μ=m(α+k)(α+β+n)

Now, let's look for a prediction interval. Since this is a discrete distribution, we don't have a closed form expression for [j1,j2], such that Pr(j1jj2)=0.95. The reason is that, depending on how you define a quantile, for a discrete distribution the quantile function is either not a function or is a discontinuous function. But this is not a big problem: for small m, you can just write down the m probabilities Pr(j=0|m,n,k),Pr(j1|m,n,k),,Pr(jm1|m,n,k) and from here find j1,j2 such that

Pr(j1jj2)=Pr(jj2|m,n,k)Pr(j<j1|m,n,k)0.95

Of course you would find more than one couple, so you would ideally look for the smallest [j1,j2] such that the above is satisfied. Note that

Pr(j=0|m,n,k)=p0,Pr(j1|m,n,k)=p1,,Pr(jm1|m,n,k)=pm1

are just the values of the CMF (Cumulative Mass Function) of the Beta-Binomial distribution, and as such there is a closed form expression, but this is in terms of the generalized hypergeometric function and thus is quite complicated. I'd rather just install the R package extraDistr and call pbbinom to compute the CMF of the Beta-Binomial distribution. Specifically, if you want to compute all the probabilities p0,,pm1 in one go, just write:

library(extraDistr)  
jvec <- seq(0, m-1, by = 1) 
probs <- pbbinom(jvec, m, alpha = alpha + k, beta = beta + n - k)

where alpha and beta are the values of the parameters of your Beta prior, i.e., α and β (thus 1 if you're using a uniform prior over p). Of course it would all be much simpler if R provided a quantile function for the Beta-Binomial distribution, but unfortunately it doesn't.

Practical example with the Bayesian solution

Let n=100, k=70 (thus we initially observed 70 successes in 100 trials). We want a point estimate and a 95%-prediction interval for the number of successes j in the next m=20 trials. Then

n <- 100
k <- 70
m <- 20
alpha <- 1
beta  <- 1

where I assumed a uniform prior on p: depending on the prior knowledge for your specific application, this may or may not be a good prior. Thus

bayesian_point_estimate <- m * (alpha + k)/(alpha + beta + n) #13.92157

Clearly a non-integer estimate for j doesn't make sense, so we could just round to the nearest integer (14). Then, for the prediction interval:

jvec <- seq(0, m-1, by = 1)
library(extraDistr)
probabilities <- pbbinom(jvec, m, alpha = alpha + k, beta = beta + n - k)

The probabilities are

> probabilities
 [1] 1.335244e-09 3.925617e-08 5.686014e-07 5.398876e-06
 [5] 3.772061e-05 2.063557e-04 9.183707e-04 3.410423e-03
 [9] 1.075618e-02 2.917888e-02 6.872028e-02 1.415124e-01
[13] 2.563000e-01 4.105894e-01 5.857286e-01 7.511380e-01
[17] 8.781487e-01 9.546188e-01 9.886056e-01 9.985556e-01

For an equal-tail probabilities interval, we want the smallest j2 such that Pr(jj2|m,n,k)0.975 and the largest j1 such that Pr(j<j1|m,n,k)=Pr(jj11|m,n,k)0.025. This way, we will have

Pr(j1jj2|m,n,k)=Pr(jj2|m,n,k)Pr(j<j1|m,n,k)0.9750.025=0.95

Thus, by looking at the above probabilities, we see that j2=18 and j1=9. The probability of this Bayesian prediction interval is 0.9778494, which is larger than 0.95. We could find shorter intervals such that Pr(j1jj2|m,n,k)0.95, but in that case at least one of the two inequalities for the tail probabilities wouldn't be satisfied.

Frequentist solution

I'll follow the treatment of Krishnamoorthy and Peng, 2011. Let YBinom(m,p) and XBinom(n,p) be independently Binominally distributed. We want a 12αprediction interval for Y, based on a observation of X. In other words we look for I=[L(X;n,m,α),U(X;n,m,α)] such that:

PrX,Y(YI)=PrX,Y(L(X;n,m,α)YU(X;n,m,α)]12α

The "12α" is due to the fact that we are dealing with a discrete random variable, and thus we cannot expect to get exact coverage...but we can look for an interval which has always at least the nominal coverage, thus a conservative interval. Now, it can be proved that the conditional distribution of X given X+Y=k+j=s is hypergeometric with sample size s, number of successes in the population n and population size n+m. Thus the conditional pmf is

Pr(X=k|X+Y=s,n,n+m)=(nk)(msk)(m+ns)

The conditional CDF of X given X+Y=s is thus

Pr(Xk|s,n,n+m)=H(k;s,n,n+m)=i=0k(ni)(msi)(m+ns)

The first great thing about this CDF is that it doesn't depend on p, which we don't know. The second great thing is that it allows to easily find our PI: as a matter of fact, if we observed a value k of X, then the 1α lower prediction limit is the smallest integer L such that

Pr(Xk|k+L,n,n+m)=1H(k1;k+L,n,n+m)>α

correspondingly, the the 1α upper prediction limit is the largest integer such that

Pr(Xk|k+U,n,n+m)=H(k;k+U,n,n+m)>α

Thus, [L,U] is a prediction interval for Y of coverage at least 12α. Note that when p is close to 0 or 1, this interval is conservative even for large n, m, i.e., its coverage is quite larger than 12α.

Practical example with the Frequentist solution

Same setting as before, but we don't need to specify α and β (there are no priors in the Frequentist framework):

n <- 100
k <- 70
m <- 20

The point estimate is now obtained using the MLE estimate for the probability of successes, p^=kn, which in turns leads to the following estimate for the number of successes in m trials:

frequentist_point_estimate <- m * k/n #14

For the prediction interval, the procedure is a bit different. We look for the largest U such that Pr(Xk|k+U,n,n+m)=H(k;k+U,n,n+m)>α, thus let's compute the above expression for all U in [0,m]:

jvec <- seq(0, m, by = 1)
probabilities <- phyper(k,n,m,k+jvec)

We can see that the largest U such that the probability is still larger than 0.025 is

jvec[which.min(probabilities > 0.025) - 1] # 18

Same as for the Bayesian approach. The lower prediction bound L is the smallest integer such that Pr(Xk|k+L,n,n+m)=1H(k1;k+L,n,n+m)>α, thus

probabilities <- 1-phyper(k-1,n,m,k+jvec)
jvec[which.max(probabilities > 0.025) - 1] # 8

Thus our frequentist "exact" prediction interval is [L,U]=[8,18].

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.