# Mean and variance of a Random Walk with lower boundary

Consider a random walk $$S_n$$ that starts at $$S_0$$ and terminates if it hits a lower boundary of $$0$$.

$$S_n=\begin{cases} 0, & \text{if } S_{n-1}=0\\ 0, & \text{if } S_{n-1}+x_n\le0\\ S_{n-1}+x_n, & \text{otherwise} \end{cases}$$ $$n=1,2,3,..$$ $$x_i \text{ are i.i.d. with } x_i \sim N[\mu,\sigma^2]$$

what are $$E[S_n]$$ $$\text{VAR}[S_n]$$

as a function of $$S_0, \mu, \sigma^2 \text{ ?}$$

• Are the $x_i$ IID? Jan 9 '20 at 19:12
• @NapD.Lover yes! thanks for the clarification - I added it to question. Jan 9 '20 at 19:44

## 1 Answer

The random walk can be written as $$S_n=Y_n^+$$ where $$Y_n=S_0+X_1+\dotso +X_n$$, the $$X_i$$ are IID $$\mathcal{N}(\mu, \sigma^2)$$ RVs, and $$S_0>0$$ some positive number and where $$x^+=x \vee 0=\max\{x, 0\}$$ is the positive part of $$x$$. At least this holds up until the first time $$k$$ where $$Y_k\leq 0$$, afterwards, $$S_n=Y_k^+=0$$ for all $$n\geq k$$.

With that in mind, conditional on $$Y_n \leq 0$$, we have $$S_n=0$$ hence $$\mathbb{E}(S_n|Y_n \leq 0)=0$$. Thus, by the law of total probability $$\mathbb{E}(S_n)=\mathbb{E}(S_n | Y_n >0)P(Y_n>0).$$

Now since on the event $$Y_n>0$$ we have $$S_n= Y_n=S_0+X_1+\dotsc +X_n,$$ and the conditional expectation is linear, we get $$\mathbb{E}(S_n|Y_n>0)=S_0+n\mu$$. All that is left is to compute $$\mathbb{P}(Y_n>0)=1-\mathbb{P}(Y_n\leq 0)$$ $$=1-\mathbb{P}\left(Z_n \leq \frac{-S_0-n\mu}{\sigma \sqrt{n}} \right),$$ where $$Z_n \sim \mathcal{N}(0,1)$$ is a standard normal RV. We have used the fact that IID sums of normal RVs are again normally distributed and then standardized by the new mean and standard deviation. All together, $$\mathbb{E}(S_n)=(S_0+n\mu) \left[1-\Phi \left( \frac{-S_0-n\mu}{\sigma \sqrt{n}}\right) \right].$$ A similar argument should be able to compute the variance, or perhaps via the law of total variance. I'll attempt to add it later if you have trouble but I'm out of free time right now. If something is unclear or mistaken please comment!

Here is some R-code I quickly drafted to verify this numerically. For $$n=50$$ steps with $$\mu=3$$, $$\sigma=4$$ and $$S_0=10$$, the last run obtained sample mean $$158.8442$$ (estimated from $$N=5000$$ simulations of the walk ending $$S_{50}$$) and exact value $$160$$.

n <- 50 # number of steps in random walk
N <- 5000 # number of simulations of the RW
mu <- 3 # given mean
volat <- 4 # given volatility
s0 <- 10 # initial localtion
tails <- matrix(0, nrow = N)
for(i in 1:N)
{
s <- matrix(0, nrow = n+1)
s[1] <- s0
for(j in 2:(n+1))
{
if(s[j-1] >0 )
{
s[j] <- s[j-1]+rnorm(1, mu, volat)
}
s[j] <- pmax(s[j], 0)
}
tails[i] <- s[n+1]
}
est <- data.frame(approx = mean(tails), exact = (s0+mu*n)*(1-pnorm((-s0-n*mu)/(volat*sqrt(n)))))
print(est)
par(mfrow = c(2, 1))
plot(s, type = "l")
plot(tails, type = "l")

• @nap-d-lover thanks for your help! Unfortunately your formula seems to diverge from reality when σ ≫ μ 😔. With n=50, s0=10, mu=1, volat=5, I get approx=47, exact=57. It's not a sampling problem. I tested it with N=1 million simulations and also implemented it in Python and C. Identical results approx=47, exact=57. I am not sure where the flaw in your reasoning is. I suspect it is that 𝑃(𝑌𝑛>0) erroneously includes the cases where 𝑌𝑘 has gone below zero for some 𝑘<𝑛 before getting back up to 𝑌𝑛>0. These case are indeed more common when σ ≫ μ. Jan 11 '20 at 8:32
• @elemolotiv I will try to fix this and write an edit today if I can work something out. I suspect your hunch is correct so if I can’t work out a better answer I’ll edit this to say it holds for when $\sigma$ is not too large relative to $\mu$. Thank you for checking carefully different $\mu$ and $\sigma$ and for larger samples and multiple implementations. Jan 11 '20 at 17:19