[R-sig-Geo] logLik value of the spml spatial panel model

Danlin Yu yud @ending from m@il@montcl@ir@edu
Thu Oct 25 07:39:42 CEST 2018


Dear Jeremie:

That worked! Thank you very much for the addition.

Best,

Danlin


On 2018/10/25 1:27, Jeremie Juste wrote:
> Hello,
>
> Indeed the Loglik was not returned here by the function sarpanelerror
> here. I have provided a patch (attached). It's an ugly one but better
> than nothing. So instead of running spml you could run test..spml after
> sourcing the file to obtain the fespaterr$logLik.
>
> fespaterr <- test..spml(fm, data = Produc, listw = mat2listw(usaww),
>                     model="within", spatial.error="b", Hess = FALSE)
>
>
> The only modification I've made is in the function test..(sperrorlm)
> where I've added ll=LL in the list returned.
>
>
> Hope it helps,
>
> Jeremie
>
>
>
>
>
>
>> Dear Jeremie:
>>
>> Thank you for the response. I actually only copied the scripts from
>> the spml help page, reproduced here:
>>
>> fm <- log(gsp) ~ log(pcap) + log(pc) + log(emp) + unemp
>> ## the two standard specifications (SEM and SAR) one with FE
>> ## and the other with RE:
>> ## fixed effects panel with spatial errors
>> fespaterr <- spml(fm, data = Produc, listw = mat2listw(usaww),
>>                     model="within", spatial.error="b", Hess = FALSE) #
>> doesn't matter if I set Hess = T or F here, and doesn't matter if I
>> set spatial.error = "b" or "kkp"
>>
>> And when I want to check the logLik value:
>>
>> fespaterr$logLik
>>
>> I got the "NULL" value
>>
>> I checked this with some other data sets, and found that if I am using
>> the spatial lag specification, I usually got a value for the logLik
>> parameter. If, however, I use the spatial error specification, I
>> usually got the "NULL" value for the logLik parameter. I was not able
>> to get to the bottom of the issue by digging into the codes a bit. Any
>> leads would be greatly appreciated.
>>
>> Best,
>>
>> Danlin
>>
>> On 2018/10/24 15:30, Jeremie Juste wrote:
>>> Danlin Yu <yud using mail.montclair.edu> writes:
>>>
>>>
>>> Hello,
>>>
>>> Could you post the exact command you have used with all the relevant
>>> options? If you dug into the code then you've noticed quite a lot of
>>> nested control structures so a clear idea of your commands might be
>>> useful here.
>>>
>>> for instance
>>>
>>>       fm <- logc ~ logp+ logpn + logy
>>>       sarpool <-  suppressWarnings(splm::spml(fm,cigar,
>>>                                               listw=lwcig,
>>>                                               model="pooling",
>>>       spatial.error="none",lag=TRUE,index=c("region","time")))
>>>
>>> Will produce the logLik
>>>       sarpool$logLik
>>>
>>>
>>>   From what I've understood at some point the function <nlminb> is always
>>> called so a likelihood value is always produced although not always
>>> returned.
>>>
>>>
>>> Best regards,
>>>
>>> Jeremie
>>>
>>>
>>>
>>>> Dear List:
>>>>
>>>> In a recent attempt to compare spatial panel models using splm
>>>> package, I intend to use the logLik value that was produced by the
>>>> spml() routine. When I ran the model, I realize that the logLik value
>>>> is not always produced, especially when the spatial.error is set to
>>>> "b", a NULL value is returned. I know I must have missed something
>>>> here, but can anyone point out why the logLik value is not returned
>>>> when the spatial.error value is set to "b" (a spatial panel lag model
>>>> always return a logLik value). I tried a bit to dig into the codes,
>>>> but didn't find much that can answer my question.
>>>>
>>>> Thank you.
>>>>
>>>> Best,
>>>>
>>>> Danlin

-- 
___________________________________________
Danlin Yu, Ph.D.
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
Office: CELS 314
Email: yud using mail.montclair.edu
webpage: csam.montclair.edu/~yu


	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list