Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm looking for some package in R to estimate the value of a variable by moving window regression. I have read in Local Models for Spatial Analysis, which is a good method to predict values ​​at unsampled locations. A very similar case is mentioned in the book,PRISM. I've been reading various R packages, but have not found anything about MWR, GWR only. Anyone know if there is another way of naming or GWR can be adapted to function as MWR?

Thanks

Text from book -> Local Models for Spatial Analysis

share|improve this question
add comment

1 Answer

I don't see any equations in the section in Lloyd that you linked to, but it seems from the description that MWR is similar to GWR except that it's on a grid (always, or just in this example?), and that it always uses a fixed bandwidth and a fixed or inverse-distance weighted kernel. If this is correct, I think you can accomplish what you want by using GWR and specifying the weighting function yourself instead of using the built-in functions (gwr.gauss, gwr. bilinear).

In the gwr function call, set the bandwidth argument to the desired radius of the moving window, in the units of your spatial object (will depend on the projection), and set the gweight argument as follows:

gwr(..., gweight = function(a, b) 1, ...)

This function will return a weight of 1 for all point pairs in the local regressions, which is the simplest version described in source you linked to. (Note that a and b are arbitrary parameter names, internally gwr uses dxs for the first (distance) parameter and bandwidthR2 for the second (bandwidth) parameter.) Make sure to specify the fit.points argument using a SpatialPointsDataFrame (or other object of xy coordinates) of the points that you want to predict. If your data is gridded, you will also have to convert to a SpatialPointsDataFrame for the data argument. This can be accomplished with:

gridded(yourGrid) = FALSE

This works for SpatialGridDataFrame or SpatialPixelsDataFrame, you may have to do something different if you're using the raster package.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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