3

I have been trying to use this expression in the QGIS raster calculator:

1 / (1 + exp(-(β0 + β1 * RasterX1 + β2 * RasterX2 + ... + βn * RasterXn)))

The above expression has been replaced with the relevant coefficients and raster surfaces. However, the expression seems to be invalid. After testing different parts of the expression, it seems that the problematic part of the expression is the "exp", i.e. exponential.

Any solutions? Is there any variation to how the exponential is calculated using the QGIS Raster Calculator?

1 Answer 1

2

I think this can be solved with the ^ opperator. Which can be used like this:

X ^ (Y) would translate to 'X to the power of Y'.

Since the exp() function uses e as the base you can recreate exp() with 2.71828 ^(...). Hence your code can be adapted like the below example.

1 / (1 + 2.71828 ^ (-(β0 + β1 * RasterX1 + β2 * RasterX2 + ... + βn * RasterXn)))
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.