Hi everyone, I am new to spatial econometrics, the following questions may seem "stupid", but they have been bothering me for a long period. I hope I can get some good inputs here. Appreciate any help.
I used Spdep to estimate a set of spatial hedonic housing price models, e.g., spatial lag and error models. The estimation is based on a modeling sample, which is random sampled as 90% of the whole observations. Now I want to finish the prediction for the testing sample (the rest 10%). The trouble for me currently is how to create the weight matrix for the testing sample. In the modeling process, the weight matrix is created based on the observations in the modeling sample. Now for the testing sample, the weight for each testing observation is supposed to be also only from the neighbors in the modeling sample. I consulted with some guys, they said I have to write codes in order to calculate it. I am wondering whether R has the functions to calculate the distance between two sets of spatial points, i.e., for each observation in the testing sample, to get the K nearest "observations in the modeling sample". If this is achievable, then the distance-based weight matrix and KNN weight matrix will be able to get. Then another issue is about contiguity-based weight matrix. I personally think this type of weight matrix is not suitable for prediction. I created the rook/queen contiguity weight matrix based on the delaunay triangles converted from point observations. For prediction, for each observation in the testing sample, it is not easy to calculate the contiguity weight, which is supposed to be from the border-shared observations in the modeling sample. I was told that I can construct the contiguity weight matrix for the whole set of observations, including both the modeling and testing sample, however, in this case, the border-shared regions for one testing observation may be also from the testing sample. I think this is not the correct way. I hope the above text is understandable. also if sombody knows there may exist some packages which can directly support the estimation and prediction, that will be great. thanks, Dong [[alternative HTML version deleted]] _______________________________________________ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo