[Splm-commits] r131 - pkg/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Sep 7 19:42:07 CEST 2011


Author: gpiras
Date: 2011-09-07 19:42:07 +0200 (Wed, 07 Sep 2011)
New Revision: 131

Modified:
   pkg/R/ivsplm.R
   pkg/R/spfeml.R
   pkg/R/spgm.R
   pkg/R/summary.splm.R
Log:
printing and other stuffs for fixed effects models

Modified: pkg/R/ivsplm.R
===================================================================
--- pkg/R/ivsplm.R	2011-09-01 18:56:19 UTC (rev 130)
+++ pkg/R/ivsplm.R	2011-09-07 17:42:07 UTC (rev 131)
@@ -1,6 +1,8 @@
 
-ivsplm<-function(formula,data=list(), index=NULL, endog = NULL, instruments= NULL, method = c("w2sls", "b2sls", "g2sls", "ec2sls"), lag = FALSE, listw){
-	
+ivsplm<-function(formula,data=list(), index=NULL, endog = NULL, instruments= NULL, method = c("w2sls", "b2sls", "g2sls", "ec2sls"), lag = FALSE, listw, effects = NULL){
+
+if(length(method) !=1 && effects == "fixed") method <- "w2sls" 	
+if(length(method) !=1 && effects == "random") method <- "ec2sls" 	
 		
   if(!is.null(index)) {
     require(plm)

Modified: pkg/R/spfeml.R
===================================================================
--- pkg/R/spfeml.R	2011-09-01 18:56:19 UTC (rev 130)
+++ pkg/R/spfeml.R	2011-09-07 17:42:07 UTC (rev 131)
@@ -72,7 +72,7 @@
   #make sure that the model has no intercept if effects !=pooled
   if (effects !="pooled" && colnames(x)[1]=="(Intercept)") {
   	x<-x[,-1]
-  	cat('\n Warning: x may not contain an intercept if fixed effects are specified \n')
+  	#cat('\n Warning: x may not contain an intercept if fixed effects are specified \n')
 	}
 
 if(is.vector(x)){

Modified: pkg/R/spgm.R
===================================================================
--- pkg/R/spgm.R	2011-09-01 18:56:19 UTC (rev 130)
+++ pkg/R/spgm.R	2011-09-07 17:42:07 UTC (rev 131)
@@ -6,28 +6,37 @@
 ## translation for uniformity
 effects <- switch(match.arg(model), within="fixed", random="random")
 
-#source('utilities_GM.R')
-#source('listw2dgCMatrix.R')
-#source('summary.splm.R')
-#source('print.splm.R')
-#source('print.summary.splm.R')
+# source('tss.R')
+# source('sumres.R')
+# source('utilities_GM.R')
+# source('listw2dgCMatrix.R')
+# source('summary.splm.R')
+# source('print.splm.R')
+# source('print.summary.splm.R')
 #
 #
 #
-#	source("ivsplm.R")
-#	source("ivplm.w2sls.R")
-#	source("ivplm.b2sls.R")	
-#	source("ivplm.g2sls.R")
-#	source("ivplm.ec2sls.R")
+	# source("ivsplm.R")
+	# source("ivplm.w2sls.R")
+	# source("ivplm.b2sls.R")	
+	# source("ivplm.g2sls.R")
+	# source("ivplm.ec2sls.R")
 #	source("sperrorgm2.R")		
 ##	source("spsarargm3.R")		##working with the Mutl and Pfaff. procedure
 #	source("spsarargm4.R")	#works fine with a modified procedure
 #source("spsarargm5.R")	
 
+
+if(model == "within" && attr(terms(formula), "intercept") == 0 ) formula <- as.formula(paste(attr(terms(formula),"variables")[1+attr(terms(formula),"response")], paste(attr(terms(formula),"term.labels"), collapse="+"), sep="~"))
+
+	
+	
+
+
 cl<-match.call()
 if(!spatial.error){
 	
-	results<-ivsplm(formula = formula, data=data, index = index, endog = endog, instruments = instruments, method = method, lag = lag, listw = listw)
+	results<-ivsplm(formula = formula, effects = effects, data=data, index = index, endog = endog, instruments = instruments, method = method, lag = lag, listw = listw)
 	
 	}
 
@@ -325,6 +334,8 @@
 	names(betaGLS)<-colnames(xf)
   errcomp<-rbind(finrho,finsigmaV)
   nam.errcomp <- c("rho","sigma^2_v")
+    rownames(errcomp) <- nam.errcomp
+  colnames(errcomp)<-"Estimate"
    model.data <- data.frame(cbind(y,x[,-1]))
 
   type <- "fixed effects GM"
@@ -830,7 +841,7 @@
   errcomp<-rbind(finrho,finsigmaV)
   nam.errcomp <- c("rho","sigma^2_v")
   rownames(errcomp) <- nam.errcomp
-  colnames(errcomp)<-"Estimated error component"
+  colnames(errcomp)<-"Estimate"
 model.data <- data.frame(cbind(y,x))
 
   type <- "fixed effects GM"
@@ -1020,7 +1031,7 @@
   errcomp<-rbind(finrho,finsigmaV,finsigma1,theta)
   nam.errcomp <- c("rho","sigma^2_v",'sigma^2_1',"theta")
   rownames(errcomp) <- nam.errcomp
-  colnames(errcomp)<-"Estimated error component"
+  colnames(errcomp)<-"Estimate"
 model.data <- data.frame(cbind(y,x))
 
   type <- "random effects GM"

Modified: pkg/R/summary.splm.R
===================================================================
--- pkg/R/summary.splm.R	2011-09-01 18:56:19 UTC (rev 130)
+++ pkg/R/summary.splm.R	2011-09-07 17:42:07 UTC (rev 131)
@@ -35,6 +35,11 @@
                 lambda <- object$rho
                 object$lambda <- lambda
             }
+
+            if (object$type == "fixed effects GM" ) {
+                lambda <- object$rho
+                object$lambda <- lambda
+            }
 
             ## make AR coefficient of y's table
             if(!is.null(object$vcov.arcoef)) {



More information about the Splm-commits mailing list