[R-sig-Geo] R: Spatial Durbin Model with regimes in a cross section framework

Roger Bivand Roger.Bivand at nhh.no
Wed Oct 21 13:26:19 CEST 2015


On Wed, 21 Oct 2015, Loredana Mirra wrote:

> Hi, and thank you again for your help. Following Anselin (2007) Spatial
> regression analysis in R  I managed to test for the presence of spatial
> regimes (also performing a Chow test) in R.
>
> Since, I need to apply a Spatial Durbin model, I tried fitting it using the
> following (just adding the option "mixed") to the sar command in the cases
> of regimes (Centre_North and South in my case):
>
> durb<-lagsarlm(GR5101m~ 0+ (ONE+
> LVAPC51):(C_Nord+NOC_Nord),data=highways,listw, type="mixed")
> summary(durb)
>
> I always get this error
> error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) :
>  0 (non-NA) cases

Please provide the output of traceback() after the error has occurred. I 
think that if the same model can be fitted with type="lag", but not with 
"mixed", then the lagged X variables are possibly to blame.

Maybe also try to use lmSLX() on the same formula, data and listw objects, 
to see whether you also see failures in the lagged X variables. The 
underlying create_WX() function does check for NAs, but may not do it 
correctly - possibly for this formula.

If this sounds hard, do:

save(highways, listw, file="chow_error.RData")

and make the "chow_error.RData" file available on a link (possibly 
off-list if the data are private).

Hope this helps,

Roger

>
> I checked if there were NA cases and tried with other variables or weight
> matrices. I wonder if this is a good approach or what is wrong.
>
> Thank you for your attention
> Loredana Mirra
>
>
>
>
> -----Messaggio originale-----
> Da: Roger Bivand [mailto:Roger.Bivand at nhh.no]
> Inviato: venerdì 2 ottobre 2015 10:59
> A: Loredana Mirra
> Cc: r-sig-geo at r-project.org
> Oggetto: Re:[R-sig-Geo] Spatial Durbin Model with regimes in a cross section
> framework
>
> On Fri, 2 Oct 2015, Loredana Mirra wrote:
>
>>
>> Thank you very much for your kind help. Yes, I should check also if,
>> after having estimated separated coefficients,  the difference, if
>> any, is statistically significant (using a chow test). Implementing
>> such test is the major issue to me. Can you give me an hint about this?
>
> Please see ch. 4 in Kleiber and Zeilis (2008) Applied Econometrics with R.
> You may use anova() on the no-regime model and the regime model, which is
> equivalent to a Chow test (personal communication, Achim Zeileis, 2005).
> It will however suffer from misspecification such as outliers, discussed in
> section 4.3 and the use of a Wald test with an HC covariance matrix.
>
>> Thanks also for the suggestion about the interpretation of output in SDM.
>
> A "Chow" test might go through a Likelihood Ratio test, but should arguably
> be presented using the empirical distributions of the impacts for each X
> variable for the no-regime model and for each regime.
>
> Hope this helps,
>
> Roger
>
>> Best Regards
>> Loredana
>> -----Messaggio originale-----
>> Da: Roger Bivand [mailto:Roger.Bivand at nhh.no]
>> Inviato: giovedì 1 ottobre 2015 20:45
>> A: Loredana Mirra
>> Cc: r-sig-geo at r-project.org
>> Oggetto: Re: [R-sig-Geo] Spatial Durbin Model with regimes in a cross
>> section framework
>>
>> On Thu, 1 Oct 2015, Loredana Mirra wrote:
>>
>>> I am writing to ask you a suggestion about the availability of a R
>>> routine or piece of program for the purposes of my empirical analysis.
>>> I should revise my paper using a Spatial Durbin model. This was
>>> recommended in order to mitigate a problem due to the possible
>>> presence of
>> unobserved factors.
>>>
>>> Unfortunately data do not permit to perform a panel but a cross
>>> section analysis. I do not have troubles to perform a Spatial Durbin
>>> Model on the entire sample, but I need to study the presence of
>>> Spatial Regimes. The problem is that I cannot find a program, in a
>>> cross sections framework. Do you know if there is a program available
>>> in R
>> to perform this analysis?
>>
>> How do you want to handle the "regimes"? Estimate separate
>> coefficients for each regime (regime defined as a factor)? If so, this
>> is a standard formula construction, and can be used with formula
>> objects in model fitting
>> functions:
>>
>> lm(mpg ~ 0 + I(factor(am))/(disp + wt), data=mtcars)
>>
>> or similar - check in detailed discussions of formula objects.
>>
>> You need to be careful to report impacts, not coefficient values, from
>> the Spatial Durbin model.
>>
>> Hope this helps,
>>
>> Roger
>>
>>> Thank you very much in advance for your help.
>>>
>>> Best regards
>>>
>>> Loredana Mirra
>>>
>>>
>>>
>>>
>>>
>>> -------------------------
>>>
>>>
>>>
>>> Dott.ssa  Loredana Mirra
>>>
>>> Universit??? di Roma ???Tor Vergata???
>>>
>>> Dipartimento di Economia Diritto e Istituzioni
>>>
>>> Via Columbia, 2
>>>
>>> 00133 Roma
>>>
>>> Italia
>>>
>>> tel. +390672595725
>>>
>>> <mailto:pozzolo at unimol.it> loredana.mirra at uniroma2.it
>>>
>>>
>>>
>>>
>>>
>>> ---
>>> Questa e-mail ??? stata controllata per individuare virus con Avast
>> antivirus.
>>> https://www.avast.com/antivirus
>>>
>>> 	[[alternative HTML version deleted]]
>>>
>>>
>>
>> --
>> Roger Bivand
>> Department of Economics, Norwegian School of Economics, Helleveien 30,
>> N-5045 Bergen, Norway.
>> voice: +47 55 95 93 55; fax +47 55 95 91 00
>> e-mail: Roger.Bivand at nhh.no
>>
>>
>> ---
>> Questa e-mail è stata controllata per individuare virus con Avast
> antivirus.
>> https://www.avast.com/antivirus
>>
>>
>
> --
> Roger Bivand
> Department of Economics, Norwegian School of Economics, Helleveien 30,
> N-5045 Bergen, Norway.
> voice: +47 55 95 93 55; fax +47 55 95 91 00
> e-mail: Roger.Bivand at nhh.no
>
>
> ---
> Questa e-mail è stata controllata per individuare virus con Avast antivirus.
> https://www.avast.com/antivirus
>
>

-- 
Roger Bivand
Department of Economics, Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; fax +47 55 95 91 00
e-mail: Roger.Bivand at nhh.no


More information about the R-sig-Geo mailing list