R: logLik value of the spml spatial panel model
This is great response. Thank you all, Giovanni, Roger and Jeremie. Based on the response, it seems that the LL element for fixed effect model is only useful for optimization, but not cross model comparison? The fixed effect spatial lag panel model, however, does produce the LL value. Does that mean this LL value shall not be used for model comparison purpose as well? Thank you all. Best, Danlin
On 2018/10/25 8:46, Millo Giovanni wrote:
Hello. Thanks for keeping us posted. As was aptly observed, while RE and pooled models do actually have a logLik element, FE ones don't but there's a reason. While it is not difficult to output the LL for the FE models too, like Jeremie did (or perhaps even setting quiet=FALSE and taking the last loglikelihood value from optimization), we never managed to decide whether outputting this is appropriate or not. In fact the LL element from the procedure is relative to the "pooled" model on demeaned data, so it is sort of a crossbred likelihood; most people asking for it want it to compare to the LL of the random effects model or similar uses, which I would not advise. Gianfranco (author of the FE stuff) do please step in if appropriate. Best, Giovanni -----Messaggio originale----- Da: Jeremie Juste [mailto:jeremiejuste at gmail.com] Inviato: gioved? 25 ottobre 2018 11:21 A: Roger Bivand Cc: Danlin Yu; r-sig-geo at r-project.org; Millo Giovanni; Gianfranco Piras Oggetto: Re: [R-sig-Geo] logLik value of the spml spatial panel model Hello, Thanks for the feedback. Here is the diff. It is my first one so I'm not sure I'm doing everything right. :-) modified R/likelihoodsFE.R @@ -459,7 +459,7 @@ if(Hess) asyv <- NULL else asyv <- asyv - return<-list(coeff=betas, rho = rho, s2 = s2, rest.se = rest.se, rho.se = rho.se, s2.se = s2.se, asyvar1=asyvar1, residuals = r, asyv = asyv) + return<-list(coeff=betas, rho = rho, s2 = s2, rest.se = rest.se, + rho.se = rho.se, s2.se = s2.se, ll=LL, asyvar1=asyvar1, residuals = r, + asyv = asyv) } I have compressed splm with the modification with the .git inside. I have installed the modified package again and checked that the modification worked.
fespaterr <- spml(fm, data = Produc, listw = mat2listw(usaww), model="within", spatial.error="b", Hess = FALSE) fespaterr$logLik
It may be,however, that there was a reason for omitting it, so checks to verify that it actually is a logLik value on the same basis as other logLik values (not from an abbreviated log-likelihood function used for fitting by omitting constants) would be helpful. It would be good to provide logLik methods for the ML fitted model objects.
I have checked that it is the logLik that correspond to the estimation of the rho. Best regards, Jeremie Ai sensi del Reg. UE 2016/679 e normativa vigente si precisa che le informazioni contenute in questo messaggio sono riservate ed a uso esclusivo del destinatario. Qualora il messaggio in parola Le fosse pervenuto per errore, La invitiamo ad eliminarlo senza copiarlo e a non inoltrarlo a terzi, dandocene gentilmente comunicazione. Grazie. Pursuant to Italian Law and EU Reg. 2016/679, you are hereby informed that this message contains confidential information intended only for the use of the addressee. If you are not the addressee, and have received this message by mistake, please delete it and immediately notify us. You may not copy or disseminate this message to anyone. Thank you.
___________________________________________ 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 at mail.montclair.edu webpage: csam.montclair.edu/~yu