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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Jan 8 19:16:01 CET 2016


Author: the_sculler
Date: 2016-01-08 19:16:01 +0100 (Fri, 08 Jan 2016)
New Revision: 204

Modified:
   pkg/ChangeLog
   pkg/DESCRIPTION
   pkg/R/bsktest.R
   pkg/R/spfeml.R
   pkg/R/spml.R
   pkg/R/spreml.R
   pkg/man/bsktest.Rd
Log:
Fixes in spml.R, spreml.R and bsktest.R, see ChangeLog


Modified: pkg/ChangeLog
===================================================================
--- pkg/ChangeLog	2015-12-03 23:11:20 UTC (rev 203)
+++ pkg/ChangeLog	2016-01-08 18:16:01 UTC (rev 204)
@@ -1,6 +1,12 @@
+Changes in Version 1.4-2
+ o Set method="eigen" as default in bsktest, as claimed in the "Arguments" section of the docs bsktest.Rd (previous setting at NULL broke clmmtest()); fixed bsktest.Rd accordingly (Usage section).
+
 Changes in Version 1.4-0
- o Harmonized print.summary for fixed and random models (now fixed print spatial parms separately). Improved header of printout for random type models, now prints a correct description of model type. Fixed cllistw() internal function for checking whether listw is a listw or a matrix and convert if needed. 
+ o Removed special case from beginning of spml(), allegedly for consistency with bsktest(), which actually never calls spml (but spfeml() directly). Added missing 'index' argument to data transformation module in spreml.R.
 
+Changes in Version 1.4-0
+ o Harmonized print.summary for fixed and random models (now fixed print spatial parms separately). Improved header of printout for random type models, now prints a correct description of model type. Fixed cllistw() internal function for checking whether listw is a listw or a matrix and convert if needed.
+
 Changes in Version 1.3-11
  o Fixed 'itaww.rda' weights matrix for Italian provinces. An '1' was missing between 98 (Lodi) and 19 (Cremona).
 

