[R-sig-Geo] spml package and impacts calcultion

Roger Bivand Roger.Bivand at nhh.no
Mon Dec 28 22:13:36 CET 2015


Please consider contacting the authors of the splm package (I am not an 
author or maintainer of the package); when posting to the list, write to 
the list rather than an individual recipient first; you are also 
extending an existing thread with content that isn't directly relevant.

Consider contibuting a modification to spdep::create_WX(), possibly by 
using a Kronecker product on the sparse representation of the listw object 
to inject the time periods.

For example, use:

library(spdep)
data(columbus)
listw <- nb2listw(col.gal.nb, style="W")
summary(listw)
W <- as(listw, "CsparseMatrix")
class(W)
dim(W)
image(W)
I <- Diagonal(3)
class(I)
W1 <- kronecker(I, W)
class(W1)
image(W1)
listw1 <- mat2listw(W1, style="W")
summary(listw1)

for three time periods. Do use trial cases and check that you do not 
generate spurious lags. In the present implementations (I think in the 
Matrix package), it seems hard to pass through row/column IDs.

Hope this clarifies,

Roger


On Mon, 28 Dec 2015, Daniel Furlan Amaral wrote:

> Hi,
>
> I would like to present some other questions I can't solve.
>
> 1) I have to estimate a Spatial Durbin Panel Model (SDM) and a Spatial
> Durbin Error Model (SDEM). The problem is that the command *lag.listw* does
> not work for panel datasets and results in an error message:
>
>
>
> *Wx <- lag.listw(W, x)Error in lag.listw(W, x) : object lengths differ*
> Is there any command in spml (or any other package) to create spatial lag
> of regressors automatically? Or I need to do it manually?
>
> 2) Is there any control for heteroskedasticity for Spatial Panel Models in
> splm (or any other package)?
>
> 3) I need the log-Likelihood method for SAR, SEM and SARAR panel models. If
> I follow the method described in
>
> http://r-sig-geo.2731867.n2.nabble.com/spml-and-logLik-help-td7581581.html
>
> , SEM estimations get an error, so I decided to use the option quiet =
> FALSE. Doing this, I got a function value: -34101.08. The value to report
> in the paper should be -ln(34101.08), i.e, 10.43708?
>
> 4) I need to calculate impacts from Spatial Error Model:
>
> *efsem <- spml(fm, data = tb, index = "Cod_mun", listw = W, model =
> "within", spatial.error = "b", lag = FALSE, quiet = FALSE)*
>
>
> *impsem <- impacts(efsem, listw = W, style="W", time = 10)*
> But I receive this error message:
>
>
> *Error in impacts.splm(efsem, listw = W, style = "W", time = 10): object
> type not recognized*
> Does anyone know how to calculate impacts for panel SEM?
>
> Thank you.
>
>
>
> 2015-12-28 11:57 GMT-02:00 Daniel Furlan Amaral <dfamaral at gmail.com>:
>
>> Thank you, Mr. Roger.
>>
>> Best regards,
>>
>> Daniel.
>>
>> 2015-12-23 20:39 GMT-02:00 Roger Bivand <Roger.Bivand at nhh.no>:
>>
>>> On Wed, 23 Dec 2015, Edzer Pebesma wrote:
>>>
>>>
>>>>
>>>> On 23/12/15 22:02, Daniel Furlan Amaral wrote:
>>>>
>>>>> Dear all,
>>>>>
>>>>> Does anyone know about packages or commands to calculate direct,
>>>>> indirect
>>>>> and total impacts? I didn't find it on spml package.
>>>>>
>>>>
>>>> package spdep has impacts methods for some models, see ?impacts :
>>>>
>>>> library(spdep)
>>>>>
>>>> Loading required package: Matrix
>>>>
>>>>> methods(impacts)
>>>>>
>>>> [1] impacts.gmsar* impacts.sarlm* impacts.stsls*
>>>>
>>>>
>>> and model fitting functions in the splm package use those in their own
>>> method:
>>>
>>> library(splm)
>>>> methods(impacts)
>>>>
>>> [1] impacts.gmsar* impacts.sarlm* impacts.splm*  impacts.stsls*
>>>
>>> so use that method in the same way.
>>>
>>> Roger
>>>
>>>
>>>>> Thank you.
>>>>>
>>>>>         [[alternative HTML version deleted]]
>>>>>
>>>>> _______________________________________________
>>>>> R-sig-Geo mailing list
>>>>> R-sig-Geo at r-project.org
>>>>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>>>>
>>>>>
>>>>
>>>>
>>> --
>>> 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
>>>
>>>
>>
>

-- 
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