Code Monkey home page Code Monkey logo

Comments (3)

ljwolf avatar ljwolf commented on September 26, 2024

Great question, @iki77!

I think the choice of package really just comes down to the choice of method you want to employ.

mgwr: effects can be different in different places

The mgwr package is solely focused on the estimation of "geographically-weighted regression" models. At a high level, these models fit individual regressions at each site in your data. Think of it like the local model only pays attention to the data that is near that site. This means that the estimated effects, like your intercepts and your slopes/betas, can change at every site in the map. This could mean that an estimated effect of, say, age on earnings is positive in some places, but negative in others.

The mgwr package provides methods to identify what should be considered "near" for the local models to pay attention to (Sel_Bw classes), and also methods to estimate the local models once that has been determined (GWR and MGWR classes). The difference between GWR and MGWR is whether each variable, sometimes called a "smooth", is given its own definition of "near", or bandwidth. The MGWR model can use a different bandwidth for each variable, whereas the GWR model uses the same bandwidth for all variables. (you can also have some variables which are not included in the "local" specification, and must have the same values everywhere).

Some good written examples/discussions are with Oshan et al. (2019), who provides some code and explanation of the entire package or Comber et al (forthcoming), who provides some thinking as to why/how to choose between different specifications.

spreg: Don't model sites separately, since they interact

The spreg package is focused on the estimation of a few different kinds of models. These models, generally, are not MGWR-style models, and they "pay attention" to the entire map. However, their unique trait is generally that there is a spatial effect in play. For example, spatial dependence is a very common spatial effect. By spatial dependence, we generally mean that you cannot assume that sites are independent of one another. A classic example is the sales price of a house: if my house sells for a lot of money, my neighbor's house might increase in value, too, since it will be priced relative to mine.

The name of this kind of specification (at least that considered in spreg) is a simultaneous autoregressive model (SAR model). When dependence is present in the outcome (y term) it is often called a "Spatial Lag" model (e.g. the ML_Lag or GM_Lag class), and when spatial dependence is present in the error term it is often called a "Spatial Error model" (e.g. the ML_Error or GM_Error classes).

spreg also contains methods to deal with cases where your variance isn't the same across the map (some regions may have more variation than others, sometimes called spatial heteroskedasticity) and also cases where there are specific, known regions with different behavior (sometimes called "regime" models). Some good intros include the chapter in @sjsrey, @darribas, and my forthcoming book, as well as the book by Anselin & Rey.

from mgwr.

ljwolf avatar ljwolf commented on September 26, 2024

I should also say, deciding what model to use will depend on the question you're seeking to answer, and that question generally will implicate one of these sets of methods! GWR models are all about the fact that your estimated relationships can change smoothly over space. spreg models are more diverse, but generally are useful when you're just interested in the classic linear regression models, but spatial interaction or structure is getting "in the way," so to speak.

from mgwr.

iki77 avatar iki77 commented on September 26, 2024

Thanks for the explanation @ljwolf
It's easy to understand

from mgwr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.