Re: [R-sig-Geo] stepwise algorithm for GWR

2009-05-13 Thread Marco Helbich
Dear Joshua and Danlin,

your remarks are right, but I am not fully convinced. What are the differences 
between using it in an ols framwork and using it in a GWR one under the same 
conditions (same bandwith, amount of neighbors...)?
Any further hints?

Thank you and best regards
Marco


 Original-Nachricht 
> Datum: Wed, 13 May 2009 14:32:35 -0400
> Von: "Myers, Joshua" 
> An: "Danlin Yu" , "Marco Helbich" 
> 
> CC: [email protected]
> Betreff: RE: [R-sig-Geo] stepwise algorithm for GWR

> Marco,
>I agree with Danlin.  You can use AIC to compare models of the same 
> type
> (i.e. OLS) with different model specifications, or, you can use AIC to
> compare models of different types (SAR, OLS, GWR) but with the same model
> specification.  Alternatively, RMSE can be used to compare models of any type
> together no matter what specification, but there is no penalization for
> number of parameters used.  Oftentimes, we either have a fixed number of
> parameters or we have a good idea which parameters are best or interesting, 
> so we
> are able to cut down on some of the many possible specification options.  
> 
> -Josh
> 
> -Original Message-
> From: Danlin Yu [mailto:[email protected]] 
> Sent: Wednesday, May 13, 2009 2:12 PM
> To: Marco Helbich
> Cc: [email protected]; Myers, Joshua
> Subject: Re: [R-sig-Geo] stepwise algorithm for GWR
> 
> Marco:
> 
> That's the point - I don't think such comparison is quite appropriate (I 
> might be wrong) since the model specifications are not the same. You can 
> compare AICs across OLS, SAR, and GWR with the same specification (same 
> set of dependent and independent variables), but it's quite doubtful to 
> compare AICs across any of these with different specifications.
> 
> It really depends upon what's the purpose of your analysis. I assume you 
> were trying to find the best model to fit your data. Maybe using all the 
> models to do a prediction and calculate the RMSE could give you some
> hints?
> 
> Hope this helps.
> 
> Danlin
> 
> Marco Helbich ??:
> > Dear Danlin and Joshua,
> >
> > first of all thank you for your replies! Here some further notes for
> clarification: I have already estimated a global ols model (based on stepwise
> model selection) and because of some spatial effects I recalculated it as
> simultaneous autoregressive model. After that I tested this model for
> non-stationarity... and voilà there is one. Now I want to compare this one 
> with
> the one offering the lowest aic. 
> >
> > All the best
> > Marco  
> >
> >
> >
> >  Original-Nachricht 
> >   
> >> Datum: Wed, 13 May 2009 10:04:22 -0400
> >> Von: Danlin Yu 
> >> An: Marco Helbich 
> >> CC: [email protected]
> >> Betreff: Re: [R-sig-Geo] stepwise algorithm for GWR
> >> 
> >
> >   
> >> Dear Marco:
> >>
> >> Before doing so, you'll have to ask yourself that whether all those
> AICs 
> >> are comparable among different model specifications. As a matter of 
> >> fact, I believe it might be more plausible if you stepwise it first as
> a 
> >> global model (OLS, after all, global models are an "averaged" view of 
> >> the local models), and then work with the selected specification.
> >>
> >> Hope this helps,
> >>
> >> Danlin
> >>
> >> Marco Helbich ??:
> >> 
> >>> Dear list!
> >>>
> >>> I am doing some geographically weighted regression and I am intersted
> in
> >>>   
> >> the most suitable model (the one with the lowest AIC). Because there is
> no
> >> stepwise algorithm, I am trying to write a "brute force" function,
> which
> >> uses all possible variable combination, applies the gwr and returns the
> AIC
> >> value with the used variable combination in a dataframe. 
> >> 
> >>> For instance the model below: gwr1: crime ~ income, gwr2: crime ~
> >>>   
> >> housing, gwr3: crime ~ var1, gwr4: crime ~ income + housing, ... 
> >> 
> >>> I hope my problem is clear and appreciate every hint! Thank you!
> >>>
> >>> All the best
> >>> Marco
> >>>
> >>> library(spgwr)
> >>> data(columbus)
> >>> columbus[,"var1"] <- rnorm(length(columbus[,1]))
> >>>
> >>> col.bw <- gwr.sel(crime ~ income + housing + var1, data=colu

Re: [R-sig-Geo] stepwise algorithm for GWR

2009-05-13 Thread Myers, Joshua
Marco,
 I agree with Danlin.  You can use AIC to compare models of the same 
type (i.e. OLS) with different model specifications, or, you can use AIC to 
compare models of different types (SAR, OLS, GWR) but with the same model 
specification.  Alternatively, RMSE can be used to compare models of any type 
together no matter what specification, but there is no penalization for number 
of parameters used.  Oftentimes, we either have a fixed number of parameters or 
we have a good idea which parameters are best or interesting, so we are able to 
cut down on some of the many possible specification options.  

-Josh

-Original Message-
From: Danlin Yu [mailto:[email protected]] 
Sent: Wednesday, May 13, 2009 2:12 PM
To: Marco Helbich
Cc: [email protected]; Myers, Joshua
Subject: Re: [R-sig-Geo] stepwise algorithm for GWR

Marco:

That's the point - I don't think such comparison is quite appropriate (I 
might be wrong) since the model specifications are not the same. You can 
compare AICs across OLS, SAR, and GWR with the same specification (same 
set of dependent and independent variables), but it's quite doubtful to 
compare AICs across any of these with different specifications.

It really depends upon what's the purpose of your analysis. I assume you 
were trying to find the best model to fit your data. Maybe using all the 
models to do a prediction and calculate the RMSE could give you some hints?

Hope this helps.

Danlin

Marco Helbich ??:
> Dear Danlin and Joshua,
>
> first of all thank you for your replies! Here some further notes for 
> clarification: I have already estimated a global ols model (based on stepwise 
> model selection) and because of some spatial effects I recalculated it as 
> simultaneous autoregressive model. After that I tested this model for 
> non-stationarity... and voilà there is one. Now I want to compare this one 
> with the one offering the lowest aic. 
>
> All the best
> Marco  
>
>
>
>  Original-Nachricht 
>   
>> Datum: Wed, 13 May 2009 10:04:22 -0400
>> Von: Danlin Yu 
>> An: Marco Helbich 
>> CC: [email protected]
>> Betreff: Re: [R-sig-Geo] stepwise algorithm for GWR
>> 
>
>   
>> Dear Marco:
>>
>> Before doing so, you'll have to ask yourself that whether all those AICs 
>> are comparable among different model specifications. As a matter of 
>> fact, I believe it might be more plausible if you stepwise it first as a 
>> global model (OLS, after all, global models are an "averaged" view of 
>> the local models), and then work with the selected specification.
>>
>> Hope this helps,
>>
>> Danlin
>>
>> Marco Helbich ??:
>> 
>>> Dear list!
>>>
>>> I am doing some geographically weighted regression and I am intersted in
>>>   
>> the most suitable model (the one with the lowest AIC). Because there is no
>> stepwise algorithm, I am trying to write a "brute force" function, which
>> uses all possible variable combination, applies the gwr and returns the AIC
>> value with the used variable combination in a dataframe. 
>> 
>>> For instance the model below: gwr1: crime ~ income, gwr2: crime ~
>>>   
>> housing, gwr3: crime ~ var1, gwr4: crime ~ income + housing, ... 
>> 
>>> I hope my problem is clear and appreciate every hint! Thank you!
>>>
>>> All the best
>>> Marco
>>>
>>> library(spgwr)
>>> data(columbus)
>>> columbus[,"var1"] <- rnorm(length(columbus[,1]))
>>>
>>> col.bw <- gwr.sel(crime ~ income + housing + var1, data=columbus,
>>>   coords=cbind(columbus$x, columbus$y))
>>> col.gauss <- gwr(crime ~ income + housing + var1, data=columbus,
>>>   coords=cbind(columbus$x, columbus$y), bandwidth=col.bw,
>>>   
>> hatmatrix=TRUE)
>> 
>>> col.gauss
>>> --
>>>
>>> ___
>>> R-sig-Geo mailing list
>>> [email protected]
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>>   
>>>   
>> -- 
>> ___
>> Danlin Yu, Ph.D.
>> Assistant Professor of GIS and Urban Geography
>> Department of Earth & Environmental Studies
>> Montclair State University
>> Montclair, NJ, 07043
>> Tel: 973-655-4313
>> Fax: 973-655-4072
>> email: [email protected]
>> webpage: csam.montclair.edu/~yu
>> 
>
>   

-- 
___
Danlin Yu, Ph.D.
Assistant Professor of GIS and Urban Geography
Department of Earth & Environmental Studies
Montclair State University
Montclair, NJ, 07043
Tel: 973-655-4313
Fax: 973-655-4072
email: [email protected]
webpage: csam.montclair.edu/~yu

___
R-sig-Geo mailing list
[email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo


Re: [R-sig-Geo] stepwise algorithm for GWR

2009-05-13 Thread Danlin Yu

Marco:

That's the point - I don't think such comparison is quite appropriate (I 
might be wrong) since the model specifications are not the same. You can 
compare AICs across OLS, SAR, and GWR with the same specification (same 
set of dependent and independent variables), but it's quite doubtful to 
compare AICs across any of these with different specifications.


It really depends upon what's the purpose of your analysis. I assume you 
were trying to find the best model to fit your data. Maybe using all the 
models to do a prediction and calculate the RMSE could give you some hints?


Hope this helps.

Danlin

Marco Helbich ??:

Dear Danlin and Joshua,

first of all thank you for your replies! Here some further notes for clarification: I have already estimated a global ols model (based on stepwise model selection) and because of some spatial effects I recalculated it as simultaneous autoregressive model. After that I tested this model for non-stationarity... and voilà there is one. Now I want to compare this one with the one offering the lowest aic. 


All the best
Marco  




 Original-Nachricht 
  

Datum: Wed, 13 May 2009 10:04:22 -0400
Von: Danlin Yu 
An: Marco Helbich 
CC: [email protected]
Betreff: Re: [R-sig-Geo] stepwise algorithm for GWR



  

Dear Marco:

Before doing so, you'll have to ask yourself that whether all those AICs 
are comparable among different model specifications. As a matter of 
fact, I believe it might be more plausible if you stepwise it first as a 
global model (OLS, after all, global models are an "averaged" view of 
the local models), and then work with the selected specification.


Hope this helps,

Danlin

Marco Helbich ??:


Dear list!

I am doing some geographically weighted regression and I am intersted in
  

the most suitable model (the one with the lowest AIC). Because there is no
stepwise algorithm, I am trying to write a "brute force" function, which
uses all possible variable combination, applies the gwr and returns the AIC
value with the used variable combination in a dataframe. 


For instance the model below: gwr1: crime ~ income, gwr2: crime ~
  
housing, gwr3: crime ~ var1, gwr4: crime ~ income + housing, ... 


I hope my problem is clear and appreciate every hint! Thank you!

All the best
Marco

library(spgwr)
data(columbus)
columbus[,"var1"] <- rnorm(length(columbus[,1]))

col.bw <- gwr.sel(crime ~ income + housing + var1, data=columbus,
  coords=cbind(columbus$x, columbus$y))
col.gauss <- gwr(crime ~ income + housing + var1, data=columbus,
  coords=cbind(columbus$x, columbus$y), bandwidth=col.bw,
  

hatmatrix=TRUE)


col.gauss
--

___
R-sig-Geo mailing list
[email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
  
  

--
___
Danlin Yu, Ph.D.
Assistant Professor of GIS and Urban Geography
Department of Earth & Environmental Studies
Montclair State University
Montclair, NJ, 07043
Tel: 973-655-4313
Fax: 973-655-4072
email: [email protected]
webpage: csam.montclair.edu/~yu



  


--
___
Danlin Yu, Ph.D.
Assistant Professor of GIS and Urban Geography
Department of Earth & Environmental Studies
Montclair State University
Montclair, NJ, 07043
Tel: 973-655-4313
Fax: 973-655-4072
email: [email protected]
webpage: csam.montclair.edu/~yu

___
R-sig-Geo mailing list
[email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo


Re: [R-sig-Geo] stepwise algorithm for GWR

2009-05-13 Thread Marco Helbich
Dear Danlin and Joshua,

first of all thank you for your replies! Here some further notes for 
clarification: I have already estimated a global ols model (based on stepwise 
model selection) and because of some spatial effects I recalculated it as 
simultaneous autoregressive model. After that I tested this model for 
non-stationarity... and voilà there is one. Now I want to compare this one with 
the one offering the lowest aic. 

All the best
Marco  



 Original-Nachricht 
> Datum: Wed, 13 May 2009 10:04:22 -0400
> Von: Danlin Yu 
> An: Marco Helbich 
> CC: [email protected]
> Betreff: Re: [R-sig-Geo] stepwise algorithm for GWR

> Dear Marco:
> 
> Before doing so, you'll have to ask yourself that whether all those AICs 
> are comparable among different model specifications. As a matter of 
> fact, I believe it might be more plausible if you stepwise it first as a 
> global model (OLS, after all, global models are an "averaged" view of 
> the local models), and then work with the selected specification.
> 
> Hope this helps,
> 
> Danlin
> 
> Marco Helbich ??:
> > Dear list!
> >
> > I am doing some geographically weighted regression and I am intersted in
> the most suitable model (the one with the lowest AIC). Because there is no
> stepwise algorithm, I am trying to write a "brute force" function, which
> uses all possible variable combination, applies the gwr and returns the AIC
> value with the used variable combination in a dataframe. 
> > For instance the model below: gwr1: crime ~ income, gwr2: crime ~
> housing, gwr3: crime ~ var1, gwr4: crime ~ income + housing, ... 
> >
> > I hope my problem is clear and appreciate every hint! Thank you!
> >
> > All the best
> > Marco
> >
> > library(spgwr)
> > data(columbus)
> > columbus[,"var1"] <- rnorm(length(columbus[,1]))
> >
> > col.bw <- gwr.sel(crime ~ income + housing + var1, data=columbus,
> >   coords=cbind(columbus$x, columbus$y))
> > col.gauss <- gwr(crime ~ income + housing + var1, data=columbus,
> >   coords=cbind(columbus$x, columbus$y), bandwidth=col.bw,
> hatmatrix=TRUE)
> > col.gauss
> > --
> >
> > ___
> > R-sig-Geo mailing list
> > [email protected]
> > https://stat.ethz.ch/mailman/listinfo/r-sig-geo
> >   
> 
> -- 
> ___
> Danlin Yu, Ph.D.
> Assistant Professor of GIS and Urban Geography
> Department of Earth & Environmental Studies
> Montclair State University
> Montclair, NJ, 07043
> Tel: 973-655-4313
> Fax: 973-655-4072
> email: [email protected]
> webpage: csam.montclair.edu/~yu

--

___
R-sig-Geo mailing list
[email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo


Re: [R-sig-Geo] stepwise algorithm for GWR

2009-05-13 Thread Myers, Joshua
Dear Marco,
I think Danlin is more experienced with this than myself, but in
my experience I have found that best global OLS model is usually at
least somewhat different than the best GWR model.   I have found that
there is usually a slightly different variable set (at least in the two
datasets that I have been working with).  In my datasets I have also
found that it yields better results to not use a log or square root (or
any other like variable transformation) in the local model, whereas it
might make a difference in a global model.  I am not saying it will be
the same for you, but I am cautioning you to not just take what you see
the global case and apply it blindly to the local GWR case.  

I have actually thought a lot about what you are suggesting, a
selection algorithm for gwr, but I haven't had the time to play with it
yet.  It can be noted, however, that any such search algorithm will take
a log time.  It will probably need to be run overnight, unless
you have some kind supercomputing cluster.

-Josh

-Original Message-
From: [email protected]
[mailto:[email protected]] On Behalf Of Danlin Yu
Sent: Wednesday, May 13, 2009 10:04 AM
To: Marco Helbich
Cc: [email protected]
Subject: Re: [R-sig-Geo] stepwise algorithm for GWR

Dear Marco:

Before doing so, you'll have to ask yourself that whether all those AICs

are comparable among different model specifications. As a matter of 
fact, I believe it might be more plausible if you stepwise it first as a

global model (OLS, after all, global models are an "averaged" view of 
the local models), and then work with the selected specification.

Hope this helps,

Danlin

Marco Helbich ??:
> Dear list!
>
> I am doing some geographically weighted regression and I am intersted
in the most suitable model (the one with the lowest AIC). Because there
is no stepwise algorithm, I am trying to write a "brute force" function,
which uses all possible variable combination, applies the gwr and
returns the AIC value with the used variable combination in a dataframe.

> For instance the model below: gwr1: crime ~ income, gwr2: crime ~
housing, gwr3: crime ~ var1, gwr4: crime ~ income + housing, ... 
>
> I hope my problem is clear and appreciate every hint! Thank you!
>
> All the best
> Marco
>
> library(spgwr)
> data(columbus)
> columbus[,"var1"] <- rnorm(length(columbus[,1]))
>
> col.bw <- gwr.sel(crime ~ income + housing + var1, data=columbus,
>   coords=cbind(columbus$x, columbus$y))
> col.gauss <- gwr(crime ~ income + housing + var1, data=columbus,
>   coords=cbind(columbus$x, columbus$y), bandwidth=col.bw,
hatmatrix=TRUE)
> col.gauss
> --
>
> ___
> R-sig-Geo mailing list
> [email protected]
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>   

-- 
___
Danlin Yu, Ph.D.
Assistant Professor of GIS and Urban Geography
Department of Earth & Environmental Studies
Montclair State University
Montclair, NJ, 07043
Tel: 973-655-4313
Fax: 973-655-4072
email: [email protected]
webpage: csam.montclair.edu/~yu

___
R-sig-Geo mailing list
[email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

___
R-sig-Geo mailing list
[email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo


Re: [R-sig-Geo] stepwise algorithm for GWR

2009-05-13 Thread Danlin Yu

Dear Marco:

Before doing so, you'll have to ask yourself that whether all those AICs 
are comparable among different model specifications. As a matter of 
fact, I believe it might be more plausible if you stepwise it first as a 
global model (OLS, after all, global models are an "averaged" view of 
the local models), and then work with the selected specification.


Hope this helps,

Danlin

Marco Helbich ??:

Dear list!

I am doing some geographically weighted regression and I am intersted in the most suitable model (the one with the lowest AIC). Because there is no stepwise algorithm, I am trying to write a "brute force" function, which uses all possible variable combination, applies the gwr and returns the AIC value with the used variable combination in a dataframe. 
For instance the model below: gwr1: crime ~ income, gwr2: crime ~ housing, gwr3: crime ~ var1, gwr4: crime ~ income + housing, ... 


I hope my problem is clear and appreciate every hint! Thank you!

All the best
Marco

library(spgwr)
data(columbus)
columbus[,"var1"] <- rnorm(length(columbus[,1]))

col.bw <- gwr.sel(crime ~ income + housing + var1, data=columbus,
  coords=cbind(columbus$x, columbus$y))
col.gauss <- gwr(crime ~ income + housing + var1, data=columbus,
  coords=cbind(columbus$x, columbus$y), bandwidth=col.bw, hatmatrix=TRUE)
col.gauss
--

___
R-sig-Geo mailing list
[email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
  


--
___
Danlin Yu, Ph.D.
Assistant Professor of GIS and Urban Geography
Department of Earth & Environmental Studies
Montclair State University
Montclair, NJ, 07043
Tel: 973-655-4313
Fax: 973-655-4072
email: [email protected]
webpage: csam.montclair.edu/~yu

___
R-sig-Geo mailing list
[email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo