[R-sig-Geo] Common Factors test in R
Hulényi Martin
m@rt|n@hu|eny| @end|ng |rom v|@d@@gov@@k
Fri Apr 5 15:11:34 CEST 2019
Hello,
I would like to perform a common factor test, conducted using likelihood ratio test on spatial error model and spatial durbin model (both in panel format).
I have not found a command in R, that would help me to conduct the test. Hence, I am trying to perform the test manuallly using the splm package and data available in the splm and plm packages.
Here is my code:
library(splm)
library(plm)
data(Produc, package="plm")
data(usaww)
Produc <- pdata.frame(Produc, index = c("state", "year"))
usaww<- mat2listw(usaww, style="W")
Produc$slagUnemp <- slag(Produc$unemp, listw = usaww)
durbin <- spml(gsp~unemp + slagUnemp,
data=Produc, listw=usaww, effect = "twoways", model="within", lag=TRUE, spatial.error = "none", quiet = FALSE)
spem <- spml(gsp ~ unemp,
data=Produc, listw=usaww, effect = "twoways", model="within", lag=FALSE, spatial.error = "b", quiet = FALSE)
Is it correct to take the last value of the function from the console output to compute the likelihood ratio?
Meaning, in this example, to calculate 2*(function(non-nested) - function(nested)) = 2*(10261.79 - 10255.74) = 12.1?
If it is correct, how can I compute the significance values?
If it is not correct, is there a better way to compute this?
Autorom tejto spr�vy elektronickej po�ty je Martin Hul�nyi. T�to spr�va je ur�en� v�lu�ne jej adres�tovi. Inform�cie a �daje, ktor� s� v nej uveden�, alebo ktor� s� obsiahnut� v jej prilo�en�ch s�boroch, m�u by� inform�ciami alebo �dajmi chr�nen�mi pod�a platn�ch pr�vnych predpisov v Slovenskej republike. V pr�pade, ak nie ste ur�en� ako prij�mate� tejto spr�vy alebo jeho opr�vnen� z�stupca, upozor�ujeme V�s, �e inform�cie a �daje v nej uveden� nie ste opr�vnen� sprac�va�, ani ich spr�stupni� alebo poskytn�� tretej osobe alebo ich zverejni�. Ak ste nedopatren�m prijali alebo zachytili tuto spr�vu elektronickej po�ty, dovo�ujeme si V�s po�iada�, aby ste ju zaslali sp� na elektronick� adresu jej odosielate�a, a aby ste ju n�sledne zmazali zo svojho po��ta�a a z Va�ej schr�nky elektronickej po�ty. Odosielate� tejto spr�vy nenesie zodpovednos� za �kody sp�soben� nespr�vnym pou�it�m tejto spr�vy elektronickej po�ty a jej pr�loh.
The author of this e-mail message is Martin Hul�nyi. This message is intended solely for the recipient. The information and data contained therein or contained in its enclosed files may be information or data protected under applicable laws in the Slovak Republic. If you are not designated as the recipient of this message or its authorized representative, we would like to inform you that the information and data contained therein are not authorized to process or make them available to third parties or to disclose them. If you have received or downloaded this e-mail message accidentally, we ask you to send it back to the e-mail address of the sender and then delete it from your computer and from your e-mail. The sender of this message is not responsible for damages caused by incorrect use of this e-mail message and its attachments.
[eco.jpg] Pred vytla�en�m tohto mailu zv�te pros�m vplyv na �ivotn� prostredie. �akujeme.
Please consider the environment before printing this e-mail. Thanks
[[alternative HTML version deleted]]
More information about the R-sig-Geo
mailing list