I have two raster with same resolution and dimension: rainfall (mm) and water-occurrence (%). I want to create a new raster of SLOPE (a) and INTERCEPT (b) by performing linear regression between every 3×3 pixels of the two rasters (rainfall and water-occurrence), such that each pixel of the SLOPE and INTERCEPT will hold the regression slope and intercept value obtained from linear regression of the corresponding 3×3 pixels in rainfall and water-occurrence that surround that pixel.
Is there any example solution using ArcGIS or python/arcpy related above problem?
Example data in the attachment.
how about covariance
will give you some
perhaps if implemented through a sliding/rolling windows approach using a 3x3 kernel.
What would the purpose be for such an analysis given `n` is extremely small?
For the final output, I am would like to have a raster with information on SLOPE, INTERCEPT, and Maximum rainfall threshold that could trigger a flood.
So if I have rainfall forecast in a raster, then I could use above mentioned data to calculate the probability if each pixel will flooded or not.
Now, I am still preparing all the data requirement for that, in the question above I have attached example data (rainfall and percent of water occurrence). As the pixel size is 0.05 deg ~ to 5.6km/pixels and by doing 3x3 or 5x5 group of cells, in my opinion is enough to see the correlation between both data.
Most of extreme rainfall followed by flood event are occurred locally, then 3x3 ~ 282.24 sqkm or 5x5 ~ 784 sqkm is a good start to analyse it.
Do you have any script that ready to use?
I also review some script related to regression written by you and/or Xander Bakker in other thread, but doesn't consider 3x3 or 5x5 neighbour value.
I found similar problem that already answered using R approach: https://gis.stackexchange.com/questions/278979/linear-regression-between-every-3×3-pixels-between-tw...