Modified: pkg/DESCRIPTION
===================================================================
--- pkg/DESCRIPTION	2015-12-03 23:11:20 UTC (rev 203)
+++ pkg/DESCRIPTION	2016-01-08 18:16:01 UTC (rev 204)
@@ -1,14 +1,14 @@
-Package: splm
-Title: Econometric Models for Spatial Panel Data
-Version: 1.4-0
-Date: 2015-12-04
-Authors at R: c(person(given = "Giovanni", family = "Millo", role = c("aut", "cre"), email = "giovanni.millo at generali.com"),
+Package: splm
+Title: Econometric Models for Spatial Panel Data
+Version: 1.4-2
+Date: 2016-01-08
+Authors at R: c(person(given = "Giovanni", family = "Millo", role = c("aut", "cre"), email = "giovanni.millo at generali.com"),
              person(given = "Gianfranco", family = "Piras", role = c("aut"), email = "gpiras at mac.com"))
 Author: Giovanni Millo [aut, cre],
 	Gianfranco Piras [aut]
-Maintainer: Giovanni Millo <giovanni.millo at generali.com>
-Description: ML and GM estimation and diagnostic testing of econometric models for spatial panel data.
-Depends: R (>= 2.12.0), spdep
+Maintainer: Giovanni Millo <giovanni.millo at generali.com>
+Description: ML and GM estimation and diagnostic testing of econometric models for spatial panel data.
+Depends: R (>= 2.12.0), spdep
 Imports: plm, maxLik, MASS, bdsmatrix, ibdreg, nlme, Matrix, spam
-License: GPL-2
-LazyLoad: yes
+License: GPL-2
+LazyLoad: yes

Modified: pkg/R/bsktest.R
===================================================================
--- pkg/R/bsktest.R	2015-12-03 23:11:20 UTC (rev 203)
+++ pkg/R/bsktest.R	2016-01-08 18:16:01 UTC (rev 204)
@@ -17,7 +17,7 @@
 `bsktest.formula` <-
 function(x, data, index=NULL, listw,
          test=c("LMH","LM1","LM2","CLMlambda","CLMmu"),
-         standardize=TRUE, method = NULL, ...){
+         standardize=TRUE, method = "eigen", ...){
   
 switch(match.arg(test), LM1 = {
 

Modified: pkg/R/spfeml.R
===================================================================
--- pkg/R/spfeml.R	2015-12-03 23:11:20 UTC (rev 203)
+++ pkg/R/spfeml.R	2016-01-08 18:16:01 UTC (rev 204)
@@ -6,7 +6,6 @@
 model<-match.arg(model)
 effects <- match.arg(effects)
 
-
 if (model == "sarar") con <- list(LAPACK = FALSE,  Imult = 2L, cheb_q = 5L, MC_p = 16L, MC_m=30L, super=FALSE, opt_method = "nlminb", opt_control = list(), pars = NULL, npars = 4L, pre_eig1 = NULL, pre_eig2 = NULL)
 
 else     con <- list(tol.opt = .Machine$double.eps^0.5,  Imult = 2, cheb_q = 5, MC_p = 16, MC_m = 30, super = NULL, spamPivot = "MMD", in_coef = 0.1, type = "MC", correct = TRUE, trunc = TRUE, SE_method = "LU", nrho = 200, interpn = 2000, SElndet = NULL, LU_order = FALSE, pre_eig = NULL)
@@ -53,6 +52,22 @@
   if(dim(data)[[1]]!=length(index)) stop("Non conformable arguments")
 
   ## reduce X,y to model matrix values (no NAs)
+
+  ## the old module based on standard model.matrix etc.
+  ## can be substituted by the module taken from spreml() in
+  ## order to use the functions from 'plm', so that any
+  ## panel transformation of the data can in principle
+  ## be employed (e.g., slag() for spatial Durbins).
+  ## Ready to employ under here:
+  #
+  ## data management through plm functions
+  # pmod <- plm(formula, data, index=index, model="pooling")
+  #  X <- model.matrix(pmod)
+  #  y <- pmodel.response(pmod)
+  #  ind <- attr(pmod$model, "index")[, 1]
+  #  tind <- attr(pmod$model, "index")[, 2]
+  ## Gio 8/1/16
+
   x<-model.matrix(formula,data=data)
   clnames <- colnames(x)
   rwnames <- rownames(x)

Modified: pkg/R/spml.R
===================================================================
--- pkg/R/spml.R	2015-12-03 23:11:20 UTC (rev 203)
+++ pkg/R/spml.R	2016-01-08 18:16:01 UTC (rev 204)
@@ -30,31 +30,30 @@
 
   ## dimensions check is moved downstream
 
-##added by gpiras on November 25, 2015 for consistency with the test bsk
+  ##added by gpiras on November 25, 2015 for consistency with the test bsk
+  ## removed by the_sculler on Jan 8 2016 because bsktest() never calls spml()
 
-
-if(model == 'pooling' && spatial.error == 'b' && lag ==FALSE){
-
-	res <- spfeml(formula=formula, data=data, index=index,
-                  listw=listw, listw2=listw2, na.action,
-                  model = 'error', effects = "pooling",
-                  cl=cl, ...)
-}
-else{
+  #if(model == 'pooling' && spatial.error == 'b' && lag ==FALSE){
+  #
+  #	res <- spfeml(formula=formula, data=data, index=index,
+  #                listw=listw, listw2=listw2, na.action,
+  #                model = 'error', effects = "pooling",
+  #                cl=cl, ...)
+  #}
+  #else{
   switch(match.arg(model), within={
   
     if(lag) {
-      model <- switch(match.arg(spatial.error), b="sarar",
-                      kkp="sarar", none="lag")
+        model <- switch(match.arg(spatial.error),
+                        b="sarar",
+                        kkp="sarar",
+                        none="lag")
     } else {
-    	
-
-    	model <- switch(match.arg(spatial.error), b="error",
-                      kkp="error", none="plm")
-                      
-                      
-                      
-      if(model == "plm") stop("No spatial component, use plm instead")
+        model <- switch(match.arg(spatial.error),
+                        b="error",
+                        kkp="error",
+                        none="plm")
+        if(model == "plm") stop("No spatial component, use plm instead")
         ## put call to plm() here, fetch results
         ## and suitably transform them for compliance
     }
@@ -83,7 +82,7 @@
                   lag=lag, errors=errors, cl=cl, ...)
          })
 
-}
+   #}
   return(res)
 }
 

Modified: pkg/R/spreml.R
===================================================================
--- pkg/R/spreml.R	2015-12-03 23:11:20 UTC (rev 203)
+++ pkg/R/spreml.R	2016-01-08 18:16:01 UTC (rev 204)
@@ -30,7 +30,7 @@
 #    y <- model.response(model.frame(formula, data = data))
 
     ## data management through plm functions
-    pmod <- plm(formula, data, model="pooling")
+    pmod <- plm(formula, data, index=index, model="pooling")
     X <- model.matrix(pmod)
     y <- pmodel.response(pmod)
     

Modified: pkg/man/bsktest.Rd
===================================================================
--- pkg/man/bsktest.Rd	2015-12-03 23:11:20 UTC (rev 203)
+++ pkg/man/bsktest.Rd	2016-01-08 18:16:01 UTC (rev 204)
@@ -11,7 +11,7 @@
 bsktest(x,...)
 \method{bsktest}{formula}(x, data, index=NULL, listw,
 test=c("LMH","LM1","LM2","CLMlambda","CLMmu"), 
-standardize=TRUE, method = NULL, ...)
+standardize=TRUE, method = "eigen", ...)
 }
 \arguments{
 \item{x}{a \code{formula}}



More information about the Splm-commits mailing list