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

Loredana Mirra loredana.mirra at uniroma2.it
Wed Oct 21 14:05:17 CEST 2015


Here the traceback()
4: stop("0 (non-NA) cases")
3: lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...)
2: lm(y ~ x - 1)
1: lagsarlm(GR5101m ~ 0 + (ONE + LVAPC51):(C_Nord + NOC_Nord), data =
highwaysreg, 
       listw, type = "mixed")

No, problem. Data are not private. I tried to use the lmSLX and I got the
same error
This is the link to the file with errors  
https://onedrive.live.com/redir?resid=4484D82DD190F118!2202&authkey=!AEXvKmB
o2FVgrQI&ithint=file%2cRData

Thank you

Loredana



-----Messaggio originale-----
Da: Roger Bivand [mailto:Roger.Bivand at nhh.no] 
Inviato: mercoledì 21 ottobre 2015 13:26
A: Loredana Mirra
Cc: r-sig-geo at r-project.org
Oggetto: Re: R: [R-sig-Geo] Spatial Durbin Model with regimes in a cross
section framework

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


---
Questa e-mail è stata controllata per individuare virus con Avast antivirus.
https://www.avast.com/antivirus



More information about the R-sig-Geo mailing list