[Splm-commits] r112 - in pkg: . R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon May 16 22:28:51 CEST 2011


Author: the_sculler
Date: 2011-05-16 22:28:51 +0200 (Mon, 16 May 2011)
New Revision: 112

Modified:
   pkg/ChangeLog
   pkg/DESCRIPTION
   pkg/R/bsktest.R
   pkg/man/bsktest.Rd
   pkg/man/effects.splm.Rd
   pkg/man/print.splm.Rd
   pkg/man/spgm.Rd
   pkg/man/sphtest.Rd
   pkg/man/spml.Rd
   pkg/man/summary.splm.Rd
   pkg/man/write.effects.splm.Rd
Log:
Reintroduced standardized versions of marginal bsktests. Fixed syntax in sphtest.



Modified: pkg/ChangeLog
===================================================================
--- pkg/ChangeLog	2011-05-09 20:27:31 UTC (rev 111)
+++ pkg/ChangeLog	2011-05-16 20:28:51 UTC (rev 112)
@@ -1,3 +1,7 @@
+Changes in Version 0.9-02
+  o standardized versions of marginal bsktest reintroduced
+  o all examples now on full 'Produc' dataset
+
 Changes in Version 0.9-01
   o spml as common wrapper for all ML based estimators
   o fixed syntax in spgm and sphtest for consistency with spml (essentially: 'model=c("within", "random", "pooling")' argument as in 'plm')

Modified: pkg/DESCRIPTION
===================================================================
--- pkg/DESCRIPTION	2011-05-09 20:27:31 UTC (rev 111)
+++ pkg/DESCRIPTION	2011-05-16 20:28:51 UTC (rev 112)
@@ -1,6 +1,6 @@
 Package: splm
 Title: Econometric Models for Spatial Panel Data
-Version: 0.9-01
+Version: 0.9-02
 Date: 2011-05-06
 Author: Giovanni Millo <giovanni.millo at generali.com>, Gianfranco Piras <gpiras at mac.com>
 Maintainer: Giovanni Millo <giovanni.millo at generali.com>

Modified: pkg/R/bsktest.R
===================================================================
--- pkg/R/bsktest.R	2011-05-09 20:27:31 UTC (rev 111)
+++ pkg/R/bsktest.R	2011-05-16 20:28:51 UTC (rev 112)
@@ -15,16 +15,18 @@
 #}
 
 `bsktest.formula` <-
