Verteilung der Differenz zwischen zwei Normalverteilungen


20

Ich habe zwei Wahrscheinlichkeitsdichtefunktionen von Normalverteilungen:

f1(x1|μ1,σ1)=1σ12πe(xμ1)22σ12

und

f2(x2|μ2,σ2)=1σ22πe(xμ2)22σ22

Ich suche nach der Wahrscheinlichkeitsdichtefunktion der Trennung zwischen und x 2 . Ich denke, das heißt, ich suche nach der Wahrscheinlichkeitsdichtefunktion von | x 1 - x 2 | . Ist das korrekt? Wie finde ich dasx1x2|x1x2|


Wenn dies Hausaufgaben sind, benutzen Sie bitte das self-studyTag. Wir akzeptieren Hausaufgabenfragen, gehen aber hier etwas anders damit um.
Shadowtalker

Ich möchte auch nicht "der Typ" sein, aber haben Sie es bei Google versucht? "Unterschied zwischen Normalverteilungen" hat mir ziemlich sofort eine Antwort gegeben.
Shadowtalker

@ssdecontrol nein, keine Hausaufgabe, aber es ist für ein Hobby-Projekt, daher macht es mir nichts aus, selbst ein paar Dinge herauszufinden, wenn ich auf den richtigen Weg bin. Ich habe Google ausprobiert, aber mein Verständnis ist so begrenzt, dass ich es wahrscheinlich nicht erkennen würde, wenn es direkt vor mir wäre. Mit Anführungszeichen habe ich viele Dinge gefunden, die "Was ist der Unterschied zwischen einer Normalverteilung und x" für einige x ähneln.
Martijn

Antworten:


25

Diese Frage kann wie angegeben nur unter der Annahme beantwortet werden, dass die beiden Zufallsvariablen und X 2, die durch diese Verteilungen bestimmt werden, unabhängig sind. X1X2 Dies macht ihre Differenz Normal mit dem Mittelwert μ = μ 2 - μ 1 und der Varianz σ 2 = σ 2 1 + σ 2 2 . (Die folgende Lösung kann leicht auf jede bivariate Normalverteilung von ( X 1 , X 2 verallgemeinert werdenX=X2X1μ=μ2μ1σ2=σ12+σ22 .) Also die Variable(X1,X2)

Z=Xμσ=X2X1(μ2μ1)σ12+σ22

hat eine Standardnormalverteilung (dh mit einem Mittelwert von Null und einer Einheitsvarianz) und

X=σ(Z+μσ).

Der Ausdruck

|X2X1|=|X|=X2=σ(Z+μσ)2

zeigt den absoluten Unterschied als skalierte Version der Quadratwurzel einer nichtzentralen Chi-Quadrat-Verteilung mit einem Freiheitsgrad- und Nichtzentralitätsparameter . Eine nicht-zentrale Chi-Quadrat-Verteilung mit diesen Parametern hat ein Wahrscheinlichkeitselementλ=(μ/σ)2

f(y)dy=y2πe12(λy)cosh(λy)dyy, y>0.

Das Schreiben von für x > 0 stellt eine Eins-zu-Eins-Entsprechung zwischen y und seiner Quadratwurzel her, was zur Folge haty=x2x>0y

f(y)dy=f(x2)d(x2)=x22πe12(λx2)cosh(λx2)dx2x2.

Vereinfacht man dies und skaliert dann um erhält man die gewünschte Dichte.σ

f|X|(x)=1σ2πcosh(xμσ2)exp(x2+μ22σ2).

|X|=|X2X1| (called "x" in the code) with parameters μ1=1,μ2=5,σ1=4,σ2=1. On it is plotted the graph of f|X|, which neatly coincides with the histogram values.

Figure

The R code for this simulation follows.

#
# Specify parameters
#
mu <- c(-1, 5)
sigma <- c(4, 1)
#
# Simulate data
#
n.sim <- 1e5
set.seed(17)
x.sim <- matrix(rnorm(n.sim*2, mu, sigma), nrow=2)
x <- abs(x.sim[2, ] - x.sim[1, ])
#
# Display the results
#
hist(x, freq=FALSE)
f <- function(x, mu, sigma) {
 sqrt(2 / pi) / sigma * cosh(x * mu / sigma^2) * exp(-(x^2 + mu^2)/(2*sigma^2)) 
}
curve(f(x, abs(diff(mu)), sqrt(sum(sigma^2))), lwd=2, col="Red", add=TRUE)

How would this be different if I want to get the squared difference? For example if I want (f1(.)f2(.))2?
user77005

1
@user77005 The answer to that is in my post: it's a non-central chi-squared distribution. Follow the link for details.
whuber

21

I am providing an answer that is complementary to the one by @whuber in the sense of being what a non-statistician (i.e. someone who does not know much about non-central chi-square distributions with one degree of freedom etc) might write, and that a neophyte could follow relatively easily.

Borrowing the assumption of independence as well as the notation from whuber's answer, Z=X1X2N(μ,σ2) where μ=μ1μ2 and σ2=σ12+σ22. Thus, for x0,

F|Z|(x)P{|Z|x}=P{xZx}=P{x<Zx}since Z is a continuous random variable=FZ(x)FZ(x),
and of course, F|Z|(x)=0 for x<0. It follows upon differentiating with respect to x that
f|Z|(x)xF|Z|(x)=[fZ(x)+fZ(x)]1(0,)(x)=[exp((xμ)22σ2)σ2π+exp((x+μ)22σ2)σ2π]1(0,)(x)=exp(x2+μ22σ2)σ2π(exp(xμσ2)+exp(xμσ2))1(0,)(x)=1σ2πcosh(xμσ2)exp(x2+μ22σ2)1(0,)(x)
which is the exact same result as in whuber's answer, but arrived at more transparently.

1
+1 I always like to see solutions that work from the most basic possible principles and assumptions.
whuber

1

The distribution of a difference of two normally distributed variates X and Y is also a normal distribution, assuming X and Y are independent (thanks Mark for the comment). Here is a derivation: http://mathworld.wolfram.com/NormalDifferenceDistribution.html

Here you are asking the absolute difference, based on whuber's answer and if we assume the difference in mean of X and Y is zero, it's just a half normal distribution with two times the density (thanks Dilip for the comment).


3
You and Wolfram Mathworld are implicitly assuming that the 2 normal distributions (random variables) are independent. The difference is not even necessarily normally distributed if the 2 normal random variables are not bivariate normal, which can happen if they are not independent..
Mark L. Stone

4
In addition to the assumption pointed out by Mark, you are also ignoring the fact that the means are different. The half normal case works only when μ1=μ2 so that the difference has mean 0.
Dilip Sarwate

Thank you for your comments. Now I revised my answer based on your comments and whuber's answer.
yuqian
Durch die Nutzung unserer Website bestätigen Sie, dass Sie unsere Cookie-Richtlinie und Datenschutzrichtlinie gelesen und verstanden haben.
Licensed under cc by-sa 3.0 with attribution required.