Skip to main content
5 of 6
added 49 characters in body
jmutua
  • 373
  • 1
  • 4
  • 12

Monte Carlo simulation

I have an equation to calculate z from multiplying several rasters and numbers as seen below:

z <- a*b*c*d*e

The raster layers and values are as below:

set.seed(234)
r <- rast(nrows=10, ncols=10)

a <- setValues(r,runif(n = 100, min = 4, max=16))
b <- setValues(r,runif(n = 100, min = 0, max=100))
c <- setValues(r,runif(n = 100, min = 68, max=270))
d <- setValues(r,runif(n = 100, min = 0, max=1))
e <- setValues(r,runif(n = 100, min = 3, max=9))

I need to calculate uncertainty based on varying c and e by generating random rasters from within the minimum and maximum values, and by changing the raster values independently. In the end, I need to plot an uncertainty map.

jmutua
  • 373
  • 1
  • 4
  • 12