[Splm-commits] r184 - in pkg: . R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Jul 9 04:38:50 CEST 2014


Author: gpiras
Date: 2014-07-09 04:38:48 +0200 (Wed, 09 Jul 2014)
New Revision: 184

Modified:
   pkg/ChangeLog
   pkg/DESCRIPTION
   pkg/R/impacts.splm.R
   pkg/R/likelihoodsFE.R
   pkg/R/spfeml.R
   pkg/R/spml.R
   pkg/R/summary.splm.R
Log:
changes mail viton

Modified: pkg/ChangeLog
===================================================================
--- pkg/ChangeLog	2013-12-11 01:43:41 UTC (rev 183)
+++ pkg/ChangeLog	2014-07-09 02:38:48 UTC (rev 184)
@@ -1,3 +1,6 @@
+Changes in Version 1.3.00
+ o All changes documented in: Piras, G. “Impact estimates for static panel data models in R”. url: http://rri.wvu.edu/wp-content/uploads/2012/11/Piras_ImpactEstimatesForStaticSpatial2013-05.pdf fixed thanks to the email from Viton
+
 Changes in Version 1.2.00
  o All changes documented in: Piras, G. “Impact estimates for static panel data models in R”. url: http://rri.wvu.edu/wp-content/uploads/2012/11/Piras_ImpactEstimatesForStaticSpatial2013-05.pdf
 

Modified: pkg/DESCRIPTION
===================================================================
--- pkg/DESCRIPTION	2013-12-11 01:43:41 UTC (rev 183)
+++ pkg/DESCRIPTION	2014-07-09 02:38:48 UTC (rev 184)
@@ -1,6 +1,6 @@
 Package: splm
 Title: Econometric Models for Spatial Panel Data
-Version: 1.2-0
+Version: 1.3-0
 Date: 2013-11-6
 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/impacts.splm.R
