Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GWR().predict() method: How are parameters estimated? #124

Open
thordur-orn opened this issue Apr 23, 2023 · 6 comments
Open

GWR().predict() method: How are parameters estimated? #124

thordur-orn opened this issue Apr 23, 2023 · 6 comments

Comments

@thordur-orn
Copy link

Does someone have a formula or an explanation for how we estimate the parameters (betas) for the test set? Like when we use the predict() method of the GWR, which parameters are being used?

@veager
Copy link

veager commented Aug 17, 2023

I have the similar question. How does the out-of-sample prediction work, specially for those locations not existing in the train dataset?

According to the principle of GWR, every location is estimated by an local LR model. A new location doesn't have an estimated LR model, but how to do the prediction?

@ljwolf
Copy link
Member

ljwolf commented Aug 17, 2023

The algorithm is quite simple, we just have not had the time to implement it.

  1. Pool the input training data and prediction data together.
  2. Using the kernel function and estimated bandwidth, construct the smoothed design matrix at out of sample points from the pooled data. Also, construct the smoothed Y for each prediction site
  3. Compute the local betas using the normal equations for the model form
  4. Multiply the out of sample X and estimated out of sample local betas to get your prediction.

We would really love to have this implemented, so if you manage it, definitely contribute back!

@veager
Copy link

veager commented Aug 17, 2023

Thanks @ljwolf reply! I have looked through these codes and roughly understood this process.

But I still confuse about the process of "smoothed Y". Does that mean use some smoothes methods to estimate Y for the new coming out-of-bag samples first and then fit the GWR as usually? But I didn't find any function to smooth that Y?

Is there any paper/textbook/tutorial to explain this process of out-of-sample prediction in detail?

Thanks so much!

@ljwolf
Copy link
Member

ljwolf commented Aug 17, 2023

Does that mean use some smoothes methods to estimate Y for the new coming out-of-bag samples first and then fit the GWR as usually?

Yes. This is only necessary to construct the local betas for the out of bag estimates. You don't re-fit the entire GWR, only estimate the local models on the out of bag points using the smoothed X from the pooled data and smoothed y from the training data alone.

examples

I'm not aware of any, but maybe @TaylorOshan or @Ziqi-Li might?

@ljwolf
Copy link
Member

ljwolf commented Aug 17, 2023

And to be sure, this algorithm will only work with GWR. I don't think this is suitable for MGWR, because of the process specific bandwidths

@TaylorOshan
Copy link
Collaborator

TaylorOshan commented Aug 17, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants