Distribution of sum of independent exponentials with random number…
Clash Royale CLAN TAG#URR8PPP
Let $tau_isimexpleft(lambdaright)$ be independent and identically distributed exponentials with parameter $lambda$. Then, for given $n$, the sum of these values
$$T_n := sum_{i=0}^n tau_i$$
follows an ErlangDistribution with probability density function
$$pi(T_n=T n,lambda)={lambda^n T^{n1} e^{lambda T} over (n1)!}quadmbox{for }T, lambda geq 0.$$
I am interested in the distribution of $T_tilde n$ where $tilde n$ is a random variable such that for $tau_a sim exp(lambda_a)$ exponentially distributed, it holds that
$$T_tilde n leq tau_a \T_{tilde{n}+1} > tau_a.$$
In other words, $T_{tilde n}$ is truncated by an exponential distribution. I fail in deriving the distribution of $tilde n$ but maybe there is an easier way:
$$pileft(tilde n = kright) = pileft(T_n < tau_an=kright)\
=1intlimits_{mathbb{R}^+}sumlimits_{n=0}^{k1}frac{1}{n!}expleft((lambda+lambda_a)tau_aright)(taulambda_a)^nlambda_adtau_a.$$
However, just sampling and eyeballing looks to me like this density isn’t that ugly:
iter < 20000
lambda_a < 1
lambda < 2
df < data.frame(tau=rep(NA, iter), a=rep(NA, iter))
for(i in 1:iter){
set.seed(i)
a < rexp(1, rate = lambda_a)
s < cumsum(rexp(500, rate = lambda))
df[i,] < c(max(s[1], s[s<a]), a)
}
library(tidyverse)
ggplot(df %>% gather(), aes(x = value, fill = key)) +
geom_density(alpha = .3) + theme_bw()
$endgroup$
add a comment 
Let $tau_isimexpleft(lambdaright)$ be independent and identically distributed exponentials with parameter $lambda$. Then, for given $n$, the sum of these values
$$T_n := sum_{i=0}^n tau_i$$
follows an ErlangDistribution with probability density function
$$pi(T_n=T n,lambda)={lambda^n T^{n1} e^{lambda T} over (n1)!}quadmbox{for }T, lambda geq 0.$$
I am interested in the distribution of $T_tilde n$ where $tilde n$ is a random variable such that for $tau_a sim exp(lambda_a)$ exponentially distributed, it holds that
$$T_tilde n leq tau_a \T_{tilde{n}+1} > tau_a.$$
In other words, $T_{tilde n}$ is truncated by an exponential distribution. I fail in deriving the distribution of $tilde n$ but maybe there is an easier way:
$$pileft(tilde n = kright) = pileft(T_n < tau_an=kright)\
=1intlimits_{mathbb{R}^+}sumlimits_{n=0}^{k1}frac{1}{n!}expleft((lambda+lambda_a)tau_aright)(taulambda_a)^nlambda_adtau_a.$$
However, just sampling and eyeballing looks to me like this density isn’t that ugly:
iter < 20000
lambda_a < 1
lambda < 2
df < data.frame(tau=rep(NA, iter), a=rep(NA, iter))
for(i in 1:iter){
set.seed(i)
a < rexp(1, rate = lambda_a)
s < cumsum(rexp(500, rate = lambda))
df[i,] < c(max(s[1], s[s<a]), a)
}
library(tidyverse)
ggplot(df %>% gather(), aes(x = value, fill = key)) +
geom_density(alpha = .3) + theme_bw()
$endgroup$

