Needing help with Exp() raster calculation (logistic regression)

5160
5
Jump to solution
07-11-2014 06:17 AM
RyanDrum
New Contributor

This is driving me mad. Thanks in advance for any help...

I am attempting to run a wildlife habitat logistic regression (occupancy) model. Every time I run this raster calculation, I am getting a grid of all zeros.

To identify where the problem lies, I attempted to run the equation in pieces and each component works and produces a reasonable result, but when I run as a whole (or even half of the equation, including the Exp()) I get all zeros.

The logistic regression equation I'm trying to run in raster calculator is as follows:

Exp(-4.3302 + ("twozone" * 1.8943) + ("cbd_m19" * 0.4387) + ("tpa_sd19" * -0.6858) + ("cbh_m19" * 4.4809) + ("cbh2_m19" * -1.4897) + ("aspsum1900std" * 0.5847) + ("XXXstd" * 0.6900) + ("YYYstd" * 1.3998) + ("xstd_xstd" * -0.6346) + ("ystd_ystd" * -0.04634) + ("xstd_ystd" * -0.6392)) / (1 + Exp(-4.3302 + ("twozone" * 1.8943) + ("cbd_m19" * 0.4387) + ("tpa_sd19" * -0.6858) + ("cbh_m19" * 4.4809) + ("cbh2_m19" * -1.4897) + ("aspsum1900std" * 0.5847) + ("XXXstd" * 0.6900) + ("YYYstd" * 1.3998) + ("xstd_xstd" * -0.6346) + ("ystd_ystd" * -0.04634) + ("xstd_ystd" * -0.6392)))

The first part of the equation, as follows, runs fine and produces a reasonable grid with a range of values

(-4.3302 + ("twozone" * 1.8943) + ("cbd_m19" * 0.4387) + ("tpa_sd19" * -0.6858) + ("cbh_m19" * 4.4809) + ("cbh2_m19" * -1.4897) + ("aspsum1900std" * 0.5847) + ("XXXstd" * 0.6900) + ("YYYstd" * 1.3998) + ("xstd_xstd" * -0.6346) + ("ystd_ystd" * -0.04634) + ("xstd_ystd" * -0.6392))

But as soon as I add Exp() to encompass this, as follows, I get a grid of all zeros, which doesn't make sense:

Exp((-4.3302 + ("twozone" * 1.8943) + ("cbd_m19" * 0.4387) + ("tpa_sd19" * -0.6858) + ("cbh_m19" * 4.4809) + ("cbh2_m19" * -1.4897) + ("aspsum1900std" * 0.5847) + ("XXXstd" * 0.6900) + ("YYYstd" * 1.3998) + ("xstd_xstd" * -0.6346) + ("ystd_ystd" * -0.04634) + ("xstd_ystd" * -0.6392)))

I tried as a python script as well, with the same result. I've run a lot of these kinds of models and have never had this problem. And the resulting grid is indeed a floating point grid. I am running ArcGIS 10.1.

Thanks for any help.

0 Kudos
1 Solution

Accepted Solutions
DanPatterson_Retired
MVP Emeritus

From the help file, there are only two cautionary notes:

Input values less than or equal to -745 will be set to NoData in the output, because these values cannot be accurately represented by 32-bit floating-point numbers

The larger a negative input value becomes, the closer to 0 the output value will approach.


have you tried to explicitly Float the values within the Exp braces?

View solution in original post

0 Kudos
5 Replies
DanPatterson_Retired
MVP Emeritus

From the help file, there are only two cautionary notes:

Input values less than or equal to -745 will be set to NoData in the output, because these values cannot be accurately represented by 32-bit floating-point numbers

The larger a negative input value becomes, the closer to 0 the output value will approach.


have you tried to explicitly Float the values within the Exp braces?

0 Kudos
RyanDrum
New Contributor

Thank you Dan. I had tried floating everything and got the same result.

However, I went back to check the values of the raster output being applied within the Exp()--the second equation listed above--and found the following range of values:

High: -165.934

Low: -1077.15

Based on what you cite above, I think this is likely causing my problem. I'm attempting to replicate a model developed by a colleague but they had first standardized by subtracting the mean and dividing by the standard deviation values, over the study area, respectively for each grid. My suspicion is that their standardization process inadvertently avoided this issue of low values < -745. So apparently I will have to do the same to get around this problem.

I now need to get the mean and std deviation values for a study area bigger than I am working on (data I don't currently have), so it will be a few days before I can test this. Guessing it will work simply due to the fact that they didn't have this problem.

Thanks again!

0 Kudos
JeffreyEvans
Occasional Contributor III

Because it tends to stabilize the model across parameter space, standardizing your data is a common practice in this type of modeling. It is critical to apply coefficients to the range of model data and not the raw data. In other words, if the original model was standardized, then the coefficients are only applicable to the standardized data. It sounds like you are attempting to apply the coefficients to non-transformed data, which is not valid. As such, it may be prudent to contact the authors to find out exactly how they specified their model.

The term "standardize" can unfortunately refer to multiple data transformations ranging from row standardization [x / max(x)] to centering the data to zero mean and a standard deviation of one, which sounds like what was done. If you can get the mean and sd for each covariate from the authors, then you can just apply a transformation on your subset data rather than having to acquire and calculate them on the full raster data.         

Farah_Tasneem
New Contributor

Hi Ryan,

I am having the same exact problem. Been stuck on this for days. My resulting raster using the logistic regression coefficients is a black image with 0 pixel values. Have you found a solution to this?

Please kindly share.

Thanks,

Farah

0 Kudos
DanPatterson_Retired
MVP Emeritus

I would suggest you start a new question an provide the necessary information about standardization etc... The OP hasn't logged in for a couple of years.

0 Kudos