Skip to content
Prev 8818 / 29559 Next

categoric and dummy variables

On Tue, 20 Jul 2010, Pinar Aslantas Bostan wrote:

            
As I wrote when you asked five weeks ago, you need much more clarity in 
what you are doing and why. First try to use lm() to fit the model, and 
predict() from the lm fit and your newdata (dem).

Do look carefully at:

str(station)
summary(station)
str(dem)
summary(dem)

and check that the RHS variables match exactly (same name, same type - 
numerical or factor).

With regard to categorical variables, read up on factors. If you have 
factors, them lm() and gwr() - which uses lm() - will handle them 
correctly, as will the prediction, because dummies are generated 
internally. Read up on how the formula works.

Once this works for lm() and predict(), there is no good reason why it 
shouldn't work for gwr() - although the idea of using GWR for prediction 
does seem unjustified, because you can use local kriging with 
covariates for the same purpose.

Hope this helps,

Roger
+ se.fit=T,hatmatrix=TRUE)