1$begingroup$
I would recommend not using the same notation for both $tau_i$ and the sum $tau_n$.
$endgroup$
– ukemi
4 hours ago
add a comment 
Let $tau_isimexpleft(lambdaright)$ be independent and identically distributed exponentials with parameter $lambda$. Then, for given $n$, the sum of these values
$$T_n := sum_{i=0}^n tau_i$$
follows an ErlangDistribution with probability density function
$$pi(T_n=T n,lambda)={lambda^n T^{n1} e^{lambda T} over (n1)!}quadmbox{for }T, lambda geq 0.$$
I am interested in the distribution of $T_tilde n$ where $tilde n$ is a random variable such that for $tau_a sim exp(lambda_a)$ exponentially distributed, it holds that
$$T_tilde n leq tau_a \T_{tilde{n}+1} > tau_a.$$
In other words, $T_{tilde n}$ is truncated by an exponential distribution. I fail in deriving the distribution of $tilde n$ but maybe there is an easier way:
$$pileft(tilde n = kright) = pileft(T_n < tau_an=kright)\
=1intlimits_{mathbb{R}^+}sumlimits_{n=0}^{k1}frac{1}{n!}expleft((lambda+lambda_a)tau_aright)(taulambda_a)^nlambda_adtau_a.$$
However, just sampling and eyeballing looks to me like this density isn’t that ugly:
iter < 20000
lambda_a < 1
lambda < 2
df < data.frame(tau=rep(NA, iter), a=rep(NA, iter))
for(i in 1:iter){
set.seed(i)
a < rexp(1, rate = lambda_a)
s < cumsum(rexp(500, rate = lambda))
df[i,] < c(max(s[1], s[s<a]), a)
}
library(tidyverse)
ggplot(df %>% gather(), aes(x = value, fill = key)) +
geom_density(alpha = .3) + theme_bw()
$endgroup$
Let $tau_isimexpleft(lambdaright)$ be independent and identically distributed exponentials with parameter $lambda$. Then, for given $n$, the sum of these values
$$T_n := sum_{i=0}^n tau_i$$
follows an ErlangDistribution with probability density function
$$pi(T_n=T n,lambda)={lambda^n T^{n1} e^{lambda T} over (n1)!}quadmbox{for }T, lambda geq 0.$$
I am interested in the distribution of $T_tilde n$ where $tilde n$ is a random variable such that for $tau_a sim exp(lambda_a)$ exponentially distributed, it holds that
$$T_tilde n leq tau_a \T_{tilde{n}+1} > tau_a.$$
In other words, $T_{tilde n}$ is truncated by an exponential distribution. I fail in deriving the distribution of $tilde n$ but maybe there is an easier way:
$$pileft(tilde n = kright) = pileft(T_n < tau_an=kright)\
=1intlimits_{mathbb{R}^+}sumlimits_{n=0}^{k1}frac{1}{n!}expleft((lambda+lambda_a)tau_aright)(taulambda_a)^nlambda_adtau_a.$$
However, just sampling and eyeballing looks to me like this density isn’t that ugly:
iter < 20000
lambda_a < 1
lambda < 2
df < data.frame(tau=rep(NA, iter), a=rep(NA, iter))
for(i in 1:iter){
set.seed(i)
a < rexp(1, rate = lambda_a)
s < cumsum(rexp(500, rate = lambda))
df[i,] < c(max(s[1], s[s<a]), a)
}
library(tidyverse)
ggplot(df %>% gather(), aes(x = value, fill = key)) +
geom_density(alpha = .3) + theme_bw()

1$begingroup$
I would recommend not using the same notation for both $tau_i$ and the sum $tau_n$.
$endgroup$
– ukemi
4 hours ago
add a comment 

1$begingroup$
I would recommend not using the same notation for both $tau_i$ and the sum $tau_n$.
$endgroup$
– ukemi
4 hours ago
I would recommend not using the same notation for both $tau_i$ and the sum $tau_n$.
$endgroup$
– ukemi
4 hours ago
I would recommend not using the same notation for both $tau_i$ and the sum $tau_n$.
$endgroup$
– ukemi
4 hours ago
add a comment 
1 Answer
1
active
oldest
votes
As detailed in this X validated answer, waiting for a sum of iid exponential $mathcal E(lambda)$ variates to exceed one produces an Poisson $mathcal P(lambda)$ variate $N$. Hence waiting for a sum of iid exponential $mathcal E(lambda)$ variates to exceed $tau_a$ produces an Poisson $mathcal P(tau_alambda)$ variate $N$, conditional on $tau_a$. Therefore
begin{align*}
mathbb P(N=n)&=int_0^infty mathbb P(N=ntau_a) ,lambda_a e^{lambda_atau_a},text{d}tau_a\
&= int_0^infty dfrac{(lambdatau_a)^n}{n!},e^{tau_alambda} ,lambda_a e^{lambda_atau_a},text{d}tau_a\
&=dfrac{lambda_alambda^n}{n!},int_0^infty tau_a^n,e^{tau_a(lambda+lambda_a)} ,text{d}tau_a\
&=dfrac{lambda_alambda^n}{n!},dfrac{Gamma(n+1)}{(lambda_a+lambda)^{n+1}}=dfrac{lambda_alambda^n}{(lambda_a+lambda)^{n+1}}
end{align*}
which is a Geometric $mathcal G(lambda_a/{lambda_a+lambda})$ random variable.
Considering now the distribution of$$zeta=sum_{i=1}^N tau_i$$the moment generating function of $zeta$ is
$$mathbb E[e^{zzeta}]=mathbb E[e^{z{tau_1+cdots+tau_N}}]=mathbb E^N[mathbb E^{tau_1}[e^{ztau_1}]^N]=E^N[{lambda/(lambdaz)}^N]=E^N[e^{N(ln lambdaln (lambdaz))}]$$and the mgf of a Geometric $mathcal G(p)$ variate is
$$varphi_N(z)=dfrac{pe^z}{1(1p)e^z}$$Hence the moment generating function of $zeta$ is $$dfrac{pe^{ln lambdaln (lambdaz)}}{1(1(lambda_a/{lambda_a+lambda}))e^{ln lambdaln (lambdaz)}}=dfrac{p lambda}{ lambdazlambda^2/{lambda_a+lambda}}$$
modulo typing mistakes
$endgroup$