===================================================================
--- pkg/R/impacts.splm.R	2013-12-11 01:43:41 UTC (rev 183)
+++ pkg/R/impacts.splm.R	2014-07-09 02:38:48 UTC (rev 184)
@@ -1,4 +1,5 @@
 impacts.splm<-function(obj, listw = NULL, time = NULL, ..., tr=NULL, R=200, type="mult", empirical=FALSE, Q=NULL){
+
 if(is.null(listw) && is.null(tr)) stop("either listw or tr should be provided")
 
 	

Modified: pkg/R/likelihoodsFE.R
===================================================================
--- pkg/R/likelihoodsFE.R	2013-12-11 01:43:41 UTC (rev 183)
+++ pkg/R/likelihoodsFE.R	2014-07-09 02:38:48 UTC (rev 184)
@@ -178,14 +178,14 @@
         col2 <- rbind(T*tr(WA)/s2, V, three )
         col3 <- rbind(zero, t(three), 1/as.numeric(s2)* xtxt)
         asyvar <- cbind(col1, col2, col3)
-        asyv <- solve(asyvar, tol = con$tol.solve)
-		rownames(asyv) <- colnames(asyv) <- c("sigma","lambda", colnames(xt))
+        asyva <- solve(asyvar, tol = con$tol.solve)
+        rownames(asyva) <- colnames(asyva) <- c("sigma","lambda", colnames(xt))
         
-        lambda.se <- asyv[2, 2]        
-        rest.se <- sqrt(diag(asyv))[-c(1:2)]
-        sig.se <- sqrt(asyv[1, 1])       
-        asyvar1 <- as.matrix(asyv[-c(1,2),-c(1,2)])
-
+        lambda.se <- asyva[2, 2]        
+        rest.se <- sqrt(diag(asyva))[-c(1:2)]
+        sig.se <- sqrt(asyva[1, 1]) 
+        asyv <- asyva[-1,-1]      
+        asyvar1 <- as.matrix(asyva[-c(1,2),-c(1,2)])
         rownames(asyvar1) <- colnames(asyvar1) <- colnames(xt)
 
 
@@ -341,10 +341,10 @@
         asyvar[3:(p + 2), 3:(p + 2)] <- 1/as.numeric(s2) * (t(xt - rho *wxt) %*% (xt - rho * wxt)) 
         asyv <- solve(asyvar, tol = con$tol.solve)
         rownames(asyv) <- colnames(asyv) <- c("sigma","rho", colnames(xt))
+
         s2.se <- sqrt(asyv[1, 1])
         rho.se <- asyv[2, 2]
         asyvar1 <- asyv[-c(1,2),-c(1,2)]
-
 		init <- c((T/(T+1)), rep(1,p+1))	
 
 		a3 <- rep(0,p)
@@ -411,12 +411,13 @@
         asyvar[2, 1] <- asyvar[1, 2] <- T*tr(WA)/s2
         asyvar[2, 2] <- T*(tr(WA %*% WA) + tr(t(WA) %*% WA))
         asyvar[3:(p + 2), 3:(p + 2)] <- 1/as.numeric(s2) * (t(xt - rho *wxt) %*% (xt - rho * wxt)) 
-        asyv <- solve(asyvar, tol = con$tol.solve)
-        rownames(asyv) <- colnames(asyv) <- c("sigma","rho", colnames(xt))
-        s2.se <- sqrt(asyv[1, 1])
-        rho.se <- asyv[2, 2]
-        asyvar1 <- asyv[-c(1,2),-c(1,2)]
-        # rownames(asyvar1) <- colnames(asyvar1) <- c(colnames(xt))
+        asyva <- solve(asyvar, tol = con$tol.solve)
+        rownames(asyva) <- colnames(asyva) <- c("sigma","rho", colnames(xt))
+        s2.se <- sqrt(asyva[1, 1])
+        rho.se <- asyva[2, 2]
+        asyvar1 <- asyva[-c(1,2),-c(1,2)]
+        asyv <- asyva[-1,-1]
+        rownames(asyvar1) <- colnames(asyvar1) <- colnames(xt)
 
         
 
@@ -807,15 +808,17 @@
         asyvar[1+p, 1+p] <- as.matrix(lala)
         asyvar[2+p, 2+p] <- as.matrix(roro)
         asyvar[3+p, 3+p] <- as.matrix(sisi)
-        asyv <- solve(asyvar, tol = con$tol.solve)
-        rownames(asyv) <- colnames(asyv) <- c(colnames(xt), "lambda", "rho", "sigma")
-        s2.se <- asyv[3+p, 3+p]
-        rho.se <- asyv[2+p, 2+p]
-        lambda.se <- asyv[1+p, 1+p]
-        rest.se <- sqrt(diag(asyv))[-((p+1):(p+3))]
-        asyvar1 <- asyv[-((p+1):(p+3)),-((p+1):(p+3))]
+        asyva <- solve(asyvar, tol = con$tol.solve)
+        rownames(asyva) <- colnames(asyva) <- c(colnames(xt), "lambda", "rho", "sigma")
 
+        s2.se <- asyva[3+p, 3+p]
+        rho.se <- asyva[2+p, 2+p]
+        lambda.se <- asyva[1+p, 1+p]
+        rest.se <- sqrt(diag(asyva))[-((p+1):(p+3))]
+        asyvar1 <- asyva[-((p+1):(p+3)),-((p+1):(p+3))]
+        asyv <- asyva[-(p+3),-(p+3)]
 
+
             	}
 
 if(Hess) asyv <- NULL        

