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:
library(terra)
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 <- 0.8
e <- 7.9
I need to calculate uncertainty based on varying c
and e
by varying both variables as below:
+/- 10
for c
+/-
4 for e
values need to change independently. In the end, I need to plot an uncertainty map.
z
givenc
ande
and then loop over random realisations of those, keeping stats. Although sincez
is pretty simply defined you can probably work out E(z) and Var(z) given some distribution ofc
ande
with the tiniest bit of statistical theory and avoid the Monte-Carlo.c
ande
do you have? Are theyUniform
between those limits? Or Normally distributed with mean 0 and given SD? Are they independent or correlated?-Inf, +Inf
, so you should edit your question and say what the variance or standard deviation of the quantities are.