$begingroup$
Thanks a lot @Xi’an! Do I get it right that in your notation $p= lambda_a/(lambda_a+lambda)$ ? Because then the moment generating function in the last line is equivalent to $frac{1}{1zleft(plambdaright)^{1}}$ which corresponds to the MGF of an exponential distribution..
$endgroup$
– muffin1974
2 hours ago
add a comment 
Your Answer
StackExchange.ifUsing(“editor”, function () {
return StackExchange.using(“mathjaxEditing”, function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [[“$”, “$”], [“\\(“,”\\)”]]);
});
});
}, “mathjaxediting”);
StackExchange.ready(function() {
var channelOptions = {
tags: “”.split(” “),
id: “65”
};
initTagRenderer(“”.split(” “), “”.split(” “), channelOptions);
StackExchange.using(“externalEditor”, function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using(“snippets”, function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: ‘answer’,
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: “”,
imageUploader: {
brandingHtml: “Powered by u003ca class=”iconimgurwhite” href=”https://imgur.com/”u003eu003c/au003e”,
contentPolicyHtml: “User contributions licensed under u003ca href=”https://creativecommons.org/licenses/bysa/3.0/”u003ecc bysa 3.0 with attribution requiredu003c/au003e u003ca href=”https://stackoverflow.com/legal/contentpolicy”u003e(content policy)u003c/au003e”,
allowUrls: true
},
onDemand: true,
discardSelector: “.discardanswer”
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave(‘#loginlink’);
});
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin(‘.newpostlogin’, ‘https%3a%2f%2fstats.stackexchange.com%2fquestions%2f393832%2fdistributionofsumofindependentexponentialswithrandomnumberofsummands%23newanswer’, ‘question_page’);
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
As detailed in this X validated answer, waiting for a sum of iid exponential $mathcal E(lambda)$ variates to exceed one produces an Poisson $mathcal P(lambda)$ variate $N$. Hence waiting for a sum of iid exponential $mathcal E(lambda)$ variates to exceed $tau_a$ produces an Poisson $mathcal P(tau_alambda)$ variate $N$, conditional on $tau_a$. Therefore
begin{align*}
mathbb P(N=n)&=int_0^infty mathbb P(N=ntau_a) ,lambda_a e^{lambda_atau_a},text{d}tau_a\
&= int_0^infty dfrac{(lambdatau_a)^n}{n!},e^{tau_alambda} ,lambda_a e^{lambda_atau_a},text{d}tau_a\
&=dfrac{lambda_alambda^n}{n!},int_0^infty tau_a^n,e^{tau_a(lambda+lambda_a)} ,text{d}tau_a\
&=dfrac{lambda_alambda^n}{n!},dfrac{Gamma(n+1)}{(lambda_a+lambda)^{n+1}}=dfrac{lambda_alambda^n}{(lambda_a+lambda)^{n+1}}
end{align*}
which is a Geometric $mathcal G(lambda_a/{lambda_a+lambda})$ random variable.
Considering now the distribution of$$zeta=sum_{i=1}^N tau_i$$the moment generating function of $zeta$ is
$$mathbb E[e^{zzeta}]=mathbb E[e^{z{tau_1+cdots+tau_N}}]=mathbb E^N[mathbb E^{tau_1}[e^{ztau_1}]^N]=E^N[{lambda/(lambdaz)}^N]=E^N[e^{N(ln lambdaln (lambdaz))}]$$and the mgf of a Geometric $mathcal G(p)$ variate is
$$varphi_N(z)=dfrac{pe^z}{1(1p)e^z}$$Hence the moment generating function of $zeta$ is $$dfrac{pe^{ln lambdaln (lambdaz)}}{1(1(lambda_a/{lambda_a+lambda}))e^{ln lambdaln (lambdaz)}}=dfrac{p lambda}{ lambdazlambda^2/{lambda_a+lambda}}$$
modulo typing mistakes
$endgroup$

$begingroup$
Thanks a lot @Xi’an! Do I get it right that in your notation $p= lambda_a/(lambda_a+lambda)$ ? Because then the moment generating function in the last line is equivalent to $frac{1}{1zleft(plambdaright)^{1}}$ which corresponds to the MGF of an exponential distribution..
$endgroup$
– muffin1974
2 hours ago
add a comment 
As detailed in this X validated answer, waiting for a sum of iid exponential $mathcal E(lambda)$ variates to exceed one produces an Poisson $mathcal P(lambda)$ variate $N$. Hence waiting for a sum of iid exponential $mathcal E(lambda)$ variates to exceed $tau_a$ produces an Poisson $mathcal P(tau_alambda)$ variate $N$, conditional on $tau_a$. Therefore
begin{align*}
mathbb P(N=n)&=int_0^infty mathbb P(N=ntau_a) ,lambda_a e^{lambda_atau_a},text{d}tau_a\
&= int_0^infty dfrac{(lambdatau_a)^n}{n!},e^{tau_alambda} ,lambda_a e^{lambda_atau_a},text{d}tau_a\
&=dfrac{lambda_alambda^n}{n!},int_0^infty tau_a^n,e^{tau_a(lambda+lambda_a)} ,text{d}tau_a\
&=dfrac{lambda_alambda^n}{n!},dfrac{Gamma(n+1)}{(lambda_a+lambda)^{n+1}}=dfrac{lambda_alambda^n}{(lambda_a+lambda)^{n+1}}
end{align*}
which is a Geometric $mathcal G(lambda_a/{lambda_a+lambda})$ random variable.
Considering now the distribution of$$zeta=sum_{i=1}^N tau_i$$the moment generating function of $zeta$ is
$$mathbb E[e^{zzeta}]=mathbb E[e^{z{tau_1+cdots+tau_N}}]=mathbb E^N[mathbb E^{tau_1}[e^{ztau_1}]^N]=E^N[{lambda/(lambdaz)}^N]=E^N[e^{N(ln lambdaln (lambdaz))}]$$and the mgf of a Geometric $mathcal G(p)$ variate is
$$varphi_N(z)=dfrac{pe^z}{1(1p)e^z}$$Hence the moment generating function of $zeta$ is $$dfrac{pe^{ln lambdaln (lambdaz)}}{1(1(lambda_a/{lambda_a+lambda}))e^{ln lambdaln (lambdaz)}}=dfrac{p lambda}{ lambdazlambda^2/{lambda_a+lambda}}$$
modulo typing mistakes
$endgroup$

$begingroup$
Thanks a lot @Xi’an! Do I get it right that in your notation $p= lambda_a/(lambda_a+lambda)$ ? Because then the moment generating function in the last line is equivalent to $frac{1}{1zleft(plambdaright)^{1}}$ which corresponds to the MGF of an exponential distribution..
$endgroup$
– muffin1974
2 hours ago
add a comment 
As detailed in this X validated answer, waiting for a sum of iid exponential $mathcal E(lambda)$ variates to exceed one produces an Poisson $mathcal P(lambda)$ variate $N$. Hence waiting for a sum of iid exponential $mathcal E(lambda)$ variates to exceed $tau_a$ produces an Poisson $mathcal P(tau_alambda)$ variate $N$, conditional on $tau_a$. Therefore
begin{align*}
mathbb P(N=n)&=int_0^infty mathbb P(N=ntau_a) ,lambda_a e^{lambda_atau_a},text{d}tau_a\
&= int_0^infty dfrac{(lambdatau_a)^n}{n!},e^{tau_alambda} ,lambda_a e^{lambda_atau_a},text{d}tau_a\
&=dfrac{lambda_alambda^n}{n!},int_0^infty tau_a^n,e^{tau_a(lambda+lambda_a)} ,text{d}tau_a\
&=dfrac{lambda_alambda^n}{n!},dfrac{Gamma(n+1)}{(lambda_a+lambda)^{n+1}}=dfrac{lambda_alambda^n}{(lambda_a+lambda)^{n+1}}
end{align*}
which is a Geometric $mathcal G(lambda_a/{lambda_a+lambda})$ random variable.
Considering now the distribution of$$zeta=sum_{i=1}^N tau_i$$the moment generating function of $zeta$ is
$$mathbb E[e^{zzeta}]=mathbb E[e^{z{tau_1+cdots+tau_N}}]=mathbb E^N[mathbb E^{tau_1}[e^{ztau_1}]^N]=E^N[{lambda/(lambdaz)}^N]=E^N[e^{N(ln lambdaln (lambdaz))}]$$and the mgf of a Geometric $mathcal G(p)$ variate is
$$varphi_N(z)=dfrac{pe^z}{1(1p)e^z}$$Hence the moment generating function of $zeta$ is $$dfrac{pe^{ln lambdaln (lambdaz)}}{1(1(lambda_a/{lambda_a+lambda}))e^{ln lambdaln (lambdaz)}}=dfrac{p lambda}{ lambdazlambda^2/{lambda_a+lambda}}$$
modulo typing mistakes
$endgroup$
As detailed in this X validated answer, waiting for a sum of iid exponential $mathcal E(lambda)$ variates to exceed one produces an Poisson $mathcal P(lambda)$ variate $N$. Hence waiting for a sum of iid exponential $mathcal E(lambda)$ variates to exceed $tau_a$ produces an Poisson $mathcal P(tau_alambda)$ variate $N$, conditional on $tau_a$. Therefore
begin{align*}
mathbb P(N=n)&=int_0^infty mathbb P(N=ntau_a) ,lambda_a e^{lambda_atau_a},text{d}tau_a\
&= int_0^infty dfrac{(lambdatau_a)^n}{n!},e^{tau_alambda} ,lambda_a e^{lambda_atau_a},text{d}tau_a\
&=dfrac{lambda_alambda^n}{n!},int_0^infty tau_a^n,e^{tau_a(lambda+lambda_a)} ,text{d}tau_a\
&=dfrac{lambda_alambda^n}{n!},dfrac{Gamma(n+1)}{(lambda_a+lambda)^{n+1}}=dfrac{lambda_alambda^n}{(lambda_a+lambda)^{n+1}}
end{align*}
which is a Geometric $mathcal G(lambda_a/{lambda_a+lambda})$ random variable.
Considering now the distribution of$$zeta=sum_{i=1}^N tau_i$$the moment generating function of $zeta$ is
$$mathbb E[e^{zzeta}]=mathbb E[e^{z{tau_1+cdots+tau_N}}]=mathbb E^N[mathbb E^{tau_1}[e^{ztau_1}]^N]=E^N[{lambda/(lambdaz)}^N]=E^N[e^{N(ln lambdaln (lambdaz))}]$$and the mgf of a Geometric $mathcal G(p)$ variate is
$$varphi_N(z)=dfrac{pe^z}{1(1p)e^z}$$Hence the moment generating function of $zeta$ is $$dfrac{pe^{ln lambdaln (lambdaz)}}{1(1(lambda_a/{lambda_a+lambda}))e^{ln lambdaln (lambdaz)}}=dfrac{p lambda}{ lambdazlambda^2/{lambda_a+lambda}}$$
modulo typing mistakes

$begingroup$
Thanks a lot @Xi’an! Do I get it right that in your notation $p= lambda_a/(lambda_a+lambda)$ ? Because then the moment generating function in the last line is equivalent to $frac{1}{1zleft(plambdaright)^{1}}$ which corresponds to the MGF of an exponential distribution..
$endgroup$
– muffin1974
2 hours ago
add a comment 

$begingroup$
Thanks a lot @Xi’an! Do I get it right that in your notation $p= lambda_a/(lambda_a+lambda)$ ? Because then the moment generating function in the last line is equivalent to $frac{1}{1zleft(plambdaright)^{1}}$ which corresponds to the MGF of an exponential distribution..
$endgroup$
– muffin1974
2 hours ago
Thanks a lot @Xi’an! Do I get it right that in your notation $p= lambda_a/(lambda_a+lambda)$ ? Because then the moment generating function in the last line is equivalent to $frac{1}{1zleft(plambdaright)^{1}}$ which corresponds to the MGF of an exponential distribution..
$endgroup$
– muffin1974
2 hours ago
Thanks a lot @Xi’an! Do I get it right that in your notation $p= lambda_a/(lambda_a+lambda)$ ? Because then the moment generating function in the last line is equivalent to $frac{1}{1zleft(plambdaright)^{1}}$ which corresponds to the MGF of an exponential distribution..
$endgroup$
– muffin1974
2 hours ago
add a comment 
Thanks for contributing an answer to Cross Validated!
 Please be sure to answer the question. Provide details and share your research!
But avoid …
 Asking for help, clarification, or responding to other answers.
 Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave(‘#loginlink’);
});
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin(‘.newpostlogin’, ‘https%3a%2f%2fstats.stackexchange.com%2fquestions%2f393832%2fdistributionofsumofindependentexponentialswithrandomnumberofsummands%23newanswer’, ‘question_page’);
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave(‘#loginlink’);
});
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave(‘#loginlink’);
});
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave(‘#loginlink’);
});
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
I would recommend not using the same notation for both $tau_i$ and the sum $tau_n$.
$endgroup$
– ukemi
4 hours ago