Skip to content
All library documents

Monte Carlo Present Value: Expected Value and the Law of Large Numbers

Article Quant Q&A · Author: Jorisdrees

Summary

The example estimates a future capital value by sampling an annual rate and an initial capital independently from uniform distributions, then applying compound growth over a fixed number of periods. It clarifies that repeating this simulation and averaging the outcomes illustrates the law of large numbers: the sample average tends toward the model's expected value. This is distinct from the central limit theorem, which concerns the distribution of sample averages under suitable conditions.

Because the inputs are specified and independent, the expected value can also be calculated analytically by multiplying the mean capital by the expected growth factor. For the stated two-period setup, the answer gives an expected value of about 856.82, close to the simulation's mean. It recommends setting a random seed for reproducibility and notes that a replicate-style approach can simplify the code. The result depends on the assumed input distributions, independence, and fixed horizon; it does not establish that those assumptions fit a real investment.

Key ideas

  • Repeated simulated outcomes illustrate the law of large numbers, rather than directly applying the central limit theorem.
  • Under independence, expected capital can be multiplied by the expected compound growth factor.
  • The specified uniform assumptions permit an analytical expected value for comparison with simulation.
  • A random seed makes simulation results reproducible.
  • The estimate is only as realistic as its assumed distributions and independence.

Tags

Full text
# Basic Monte Carlo Present value calculation in R question


# Basic Monte Carlo Present value calculation in R question












I'm self studying monte carlo applications with the application towards present values.

However the values that I am using are of the uniform distribution variety with a pre defined minimum and maximum value.

I'm trying to apply the central limit theorem to it so it should approximate a normal distribution giving me the values that are more likely than others.

Now i'm having some difficulties applying the CLT to my current set up.

```
#Empty variable to store the list in
results = NULL 

#loop 
for(i in 1:1000){
  #rate  between 1% and 20%
  r <- runif(1, 0.01, 0.2)

  #expected capital return
  k <- runif(1, 500, 900)

  #periods
  p <- 2

  #do the actual calculation
  pv <- k * (1 + r)^p 

  #Store the calculation
  results <- rbind(results, pv)
}

histogram <- hist(results)
plot(histogram)
summary <- summary(results)
print(summary)
standarddeviation <- sd(results)
print(standarddeviation)

165.108

       V1        
 Min.   : 512.2  
 1st Qu.: 727.8  
 Median : 848.8  
 Mean   : 856.8  
 3rd Qu.: 974.8  
 Max.   :1292.6
```

So what I take from this is that the mean is 856.8 and this is what the project currently would be worth investing for to me more or less.

I am wondering if my methodology and reasoning is correct because I feel I might have gone off the deep end.

## Answer by Cettt (score 2, accepted)

https://quant.stackexchange.com/a/49776

what you are doing is not really an application of the central limit theorem (CLT) but rather an application of the law of large numbers. If I understood your problem correctly you start with the following information:

- The future discounting rate has a uniform distribution: $r \sim U(1\%, 20\%)$.

- The future capital has a uniform distribution: $k \sim U(500, 900)$.

- $r$ and $k$ are independent.

From this you can easy calculate the "true" expected present value: \begin{align} \mathbb{E}[pv] &= \mathbb{E}[k \cdot (1+r)^p] = \mathbb{E}[k] \cdot \mathbb{E}[(1+r)^p] \\[2mm] &= 700 \cdot \int_{0.01}^{0.2} (1+x)^p \frac {1}{0.2 - 0.01} \; dx \\[2mm] &= 700 \cdot \frac{1.2^{p+1} - 1.01^{p+1}}{0.19 \cdot (p+1)}. \end{align}

For $p = 2$ you get that $\mathbb{E}[pv] = 856.8233$.

Your code shows that the law of large numbers works: if you repeat an experiment often enough than the average results of that experiment will be close to its "true" expected value.

One last comment about the code itself. It is advisable to use random seeds in R when working with random numbers. This can be achieved using the `set.seed` function. By setting a random seed you make your results reproducible. Also you can use `replicate` instead of a for loop to make your code more readable:

```
my_pv <- function(p){

  r <- runif(1, 0.01, 0.2)
  k <- runif(1, 500, 900)

  return(k * (1 + r)^p) 
}

set.seed(1234)
result <- replicate(1000, my_pv(2))
mean(result)
[1] 854.8702
```

Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.