Modified: pkg/R/spfeml.R
===================================================================
--- pkg/R/spfeml.R	2013-12-11 01:43:41 UTC (rev 183)
+++ pkg/R/spfeml.R	2014-07-09 02:38:48 UTC (rev 184)
@@ -1,4 +1,4 @@
-spfeml<-function(formula, data=list(), index=NULL, listw, listw2 = NULL, na.action, model = c("lag","error", "sarar"), effects = c('spfe','tpfe','sptpfe'), method="eigen", quiet = TRUE, zero.policy = NULL, interval1 = NULL, interval2 = NULL, trs1 = NULL, trs2 = NULL, tol.solve = 1e-10, control = list(), legacy = FALSE, llprof = NULL, cl = NULL, Hess = TRUE, LeeYu = FALSE, ...){
+spfeml<-function(formula, data=list(), index=NULL, listw, listw2 = NULL, na.action, model = c("lag","error", "sarar"), effects = c('spfe','tpfe','sptpfe'), method="eigen", quiet = TRUE, zero.policy = NULL, interval1 = NULL, interval2 = NULL, trs1 = NULL, trs2 = NULL, tol.solve = 1e-10, control = list(), legacy = FALSE, llprof = NULL, cl = NULL, Hess = FALSE, LeeYu = FALSE, ...){
 
 	  
         # timings <- list()
@@ -399,15 +399,36 @@
 
 Coeff<-c(spat.coef, RES$coeff)
 
+
 type <- paste("fixed effects", model)
 
+if (Hess){
 
-if (!Hess) var <- RES$asyv
+	if(model == "lag" ){
+   		var<-matrix(0,(ncol(RES$asyvar1)+1),(ncol(RES$asyvar1)+1))
+		var[1,1]<-	RES$lambda.se
+		var[(2:ncol(var)),(2:ncol(var))]<-RES$asyvar1
+	}
+	
+	if(model == "error" ){
+	 	var<-matrix(0,(ncol(RES$asyvar1)+1),(ncol(RES$asyvar1)+1))
+    	var[1,1]<-	RES$rho.se
+    	var[(2:ncol(var)),(2:ncol(var))]<-RES$asyvar1
+	}
+	
+	if(model == "sarar"){
+		var <- matrix(0,(ncol(RES$asyvar1)+2),(ncol(RES$asyvar1)+2))
+	    var[1,1] <-	RES$lambda.se
+	    var[2,2] <-	RES$rho.se
+	    var[(3:ncol(var)),(3:ncol(var))] <- RES$asyvar1
+	}
+	
+} 
 
 else{
 
 if(model == "lag" ){
-	var<-matrix(0,(ncol(RES$asyvar1)+1),(ncol(RES$asyvar1)+1))
+   var<-matrix(0,(ncol(RES$asyvar1)+1),(ncol(RES$asyvar1)+1))
    var[1,1]<-	RES$lambda.se
    var[(2:ncol(var)),(2:ncol(var))]<-RES$asyvar1
 	}
@@ -419,20 +440,22 @@
 	}
 	
 if(model == "sarar"){
-	var<-matrix(0,(ncol(RES$asyvar1)+2),(ncol(RES$asyvar1)+2))
+   var<-matrix(0,(ncol(RES$asyvar1)+2),(ncol(RES$asyvar1)+2))
    var[1,1]<-	RES$lambda.se
    var[2,2]<-	RES$rho.se
    var[(3:ncol(var)),(3:ncol(var))]<-RES$asyvar1
+
 	}
 
 }
 
+
 spmod <- list(coefficients=Coeff, errcomp=NULL,
                 vcov = var ,spat.coef=spat.coef,
                 vcov.errcomp=NULL,
                 residuals=res, fitted.values=y.hat,
-                sigma2=RES$s2, type=type, model=model.data,
-                call=cl, logLik=RES$ll, method=method, effects=effects, 
+                sigma2=RES$s2, type=type, model = model.data,
+                call=cl, logLik=RES$ll, method = method, effects=effects, 
                 res.eff=res.eff)
                 
 if (!is.null(na.act)) 

Modified: pkg/R/spml.R
===================================================================
--- pkg/R/spml.R	2013-12-11 01:43:41 UTC (rev 183)
+++ pkg/R/spml.R	2014-07-09 02:38:48 UTC (rev 184)
@@ -52,6 +52,7 @@
     }
     effects <- switch(match.arg(effect), individual="spfe",
                       time="tpfe", twoways="sptpfe")
+
     res <- spfeml(formula=formula, data=data, index=index,
                   listw=listw, listw2=listw2, na.action,
                   model=model, effects=effects,

Modified: pkg/R/summary.splm.R
===================================================================
--- pkg/R/summary.splm.R	2013-12-11 01:43:41 UTC (rev 183)
+++ pkg/R/summary.splm.R	2014-07-09 02:38:48 UTC (rev 184)
@@ -12,6 +12,7 @@
             ## make coefficients' table if vcov exist
             if (!is.null(object$vcov)) {
                 std.err <- sqrt(diag(object$vcov))
+               
 #if(object$type == "fixed effects sarar")  std.err <- c(object$se.spat, sqrt(diag(object$vcov)))
                  #vcov(object) doesn't work
                 b <- coefficients(object)



More information about the Splm-commits mailing list