-function(x, data, listw, test=c("LMH","LM1","LM2","CLMlambda","CLMmu"), index=NULL, ...){
+function(x, data, index=NULL, listw,
+         test=c("LMH","LM1","LM2","CLMlambda","CLMmu"),
+         standardize=TRUE, ...){
   
 
 switch(match.arg(test), LM1 = {
 
-    bsk = slm1test(x, data, index,  listw, ...)
+    bsk = slm1test(x, data, index,  listw, standardize, ...)
 
   }, LM2 = {
 
-    bsk = slm2test(x, data, index,  listw, ...)
+    bsk = slm2test(x, data, index,  listw, standardize, ...)
 
   }, LMH = {
 
@@ -248,7 +250,7 @@
 
 
 `slm1test` <-
-function(formula, data, index=NULL,  listw, ...){
+function(formula, data, index=NULL, listw, standardize, ...){
 
   if(!is.null(index)) { ####can be deleted when using the wrapper
     require(plm)
@@ -327,11 +329,10 @@
 
 SLM1<-((G+1)- Ed1)/sqrt(Vd1) 
 
-STAT2<- qnorm(0.95,lower.tail=TRUE)
-	statistics<-LM1
-  pval <- 2*pnorm(LM1, lower.tail=FALSE)
+  statistics <- if(standardize) SLM1 else LM1
+  pval <- 2*pnorm(statistics, lower.tail=FALSE)
 	
-  names(statistics)="LM1"
+  names(statistics) <- if(standardize) "SLM1" else "LM1"
 	method<- "Baltagi, Song and Koh SLM1 marginal test"
   dname <- deparse(formula)
   RVAL <- list(statistic = statistics,
@@ -343,7 +344,7 @@
 
 
 `slm2test` <-
-function(formula, data, index=NULL, listw, ...){
+function(formula, data, index=NULL, listw, standardize, ...){
 
   if(!is.null(index)) { 
     require(plm)
@@ -420,12 +421,12 @@
 	d2<-crossprod(e,We)/ee
 	
 	SLM2<- (d2-Ed2)/sqrt(Vd2) 
-
-STAT2<- qnorm(0.95,lower.tail=TRUE)
-	statistics<-LM2
-  pval <- 2*pnorm(LM2, lower.tail=FALSE)
-
-  names(statistics)="LM2"
+  
+  statistics <- if(standardize) SLM2 else LM2
+  pval <- 2*pnorm(statistics, lower.tail=FALSE)
+	
+  names(statistics) <- if(standardize) "SLM2" else "LM2"
+  
 	method<- "Baltagi, Song and Koh LM2 marginal test"
   dname <- deparse(formula)
   RVAL <- list(statistic = statistics,

Modified: pkg/man/bsktest.Rd
===================================================================
--- pkg/man/bsktest.Rd	2011-05-09 20:27:31 UTC (rev 111)
+++ pkg/man/bsktest.Rd	2011-05-16 20:28:51 UTC (rev 112)
@@ -9,7 +9,8 @@
 }
 \usage{
 bsktest(x,...)
-\method{bsktest}{formula}(x, data, listw, test=c("LMH","LM1","LM2","CLMlambda","CLMmu"), index=NULL, ...)
+\method{bsktest}{formula}(x, data, index=NULL, listw,
+test=c("LMH","LM1","LM2","CLMlambda","CLMmu"), standardize=TRUE, ...)
 }
 \arguments{
 \item{x}{an object of class  \code{formula}}
@@ -17,7 +18,9 @@
   in the model. When the obect is a \code{\link{data.frame}}, the first two columns may contain the indexes. See \code{index}}
   \item{index}{if not NULL (default), a character vector to identify the indexes among the columns of the \code{\link{data.frame}}}
 \item{listw}{an object of class \code{listw} created for example by \code{nb2listw} }
-\item{test}{one of \code{c("LMH","LM1","LM2","CLMlambda","CLMmu")}, the test to be performed}
+\item{test}{one of \code{c("LMH","LM1","LM2","CLMlambda","CLMmu")}, the
+  test to be performed}
+\item{standardize}{whether to standardize the test statistic or not (applies only to LM1 and LM2)}
 \item{...}{additional arguments to be passed}
 }
 
@@ -32,11 +35,10 @@
 
 \examples{
 data(Produc, package="Ecdat")
-Produc <- Produc[Produc$year<1975, ]
 data(usaww)
 fm <- log(gsp)~log(pcap)+log(pc)+log(emp)+unemp
 bsktest(fm,data=Produc, listw = mat2listw(usaww),
   test="LM1")
 }
 
-\keyword{htest}
\ No newline at end of file
+\keyword{htest}

Modified: pkg/man/effects.splm.Rd
===================================================================
--- pkg/man/effects.splm.Rd	2011-05-09 20:27:31 UTC (rev 111)
+++ pkg/man/effects.splm.Rd	2011-05-16 20:28:51 UTC (rev 112)
@@ -53,7 +53,6 @@
 \examples{
 data(Produc, package = "Ecdat")
 data(usaww)
-Produc <- Produc[Produc$year<1975, ]
 fm <- log(gsp) ~ log(pcap) + log(pc) + log(emp) + unemp
 lag <- spfeml(fm, data = Produc, listw = mat2listw(usaww), effects = "sptpfe", method = "eigen", quiet = TRUE) 
 summary(lag)

Modified: pkg/man/print.splm.Rd
===================================================================
--- pkg/man/print.splm.Rd	2011-05-09 20:27:31 UTC (rev 111)
+++ pkg/man/print.splm.Rd	2011-05-16 20:28:51 UTC (rev 112)
@@ -40,7 +40,6 @@
 \examples{
 data(Produc, package = "Ecdat") 
 data(usaww)
-Produc <- Produc[Produc$year<1975, ] 
 GM<-spgm(log(gsp)~log(pcap)+log(pc)+log(emp)+unemp, data=Produc, listw = usaww, moments="fullweights", spatial.error= TRUE)
 summary(GM)
 }

Modified: pkg/man/spgm.Rd
===================================================================
--- pkg/man/spgm.Rd	2011-05-09 20:27:31 UTC (rev 111)
+++ pkg/man/spgm.Rd	2011-05-16 20:28:51 UTC (rev 112)
@@ -133,7 +133,6 @@
 \examples{
 data(Produc, package = "Ecdat") 
 data(usaww)
-Produc <- Produc[Produc$year<1975, ] 
 GM<-spgm(log(gsp)~log(pcap)+log(pc)+log(emp)+unemp, data=Produc,listw = usaww, moments="fullweights", spatial.error = TRUE)
 summary(GM)
 }

Modified: pkg/man/sphtest.Rd
===================================================================
--- pkg/man/sphtest.Rd	2011-05-09 20:27:31 UTC (rev 111)
+++ pkg/man/sphtest.Rd	2011-05-16 20:28:51 UTC (rev 112)
@@ -35,7 +35,6 @@
 
 \examples{
 data(Produc, package="Ecdat")
-Produc <- Produc[Produc$year<1975, ]
 data(usaww)
 fm <- log(gsp)~log(pcap)+log(pc)+log(emp)+unemp
 test1<-sphtest(fm,data=Produc, listw = mat2listw(usaww), spatial.model = "error", method="GM")
@@ -43,6 +42,6 @@
 mod1<- spgm(fm, data=Produc, listw = usaww, model = "random", spatial.error = TRUE, moments="fullweights")
 mod2<- spgm(fm, data=Produc, listw = usaww, model = "within", spatial.error = TRUE)
 test2<-sphtest(mod1, mod2)
-summary(test2)
+test2
 }
 \keyword{htest}
\ No newline at end of file

Modified: pkg/man/spml.Rd
===================================================================
--- pkg/man/spml.Rd	2011-05-09 20:27:31 UTC (rev 111)
+++ pkg/man/spml.Rd	2011-05-16 20:28:51 UTC (rev 112)
@@ -77,7 +77,6 @@
 \examples{
 data(Produc, package = "Ecdat")
 data(usaww)
-Produc <- Produc[Produc$year<1974, ]
 fm <- log(gsp) ~ log(pcap) + log(pc) + log(emp) + unemp
 ## the two standard specifications:
 ## random effects panel with spatial errors

Modified: pkg/man/summary.splm.Rd
===================================================================
--- pkg/man/summary.splm.Rd	2011-05-09 20:27:31 UTC (rev 111)
+++ pkg/man/summary.splm.Rd	2011-05-16 20:28:51 UTC (rev 112)
@@ -45,7 +45,6 @@
 \examples{
 data(Produc, package = "Ecdat") 
 data(usaww)
-Produc <- Produc[Produc$year<1975, ] 
 GM<-spgm(log(gsp)~log(pcap)+log(pc)+log(emp)+unemp, data=Produc, listw = usaww, moments = "fullweights", spatial.error = TRUE)
 summary(GM)
 }

Modified: pkg/man/write.effects.splm.Rd
===================================================================
--- pkg/man/write.effects.splm.Rd	2011-05-09 20:27:31 UTC (rev 111)
+++ pkg/man/write.effects.splm.Rd	2011-05-16 20:28:51 UTC (rev 112)
@@ -46,7 +46,6 @@
 \examples{
 data(Produc, package = "Ecdat")
 data(usaww)
-Produc <- Produc[Produc$year<1975, ]
 fm <- log(gsp) ~ log(pcap) + log(pc) + log(emp) + unemp
 lag <- spfeml(fm, data = Produc, listw = mat2listw(usaww), effects = "sptpfe", method = "eigen", quiet = TRUE)
 summary(lag)



More information about the Splm-commits mailing list