[Splm-commits] r86 - / pkg pkg/splm pkg/splm/R pkg/splm/chm pkg/splm/data pkg/splm/inst pkg/splm/man pkg/splm.Rcheck pkg/splm.Rcheck/splm pkg/splm.Rcheck/splm/Meta pkg/splm.Rcheck/splm/R pkg/splm.Rcheck/splm/data pkg/splm.Rcheck/splm/doc pkg/splm.Rcheck/splm/help pkg/splm.Rcheck/splm/html pkg/www

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Oct 13 17:59:16 CEST 2010


Author: gpiras
Date: 2010-10-13 17:59:16 +0200 (Wed, 13 Oct 2010)
New Revision: 86

Added:
   pkg/
   pkg/splm.Rcheck/
   pkg/splm.Rcheck/00check.log
   pkg/splm.Rcheck/00install.out
   pkg/splm.Rcheck/R.css
   pkg/splm.Rcheck/Rdlatex.log
   pkg/splm.Rcheck/effects
   pkg/splm.Rcheck/splm-Ex.R
   pkg/splm.Rcheck/splm-Ex.Rout
   pkg/splm.Rcheck/splm-Ex.ps
   pkg/splm.Rcheck/splm-manual.log
   pkg/splm.Rcheck/splm-manual.pdf
   pkg/splm.Rcheck/splm/
   pkg/splm.Rcheck/splm/DESCRIPTION
   pkg/splm.Rcheck/splm/INDEX
   pkg/splm.Rcheck/splm/Meta/
   pkg/splm.Rcheck/splm/Meta/Rd.rds
   pkg/splm.Rcheck/splm/Meta/data.rds
   pkg/splm.Rcheck/splm/Meta/hsearch.rds
   pkg/splm.Rcheck/splm/Meta/links.rds
   pkg/splm.Rcheck/splm/Meta/nsInfo.rds
   pkg/splm.Rcheck/splm/Meta/package.rds
   pkg/splm.Rcheck/splm/NAMESPACE
   pkg/splm.Rcheck/splm/R/
   pkg/splm.Rcheck/splm/R/splm
   pkg/splm.Rcheck/splm/R/splm.rdb
   pkg/splm.Rcheck/splm/R/splm.rdx
   pkg/splm.Rcheck/splm/data/
   pkg/splm.Rcheck/splm/data/usaww.rda
   pkg/splm.Rcheck/splm/doc/
   pkg/splm.Rcheck/splm/doc/index.html
   pkg/splm.Rcheck/splm/help/
   pkg/splm.Rcheck/splm/help/AnIndex
   pkg/splm.Rcheck/splm/help/aliases.rds
   pkg/splm.Rcheck/splm/help/paths.rds
   pkg/splm.Rcheck/splm/help/splm.rdb
   pkg/splm.Rcheck/splm/help/splm.rdx
   pkg/splm.Rcheck/splm/html/
   pkg/splm.Rcheck/splm/html/00Index.html
   pkg/splm/
   pkg/splm/ChangeLog
   pkg/splm/DESCRIPTION
   pkg/splm/NAMESPACE
   pkg/splm/R/
   pkg/splm/R/LMHtest.R
   pkg/splm/R/LMHtest.model.R
   pkg/splm/R/REmod.R
   pkg/splm/R/bsjktest.R
   pkg/splm/R/bsjktest.formula.R
   pkg/splm/R/bsktest.R
   pkg/splm/R/bsktest.formula.R
   pkg/splm/R/bsktest.lm.R
   pkg/splm/R/bsktest.splm.R
   pkg/splm/R/clmltest.R
   pkg/splm/R/clmltest.model.R
   pkg/splm/R/clmmtest.R
   pkg/splm/R/clmmtest.model.R
   pkg/splm/R/fixed_effects.R
   pkg/splm/R/likelihoodsFE.R
   pkg/splm/R/listw2dgCMatrix.R
   pkg/splm/R/pbsjkARtest.R
   pkg/splm/R/pbsjkJtest.R
   pkg/splm/R/pbsjkREtest.R
   pkg/splm/R/pbsjkSDtest.R
   pkg/splm/R/print.splm.R
   pkg/splm/R/print.summary.splm.R
   pkg/splm/R/sarREmod.R
   pkg/splm/R/semREmod.R
   pkg/splm/R/semarREmod.R
   pkg/splm/R/semarmod.R
   pkg/splm/R/semmod.R
   pkg/splm/R/slm1test.R
   pkg/splm/R/slm1test.model.R
   pkg/splm/R/slm2test.R
   pkg/splm/R/slm2test.model.R
   pkg/splm/R/spfegm.R
   pkg/splm/R/spfeml.R
   pkg/splm/R/spregm.R
   pkg/splm/R/spreml.R
   pkg/splm/R/spsegm.R
   pkg/splm/R/spseml.R
   pkg/splm/R/ssrREmod.R
   pkg/splm/R/ssrmod.R
   pkg/splm/R/summary.effects.splm.R.old
   pkg/splm/R/summary.splm.R
   pkg/splm/R/sumres.R
   pkg/splm/R/tss.R
   pkg/splm/R/utilities_GM.R
   pkg/splm/R/vcov.splm.R
   pkg/splm/chm/
   pkg/splm/chm/00Index.html
   pkg/splm/chm/Rchm.css
   pkg/splm/chm/bsjktest.html
   pkg/splm/chm/bsktest.html
   pkg/splm/chm/effects.splm.html
   pkg/splm/chm/logo.jpg
   pkg/splm/chm/print.splm.html
   pkg/splm/chm/spfeml.html
   pkg/splm/chm/splm-package.html
   pkg/splm/chm/splm.hhp
   pkg/splm/chm/splm.toc
   pkg/splm/chm/spregm.html
   pkg/splm/chm/spreml.html
   pkg/splm/chm/spsegm.html
   pkg/splm/chm/summary.splm.html
   pkg/splm/data/
   pkg/splm/data/usaww.rda
   pkg/splm/inst/
   pkg/splm/inst/doc/
   pkg/splm/man/
   pkg/splm/man/bsjktest.Rd
   pkg/splm/man/bsktest.Rd
   pkg/splm/man/effects.splm.Rd
   pkg/splm/man/listw2dgCMatrix.Rd
   pkg/splm/man/print.effects.splm.Rd
   pkg/splm/man/print.splm.Rd
   pkg/splm/man/spfegm.Rd
   pkg/splm/man/spfeml.Rd
   pkg/splm/man/splm-package.Rd
   pkg/splm/man/spregm.Rd
   pkg/splm/man/spreml.Rd
   pkg/splm/man/spsegm.Rd
   pkg/splm/man/spseml.Rd
   pkg/splm/man/summary.effects.splm.Rd.old
   pkg/splm/man/summary.splm.Rd
   pkg/splm/man/usaww.Rd
   pkg/splm/man/write.effects.splm.Rd
   pkg/splm_0.2-01.tar.gz
   pkg/www/
   pkg/www/index.php
Log:
Changes in spfeml and more..

Added: pkg/splm/ChangeLog
===================================================================
--- pkg/splm/ChangeLog	                        (rev 0)
+++ pkg/splm/ChangeLog	2010-10-13 15:59:16 UTC (rev 86)
@@ -0,0 +1,13 @@
+Changes in Version 0.2-02
+  o spfeml: Added methods for Jacobian
+
+
+Changes in Version 0.2-01
+
+
+  o spregm: modified to allow for additional endogenous variables and lag of the dependent variable
+  o Added spfegm 
+  o Added spseml
+  o spsegm: improved substantially and now reads a list of formulas. 
+ 
+  
\ No newline at end of file

Added: pkg/splm/DESCRIPTION
===================================================================
--- pkg/splm/DESCRIPTION	                        (rev 0)
+++ pkg/splm/DESCRIPTION	2010-10-13 15:59:16 UTC (rev 86)
@@ -0,0 +1,10 @@
+Package: splm
+Title: Econometric Models for Spatial Panel Data
+Version: 0.2-02
+Date: 2010-09-22
+Author: Giovanni Millo <giovanni.millo at generali.com>, Gianfranco Piras <gpiras at mac.com>
+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.11.1), MASS, nlme, spdep, plm, Matrix, kinship, spam
+License: GPL-2
+LazyLoad: yes


Property changes on: pkg/splm/DESCRIPTION
___________________________________________________________________
Added: svn:executable
   + 

Added: pkg/splm/NAMESPACE
===================================================================
--- pkg/splm/NAMESPACE	                        (rev 0)
+++ pkg/splm/NAMESPACE	2010-10-13 15:59:16 UTC (rev 86)
@@ -0,0 +1,21 @@
+importFrom(stats, model.matrix, model.response, aggregate, effects)
+import(nlme)
+import(spdep)
+import(Matrix)
+importFrom(kinship,bdsmatrix)
+importFrom(MASS,ginv)
+
+export(bsjktest, bsktest, 
+effects.splm, print.effects.splm, write.effects.splm, 
+print.splm,spfeml,spregm,spreml,spsegm,summary.splm, spseml, spsegm, spreml, spfeml, spregm, spfegm,listw2dgCMatrix)
+
+
+
+S3method(print,splm)
+S3method(print,summary.splm)
+S3method(bsjktest,formula)
+S3method(effects,splm)
+S3method(print,effects.splm)
+S3method(bsktest,formula)
+S3method(bsktest,lm)
+S3method(bsktest, splm)


Property changes on: pkg/splm/NAMESPACE
___________________________________________________________________
Added: svn:executable
   + 

Added: pkg/splm/R/LMHtest.R
===================================================================
--- pkg/splm/R/LMHtest.R	                        (rev 0)
+++ pkg/splm/R/LMHtest.R	2010-10-13 15:59:16 UTC (rev 86)
@@ -0,0 +1,97 @@
+`LMHtest` <-
+function(formula, data, index=NULL, listw){
+    ## depends on listw2dgCMatrix.R
+  if(!is.null(index)) { ####can be deleted when using the wrapper
+    require(plm)
+    data <- plm.data(data, index)
+    }
+
+  index <- data[,1]
+  tindex <- data[,2]
+
+  x<-model.matrix(formula,data=data)
+  y<-model.response(model.frame(formula,data=data))
+   cl<-match.call()
+	names(index)<-row.names(data)
+  ind<-index[which(names(index)%in%row.names(x))]
+  tind<-tindex[which(names(index)%in%row.names(x))]
+  ## reorder data by cross-sections, then time
+  oo<-order(tind,ind)
+  x<-x[oo,]
+  y<-y[oo]
+  ind<-ind[oo]
+  tind<-tind[oo]
+
+  ## det. number of groups and df
+  N<-length(unique(ind))
+  k<-dim(x)[[2]]
+  ## det. max. group numerosity
+  T<-max(tapply(x[,1],ind,length))
+  ## det. total number of obs. (robust vs. unbalanced panels)
+  NT<-length(ind)
+	ols<-lm(y~x)
+	XpXi<-solve(crossprod(x))
+   n<-dim(ols$model)[1]
+
+	indic<-seq(1,T)
+	inde<-as.numeric(rep(indic,each=N)) ####indicator to get the cross-sectional observations
+	ind1<-seq(1,N)
+	inde1<-as.numeric(rep(ind1,T)) ####indicator to get the time periods observations
+	bOLS<-coefficients(ols)
+	e<-as.matrix(residuals(ols))
+	ee<-crossprod(e)
+####calculate the elements of LMj, LM1, SLM1
+
+		JIe<-tapply(e,inde1,sum)
+		JIe<-rep(JIe,T) ####calculates (J_T kronecker I_N)*u
+		G<-(crossprod(e,JIe)/crossprod(e))-1 ###calculate G in LMj (same notation as in the paper)
+tr<-function(R) sum(diag(R))
+		LM1<-sqrt((NT/(2*(T-1))))*as.numeric(G) ###same notation as in Baltagi et al.
+
+
+####calculate the elements of LMj, LM1, SLM1
+		Wst<-listw2dgCMatrix(listw) ###transform the listw object in a sparse matrix
+		Ws<-t(Wst)  ### this is the real W since listw2dgCMatrix generate W'
+		WWp<-(Ws+Wst)/2 ##generate (W+W')/2
+yy<-function(q){ #### for very big dimension of the data this can be changed looping over the rows and columns of W or either the listw object
+	wq<-WWp%*%q
+	wq<-as.matrix(wq)
+	}
+		IWWpe<-unlist(tapply(e,inde,yy)) ####calculates (I_T kronecker (W+W')/2)*u
+		H<-crossprod(e,IWWpe)/crossprod(e) #calculate H (same notation as in the paper)
+		W2<-Ws%*%Ws ####generate W^2
+		WW<-crossprod(Ws) ####generate W'*W
+		b<-tr(W2+WW) ###generates b (same notation as the paper)
+#		LMj<-(NT/(2*(T-1)))*as.numeric(G)^2 + ((N^2*T)/b)*as.numeric(H)^2   ###LMj as in the paper
+		LM2<-sqrt((N^2*T)/b)*as.numeric(H)^2 ###same notation as in Baltagi et al.
+if (LM1<=0){
+		if (LM2<=0) JOINT<-0
+		else JOINT<-LM2^2
+		}		####this is chi-square_m in teh notation of the paper.
+	else{
+		if (LM2<=0) JOINT<-LM1^2
+		else JOINT<-LM1^2 + LM2^2
+		}
+STAT<- qchisq(0.05,1,lower.tail=FALSE)
+STAT1<- qchisq(0.05,2,lower.tail=FALSE)
+if (JOINT>=2.952) {
+		if (JOINT<7.289 & JOINT>=4.321) pval<-0.05
+		if (JOINT >= 7.289) pval<-0.01
+		if (JOINT<= 4.321)	pval<-0.1
+	}
+else pval<-1
+
+	statistics<-JOINT
+
+  names(statistics)="LM-H"
+	method<- "Baltagi, Song and Koh LM-H one-sided joint test"
+	#alt<-"serial corr. in error terms, sub RE and spatial dependence"
+  ##(insert usual htest features)
+  dname <- deparse(formula)
+  RVAL <- list(statistic = statistics,
+               method = method,
+               p.value = pval, data.name=deparse(formula), alternative="Random Regional Effects and Spatial autocorrelation")
+  class(RVAL) <- "htest"
+  return(RVAL)
+}
+


Property changes on: pkg/splm/R/LMHtest.R
___________________________________________________________________
Added: svn:executable
   + 

Added: pkg/splm/R/LMHtest.model.R
===================================================================
--- pkg/splm/R/LMHtest.model.R	                        (rev 0)
+++ pkg/splm/R/LMHtest.model.R	2010-10-13 15:59:16 UTC (rev 86)
@@ -0,0 +1,102 @@
+`LMHtest.model` <-
+function(x, listw, index){
+## depends on listw2dgCMatrix.R
+
+if(!inherits(x,"lm")) stop("argument should be an object of class lm")
+
+  if(is.null(index))  stop("index should be specified to retrieve information on time and cross-sectional dimentions")
+
+  if(!inherits(listw,"listw")) stop("object w should be of class listw")
+
+  ind <- index[,1]
+  tind <- index[,2]
+
+###extract objects from x
+  y<-model.response(x$model)
+  e<-as.matrix(residuals(x))
+  	ee<-crossprod(e)
+   n<-dim(x$model)[1]
+  	bOLS<-coefficients(x)
+  	  	  form<-x$call
+  x<-model.matrix(eval(x$call),x$model)
+  #print(x)
+	XpXi<-solve(crossprod(x))
+
+   cl<-match.call()
+  ## reorder data by cross-sections, then time
+  oo<-order(tind,ind)
+  x<-x[oo,]
+  y<-y[oo]
+  e<-e[oo]
+  ind<-ind[oo]
+  tind<-tind[oo]
+
+  ## det. number of groups and df
+  N<-length(unique(ind))
+  k<-dim(x)[[2]]
+  ## det. max. group numerosity
+  T<-max(tapply(x[,1],ind,length))
+  ## det. total number of obs. (robust vs. unbalanced panels)
+  NT<-length(ind)
+#print(c(N,k,T,NT))
+#   print(ols$model)
+#	k<-dim(ols$model)[2]-1
+	indic<-seq(1,T)
+	inde<-as.numeric(rep(indic,each=N)) ####indicator to get the cross-sectional observations
+	ind1<-seq(1,N)
+	inde1<-as.numeric(rep(ind1,T)) ####indicator to get the time periods observations
+####calculate the elements of LMj, LM1, SLM1
+
+		JIe<-tapply(e,inde1,sum)
+		JIe<-rep(JIe,T) ####calculates (J_T kronecker I_N)*u
+		G<-(crossprod(e,JIe)/crossprod(e))-1 ###calculate G in LMj (same notation as in the paper)
+tr<-function(R) sum(diag(R))
+		LM1<-sqrt((NT/(2*(T-1))))*as.numeric(G) ###same notation as in Baltagi et al.
+
+
+####calculate the elements of LMj, LM1, SLM1
+		Wst<-listw2dgCMatrix(listw) ###transform the listw object in a sparse matrix
+		Ws<-t(Wst)  ### this is the real W since listw2dgCMatrix generate W'
+		WWp<-(Ws+Wst)/2 ##generate (W+W')/2
+yy<-function(q){ #### for very big dimension of the data this can be changed looping over the rows and columns of W or either the listw object
+	wq<-WWp%*%q
+	wq<-as.matrix(wq)
+	}
+		IWWpe<-unlist(tapply(e,inde,yy)) ####calculates (I_T kronecker (W+W')/2)*u
+		H<-crossprod(e,IWWpe)/crossprod(e) #calculate H (same notation as in the paper)
+		W2<-Ws%*%Ws ####generate W^2
+		WW<-crossprod(Ws) ####generate W'*W
+		b<-tr(W2+WW) ###generates b (same notation as the paper)
+#		LMj<-(NT/(2*(T-1)))*as.numeric(G)^2 + ((N^2*T)/b)*as.numeric(H)^2   ###LMj as in the paper
+		LM2<-sqrt((N^2*T)/b)*as.numeric(H)^2 ###same notation as in Baltagi et al.
+if (LM1<=0){
+		if (LM2<=0) JOINT<-0
+		else JOINT<-LM2^2
+		}		####this is chi-square_m in teh notation of the paper.
+	else{
+		if (LM2<=0) JOINT<-LM1^2
+		else JOINT<-LM1^2 + LM2^2
+		}
+STAT<- qchisq(0.05,1,lower.tail=FALSE)
+STAT1<- qchisq(0.05,2,lower.tail=FALSE)
+if (JOINT>=2.952) {
+		if (JOINT<7.289 & JOINT>=4.321) pval<-0.05
+		if (JOINT >= 7.289) pval<-0.01
+		if (JOINT<= 4.321)	pval<-0.1
+	}
+else pval<-1
+
+	statistics<-JOINT
+
+  names(statistics)="LM-H"
+	method<- "Baltagi, Song and Koh LM-H one-sided joint test"
+	#alt<-"serial corr. in error terms, sub RE and spatial dependence"
+  ##(insert usual htest features)
+  dname <- deparse(formula)
+  RVAL <- list(statistic = statistics,
+               method = method,
+               p.value = pval, data.name=deparse(form), alternative="Random Regional Effects and Spatial autocorrelation")
+  class(RVAL) <- "htest"
+  return(RVAL)
+}
+


Property changes on: pkg/splm/R/LMHtest.model.R
___________________________________________________________________
Added: svn:executable
   + 

Added: pkg/splm/R/REmod.R
===================================================================
--- pkg/splm/R/REmod.R	                        (rev 0)
+++ pkg/splm/R/REmod.R	2010-10-13 15:59:16 UTC (rev 86)
@@ -0,0 +1,101 @@
+`REmod` <-
+function(X, y, ind, tind, n, k, t, nT, w=NULL, coef0=0,
+         hess=FALSE, trace=trace, x.tol=1.5e-18, rel.tol=1e-15, ...) {
+  ## random effects panel model 'vanilla' ML estimation
+  ## based on general framework, RE structure on errors
+
+  ## MUCH room for optimization! Take framework from ssrRE,
+  ## using kinship etc. (notice inversion of order(ind,tind)!)
+
+  ## Giovanni Millo, Trieste; this version: 22/10/2008.
+
+  ## some useful pieces:
+    Jt<-matrix(1,ncol=t,nrow=t)
+    In<-diag(1,n)
+    It<-diag(1,t)
+    Jbart<-Jt/t
+    Et<-It-Jbart
+
+  ## inverse of Sigma
+    invSigma <- function(phi, n, t) {
+			 invSigma <- 1/(t*phi+1) * kronecker(Jbart, In) + kronecker(Et, In)
+                   invSigma
+                   }
+
+  ## outsource determinant of sigma with an algebraically efficient form!
+
+  ## concentrated likelihood
+    ll.c<-function(phi, y, X, n, t) {
+
+        ## perform GLS
+
+            sigma.1<-invSigma(phi,n,t)
+
+            b.hat<-solve( crossprod(X,sigma.1)%*%X, crossprod(X,sigma.1)%*%y )
+            ehat<-y-X%*%b.hat
+            sigma2ehat<-crossprod(ehat,sigma.1)%*%ehat/(n*t)
+            bhat<-list(betahat=b.hat,e=ehat,sigma2=sigma2ehat)
+
+            e <- bhat[[2]]
+            s2e <- bhat[[3]]
+
+            due <- -n*t/2*log(s2e)
+            tre <- -n/2*log(t*phi+1)
+            quattro <- -1/(2*s2e)*crossprod(e,sigma.1)%*%e
+
+            const <- -(n*t)/2*log(2*pi)
+            ll.c <- const+due+tre+quattro
+            llc <- - ll.c
+            }
+
+  ## iterate (=traballa) until convergence:
+
+  myphi0 <- coef0
+
+  optimum<-nlminb(myphi0, ll.c,
+                  lower=1e-08, upper=1e08,
+                  control=list(x.tol=x.tol, rel.tol=rel.tol, trace=trace),
+                  y=y, X=X, n=n, t=t, ...)
+
+
+  myphi<-optimum$par
+  myll <- optimum$objective
+
+
+  ## optimal values of parms:
+  phi<-myphi
+
+  ## perform GLS
+
+            sigma.1<-invSigma(phi,n,t)
+
+            b.hat<-solve( crossprod(X,sigma.1)%*%X, crossprod(X,sigma.1)%*%y )
+            ehat<-y-X%*%b.hat
+            sigma2ehat<-crossprod(ehat,sigma.1)%*%ehat/(n*t)
+            beta<-list(betahat=b.hat,e=ehat,sigma2=sigma2ehat)
+
+  ## names for coefs and error comp.s
+  nam.beta <- dimnames(X)[[2]]
+  nam.errcomp <- "phi"
+
+  ## calc. cov(b) by GLS
+  covB<-as.numeric(beta[[3]])*solve(crossprod(X,sigma.1)%*%X)
+  dimnames(covB) <- list(nam.beta, nam.beta)
+
+  ## calc. cov(phi) by numerical Hessian
+  covPRL <- solve(-fdHess(myphi, function(x) -ll.c(x,y,X,n,t))$Hessian)
+  dimnames(covPRL) <- list(nam.errcomp, nam.errcomp)
+
+
+  ## make (separate) coefficients' vectors
+  betas <- as.vector(beta[[1]])
+  errcomp <- phi
+  names(betas) <- nam.beta
+  names(errcomp) <- nam.errcomp
+
+  RES <- list(betas=betas, errcomp=errcomp,
+              covB=covB, covPRL=covPRL, ll=myll)
+
+  return(RES)
+  }
+


Property changes on: pkg/splm/R/REmod.R
___________________________________________________________________
Added: svn:executable
   + 

Added: pkg/splm/R/bsjktest.R
===================================================================
--- pkg/splm/R/bsjktest.R	                        (rev 0)
+++ pkg/splm/R/bsjktest.R	2010-10-13 15:59:16 UTC (rev 86)
@@ -0,0 +1,5 @@
+`bsjktest` <-
+function(x,...){
+  UseMethod("bsjktest")
+}
+


Property changes on: pkg/splm/R/bsjktest.R
___________________________________________________________________
Added: svn:executable
   + 

Added: pkg/splm/R/bsjktest.formula.R
===================================================================
--- pkg/splm/R/bsjktest.formula.R	                        (rev 0)
+++ pkg/splm/R/bsjktest.formula.R	2010-10-13 15:59:16 UTC (rev 86)
@@ -0,0 +1,34 @@
+`bsjktest.formula` <-
+function(x, data, w, test=c(paste("C",1:3,sep="."),"J"), index=NULL, ...){
+  ## transform data if needed
+
+  if(!is.null(index)) {
+    require(plm)
+    data <- plm.data(data, index)
+    }
+
+  gindex <- dimnames(data)[[2]][1]
+  tindex <- dimnames(data)[[2]][2]
+
+  switch(match.arg(test), C.1 = {
+
+    bsjk = pbsjkSDtest(formula=x, data=data, w=w, index=index, ...)
+
+  }, C.2 = {
+
+    bsjk = pbsjkARtest(formula=x, data=data, w=w, index=index, ...)
+
+  }, C.3 = {
+
+    bsjk = pbsjkREtest(formula=x, data=data, w=w, index=index, ...)
+
+  }, J = {
+
+    bsjk = pbsjkJtest(formula=x, data=data, w=w, index=index, ...)
+
+  })
+
+  return(bsjk)
+
+}
+


Property changes on: pkg/splm/R/bsjktest.formula.R
___________________________________________________________________
Added: svn:executable
   + 

Added: pkg/splm/R/bsktest.R
===================================================================
--- pkg/splm/R/bsktest.R	                        (rev 0)
+++ pkg/splm/R/bsktest.R	2010-10-13 15:59:16 UTC (rev 86)
@@ -0,0 +1,5 @@
+`bsktest` <-
+function(x,...){
+  UseMethod("bsktest")
+}
+


Property changes on: pkg/splm/R/bsktest.R
___________________________________________________________________
Added: svn:executable
   + 

Added: pkg/splm/R/bsktest.formula.R
===================================================================
--- pkg/splm/R/bsktest.formula.R	                        (rev 0)
+++ pkg/splm/R/bsktest.formula.R	2010-10-13 15:59:16 UTC (rev 86)
@@ -0,0 +1,30 @@
+`bsktest.formula` <-
+function(x, data, w, test=c("SLM1","SLM2","LMJOINT","CLMlambda","CLMmu"), index=NULL, ...){
+  
+
+switch(match.arg(test), SLM1 = {
+
+    bsk = slm1test(x, data, index,  w)
+
+  }, SLM2 = {
+
+    bsk = slm2test(x, data, index,  w)
+
+  }, LMJOINT = {
+
+    bsk = LMHtest(x, data, index,  w)
+
+  }, CLMlambda = {
+
+    bsk = clmltest(x, data, index,  w)
+
+  }, CLMmu = {
+
+    bsk = clmmtest(x, data, index,  w)
+
+  })
+
+  return(bsk)
+
+}
+


Property changes on: pkg/splm/R/bsktest.formula.R
___________________________________________________________________
Added: svn:executable
   + 

Added: pkg/splm/R/bsktest.lm.R
===================================================================
--- pkg/splm/R/bsktest.lm.R	                        (rev 0)
+++ pkg/splm/R/bsktest.lm.R	2010-10-13 15:59:16 UTC (rev 86)
@@ -0,0 +1,20 @@
+`bsktest.lm` <-
+function(x, w, index=NULL, test=c("SLM1","SLM2","LMJOINT"), ...){
+	
+	switch(match.arg(test), SLM1 = {
+
+    bsk = slm1test.model(x,w, index)
+
+  }, SLM2 = {
+
+    bsk = slm2test.model(x,w, index )
+
+  }, LMJOINT = {
+
+    bsk = LMHtest.model(x,w, index)
+
+  })
+
+  return(bsk)
+}
+


Property changes on: pkg/splm/R/bsktest.lm.R
___________________________________________________________________
Added: svn:executable
   + 

Added: pkg/splm/R/bsktest.splm.R
===================================================================
--- pkg/splm/R/bsktest.splm.R	                        (rev 0)
+++ pkg/splm/R/bsktest.splm.R	2010-10-13 15:59:16 UTC (rev 86)
@@ -0,0 +1,16 @@
+`bsktest.splm` <-
+function(x, w, index=NULL, test=c("CLMlambda","CLMmu"), ...){
+	
+	switch(match.arg(test), CLMlambda = {
+
+    bsk = clmltest.model(x,w, index)
+
+  }, CLMmu = {
+
+    bsk = clmmtest.model(x,w, index )
+
+  })
+
+  return(bsk)
+}
+


Property changes on: pkg/splm/R/bsktest.splm.R
___________________________________________________________________
Added: svn:executable
   + 

Added: pkg/splm/R/clmltest.R
===================================================================
--- pkg/splm/R/clmltest.R	                        (rev 0)
+++ pkg/splm/R/clmltest.R	2010-10-13 15:59:16 UTC (rev 86)
@@ -0,0 +1,81 @@
+`clmltest` <-
+function(formula, data, index=NULL, listw){
+    ## depends on listw2dgCMatrix.R, REmod.R, spreml.R
+
+	ml <- spreml(formula, data=data, w=listw2mat(listw), errors="re")
+	  if(!is.null(index)) {
+    require(plm)
+    data <- plm.data(data, index)
+    }
+  index <- data[,1]
+  tindex <- data[,2]
+  X<-model.matrix(formula,data=data)
+  y<-model.response(model.frame(formula,data=data))
+  ## reduce index accordingly
+   names(index)<-row.names(data)
+  ind<-index[which(names(index)%in%row.names(X))]
+  tind<-tindex[which(names(index)%in%row.names(X))]
+
+  ## reorder data by cross-sections, then time
+  oo<-order(tind,ind)
+  X<-X[oo,]
+  y<-y[oo]
+  ind<-ind[oo]
+  tind<-tind[oo]
+
+  ## det. number of groups and df
+  N<-length(unique(ind))
+  k<-dim(X)[[2]]
+  ## det. max. group numerosity
+  T<-max(tapply(X[,1],ind,length))
+  ## det. total number of obs. (robust vs. unbalanced panels)
+  NT<-length(ind)
+	eML<-residuals(ml)
+###maximum likelihood estimation under the null hypothesis that lambda is equal to zero. extract the residuals.
+	indic<-seq(1,T)
+	inde<-as.numeric(rep(indic,each=N)) ####indicator to get the cross-sectional observations
+	ind1<-seq(1,N)
+	inde1<-as.numeric(rep(ind1,T)) ####indicator to get the time periods observations
+
+	eme<-tapply(eML,inde1,mean)
+	emme<-eML - rep(eme,T)
+	sigmav<-crossprod(eML,emme)/(N*(T-1)) ####estimate of the variance component sigma_v
+	sigma1<-crossprod(eML,rep(eme,T))/N ####estimate of the variance component sigma_1
+	c1<-sigmav/sigma1^2
+	c2<-1/sigmav
+	c1e<-as.numeric(c1)*eML
+	Wst<-listw2dgCMatrix(listw) ###transform the listw object in a sparse matrix
+	Ws<-t(Wst)  ### this is the real W since listw2dgCMatrix generate W'
+	WpsW<-Wst+Ws
+yybis<-function(q){ #### for very big dimension of the data this can be changed looping over the rows and columns of W or either the listw object
+	wq<-(WpsW)%*%q
+	wq<-as.matrix(wq)
+	}
+	Wc1e<-unlist(tapply(eML,inde,yybis)) #### (W'+W)*u
+	sumWc1e<-tapply(Wc1e,inde1,sum)
+	prod1<-as.numeric(c1)*rep(sumWc1e,T)/T
+	prod2<-as.numeric(c2)* (Wc1e - rep(sumWc1e,T)/T)
+	prod<-prod1+prod2
+	D<-1/2*crossprod(eML,prod) ###calculates D in the notation of the paper.
+	W2<-Ws%*%Ws ####generate W^2
+	WW<-crossprod(Ws) ####generate W'*W
+tr<-function(R) sum(diag(R))
+	b<-tr(W2+WW) ###generates b (same notation as the paper)
+	LMl1<-D^2/(((T-1)+as.numeric(sigmav)^2/as.numeric(sigma1)^2)*b) ###conditional LM test for lambda equal to zero
+	LMlstar<-sqrt(LMl1) ###one-sided version
+	statistics<-LMlstar
+  pval <- pnorm(LMlstar, lower.tail=FALSE)
+
+  names(statistics)="LM*-lambda"
+	method<- "Baltagi, Song and Koh LM*-lambda conditional LM test (assuming sigma^2_mu >= 0)"
+	#alt<-"serial corr. in error terms, sub RE and spatial dependence"
+  ##(insert usual htest features)
+  dname <- deparse(formula)
+  RVAL <- list(statistic = statistics,
+               method = method,
+               p.value = pval, data.name=deparse(formula), alternative="Spatial autocorrelation")
+  class(RVAL) <- "htest"
+  return(RVAL)
+
+}
+


Property changes on: pkg/splm/R/clmltest.R
___________________________________________________________________
Added: svn:executable
   + 

Added: pkg/splm/R/clmltest.model.R
===================================================================
--- pkg/splm/R/clmltest.model.R	                        (rev 0)
+++ pkg/splm/R/clmltest.model.R	2010-10-13 15:59:16 UTC (rev 86)
@@ -0,0 +1,86 @@
+`clmltest.model` <-
+function(x, listw, index){
+    ## depends on:
+    ## listw2dgCMatrix.R
+    ## REmod.R
+    ## spreml.R
+if(!inherits(x,"splm")) stop("argument should be an object of class splm")
+frm<-x$call
+if(x$type != "random effects ML") stop("argument should be of type random effects ML")
+
+  if(is.null(index))  stop("index should be specified to retrieve information on time and cross-sectional dimentions")
+
+  if(!inherits(listw,"listw")) stop("object w should be of class listw")
+
+
+
+  ind <- index[,1]
+  tind <- index[,2]
+
+if(names(x$coefficients)[1]=="(Intercept)")  X<-data.frame(cbind(rep(1,ncol(x$model)), x$model[,-1]))
+else X<-x$model[,-1]
+  y<-x$model[,1]
+  	eML<-x$residuals
+
+  ## reduce index accordingly
+
+  ## reorder data by cross-sections, then time
+  oo<-order(tind,ind)
+  X<-X[oo,]
+  y<-y[oo]
+
+  ## det. number of groups and df
+  N<-length(unique(ind))
+  k<-dim(X)[[2]]
+  ## det. max. group numerosity
+  T<-max(tapply(X[,1],ind,length))
+  ## det. total number of obs. (robust vs. unbalanced panels)
+  NT<-length(ind)
+###maximum likelihood estimation under the null hypothesis that lambda is equal to zero. extract the residuals.
+	indic<-seq(1,T)
+	inde<-as.numeric(rep(indic,each=N)) ####indicator to get the cross-sectional observations
+	ind1<-seq(1,N)
+	inde1<-as.numeric(rep(ind1,T)) ####indicator to get the time periods observations
+
+	eme<-tapply(eML,inde1,mean)
+	emme<-eML - rep(eme,T)
+	sigmav<-crossprod(eML,emme)/(N*(T-1)) ####estimate of the variance component sigma_v
+	sigma1<-crossprod(eML,rep(eme,T))/N ####estimate of the variance component sigma_1
+	c1<-sigmav/sigma1^2
+	c2<-1/sigmav
+	c1e<-as.numeric(c1)*eML
+	Wst<-listw2dgCMatrix(listw) ###transform the listw object in a sparse matrix
+	Ws<-t(Wst)  ### this is the real W since listw2dgCMatrix generate W'
+	WpsW<-Wst+Ws
+yybis<-function(q){ #### for very big dimension of the data this can be changed looping over the rows and columns of W or either the listw object
+	wq<-(WpsW)%*%q
+	wq<-as.matrix(wq)
+	}
+	Wc1e<-unlist(tapply(eML,inde,yybis)) #### (W'+W)*u
+	sumWc1e<-tapply(Wc1e,inde1,sum)
+	prod1<-as.numeric(c1)*rep(sumWc1e,T)/T
+	prod2<-as.numeric(c2)* (Wc1e - rep(sumWc1e,T)/T)
+	prod<-prod1+prod2
+	D<-1/2*crossprod(eML,prod) ###calculates D in the notation of the paper.
+	W2<-Ws%*%Ws ####generate W^2
+	WW<-crossprod(Ws) ####generate W'*W
+tr<-function(R) sum(diag(R))
+	b<-tr(W2+WW) ###generates b (same notation as the paper)
+	LMl1<-D^2/(((T-1)+as.numeric(sigmav)^2/as.numeric(sigma1)^2)*b) ###conditional LM test for lambda equal to zero
+	LMlstar<-sqrt(LMl1) ###one-sided version
+	statistics<-LMlstar
+  pval <- pnorm(LMlstar, lower.tail=FALSE)
+
+  names(statistics)="LM*-lambda"
+	method<- "Baltagi, Song and Koh LM*-lambda conditional LM test (assuming sigma^2_mu >= 0)"
+	#alt<-"serial corr. in error terms, sub RE and spatial dependence"
+  ##(insert usual htest features)
+  dname <- deparse(formula)
+  RVAL <- list(statistic = statistics,
+               method = method,
+               p.value = pval, data.name=deparse(frm), alternative="Spatial autocorrelation")
+  class(RVAL) <- "htest"
+  return(RVAL)
+
+}
+


Property changes on: pkg/splm/R/clmltest.model.R
___________________________________________________________________
Added: svn:executable
   + 

Added: pkg/splm/R/clmmtest.R
===================================================================
--- pkg/splm/R/clmmtest.R	                        (rev 0)
+++ pkg/splm/R/clmmtest.R	2010-10-13 15:59:16 UTC (rev 86)
@@ -0,0 +1,104 @@
+`clmmtest` <-
+function(formula, data, index=NULL, listw){
+    ## depends on listw2dgCMatrix.R, spfeml.R
+
+	ml <- spfeml(formula, data=data, index=index, listw, model="error", effects="pooled")
+
+	  if(!is.null(index)) {
+    require(plm)
+    data <- plm.data(data, index)
+    }
+  index <- data[,1]
+  tindex <- data[,2]
+  X<-model.matrix(formula,data=data)
+  y<-model.response(model.frame(formula,data=data))
+  ## reduce index accordingly
+   names(index)<-row.names(data)
+  ind<-index[which(names(index)%in%row.names(X))]
+  tind<-tindex[which(names(index)%in%row.names(X))]
+
+  ## reorder data by cross-sections, then time
+  oo<-order(tind,ind)
+  X<-X[oo,]
+  y<-y[oo]
+  ind<-ind[oo]
+  tind<-tind[oo]
+
+  ## det. number of groups and df
+  N<-length(unique(ind))
+  k<-dim(X)[[2]]
+  ## det. max. group numerosity
+  T<-max(tapply(X[,1],ind,length))
+  ## det. total number of obs. (robust vs. unbalanced panels)
+  NT<-length(ind)
+
+###maximum likelihood estimation under the null hypothesis that lambda is equal to zero. extract the residuals.
+	indic<-seq(1,T)
+	inde<-as.numeric(rep(indic,each=N)) ####indicator to get the cross-sectional observations
+	ind1<-seq(1,N)
+	inde1<-as.numeric(rep(ind1,T)) ####indicator to get the time periods observations
+
+	lambda<-ml$spat.coef
+	#print(lambda)
+	eML<-residuals(ml)
+#	print(length(eML))
+ 	Wst<-listw2dgCMatrix(listw) ###transform the listw object in a sparse matrix
+	Ws<-t(Wst)  ### this is the real W since listw2dgCMatrix generate W'
+	B<- -lambda*Ws
+	diag(B)<- 1
+	BpB<-crossprod(B)
+	BpBi<- solve(BpB)
+vc<-function(R) {
+	BBu<-BpBi%*%R
+	BBu<-as.matrix(BBu)
+	}
+	eme<-unlist(tapply(eML,inde,vc))
+	sigmav2<-crossprod(eML,eme)/(N*(T-1)) ####estimate of the variance component sigma_v
+	sigmav4<-sigmav2^2
+
+tr<-function(R) sum(diag(R))
+	trBpB<-tr(BpB)
+	BpB2<-BpB%*%BpB
+yybis<-function(q){ #### for very big dimension of the data this can be changed looping over the rows and columns of W or either the listw object
+	wq<-rep(q,T)
+	tmp<-wq%*%eML
+					}
+	BBu<-apply(BpB2,1,yybis)
+	BBu<-rep(BBu,T)
+	upBBu<-crossprod(eML,BBu)
+	Dmu<--((T/(2*sigmav2))*trBpB) + ((1/(2*sigmav4))*upBBu)
+	WpB<-Wst%*%B
+	BpW<-t(B)%*%Ws
+	WpBplBpW <-WpB + BpW
+	G<-WpBplBpW %*% BpBi
+	e<-tr(BpB2)
+	d<-tr(WpBplBpW)
+	h<-trBpB
+	g<-tr(G)
+	c<-tr(G%*%G)
+	#print(c(e,d,h,g,c))
+	NUM<- ((2*sigmav4)/T)*((N*sigmav4*c)-(sigmav4*g^2))   ###equation 2.30 in the paper
+	DENft<- NT*sigmav4*e*c
+	DENst<- N*sigmav4*d^2
+	DENtt<- T*sigmav4*g^2 * e
+	DENfot<- 2* sigmav4 *g*h*d
+	DENfit<- sigmav4*h^2* c
+	DEN<- DENft - DENst - DENtt + DENfot - DENfit
+	LMmu <- Dmu^2*NUM / DEN
+	LMmustar<- sqrt(LMmu)
+	statistics<-LMmustar
+  pval <- pnorm(LMmustar, lower.tail=FALSE)
+
+  names(statistics)="LM*-mu"
+	method<- "Baltagi, Song and Koh LM*- mu conditional LM test (assuming lambda may or may not be = 0)"
+	#alt<-"serial corr. in error terms, sub RE and spatial dependence"
+  ##(insert usual htest features)
+  dname <- deparse(formula)
+  RVAL <- list(statistic = statistics,
+               method = method,
+               p.value = pval, data.name=deparse(formula), alternative="Random regional effects")
+  class(RVAL) <- "htest"
+  return(RVAL)
+
+}
+


Property changes on: pkg/splm/R/clmmtest.R
___________________________________________________________________
Added: svn:executable
   + 

Added: pkg/splm/R/clmmtest.model.R
===================================================================
--- pkg/splm/R/clmmtest.model.R	                        (rev 0)
+++ pkg/splm/R/clmmtest.model.R	2010-10-13 15:59:16 UTC (rev 86)
@@ -0,0 +1,105 @@
+`clmmtest.model` <-
+function(x, listw, index){
+    ## depends on listw2dgCMatrix.R, spfeml.R
+
+if(!inherits(x,"splm")) stop("argument should be an object of class splm")
+frm<-x$call
+if(x$type != "fixed effects error") stop("argument should be of type random effects ML")
+
+  if(is.null(index))  stop("index should be specified to retrieve information on time and cross-sectional dimentions")
+
+  if(!inherits(listw,"listw")) stop("object w should be of class listw")
+
+
+
+  ind <- index[,1]
+  tind <- index[,2]
+
+if(names(x$coefficients)[1]=="(Intercept)")  X<-data.frame(cbind(rep(1,ncol(x$model)), x$model[,-1]))
+else X<-x$model[,-1]
+  y<-x$model[,1]
+  	eML<-x$residuals
+
+  ## reduce index accordingly
+
+  ## reorder data by cross-sections, then time
+  oo<-order(tind,ind)
+  X<-X[oo,]
+  y<-y[oo]
+
+  ## det. number of groups and df
+  N<-length(unique(ind))
+  k<-dim(X)[[2]]
+  ## det. max. group numerosity
+  T<-max(tapply(X[,1],ind,length))
+  ## det. total number of obs. (robust vs. unbalanced panels)
+  NT<-length(ind)
+###maximum likelihood estimation under the null hypothesis that lambda is equal to zero. extract the residuals.
+	indic<-seq(1,T)
+	inde<-as.numeric(rep(indic,each=N)) ####indicator to get the cross-sectional observations
+	ind1<-seq(1,N)
+	inde1<-as.numeric(rep(ind1,T)) ####indicator to get the time periods observations
+
+	lambda<-x$spat.coef
+	#print(lambda)
+#	print(length(eML))
+ 	Wst<-listw2dgCMatrix(listw) ###transform the listw object in a sparse matrix
+	Ws<-t(Wst)  ### this is the real W since listw2dgCMatrix generate W'
+	B<- -lambda*Ws
+	diag(B)<- 1
+	BpB<-crossprod(B)
+	BpBi<- solve(BpB)
+vc<-function(R) {
+	BBu<-BpBi%*%R
+	BBu<-as.matrix(BBu)
+	}
+	eme<-unlist(tapply(eML,inde,vc))
+	sigmav2<-crossprod(eML,eme)/(N*(T-1)) ####estimate of the variance component sigma_v
+	sigmav4<-sigmav2^2
+
+tr<-function(R) sum(diag(R))
+	trBpB<-tr(BpB)
+	BpB2<-BpB%*%BpB
+yybis<-function(q){ #### for very big dimension of the data this can be changed looping over the rows and columns of W or either the listw object
+	wq<-rep(q,T)
+	tmp<-wq%*%eML
+					}
+	BBu<-apply(BpB2,1,yybis)
+	BBu<-rep(BBu,T)
+	upBBu<-crossprod(eML,BBu)
+	Dmu<--((T/(2*sigmav2))*trBpB) + ((1/(2*sigmav4))*upBBu)
+	WpB<-Wst%*%B
+	BpW<-t(B)%*%Ws
+	WpBplBpW <-WpB + BpW
+	G<-WpBplBpW %*% BpBi
+	e<-tr(BpB2)
+	d<-tr(WpBplBpW)
+	h<-trBpB
+	g<-tr(G)
+	c<-tr(G%*%G)
+	#print(c(e,d,h,g,c))
+	NUM<- ((2*sigmav4)/T)*((N*sigmav4*c)-(sigmav4*g^2))   ###equation 2.30 in the paper
+	DENft<- NT*sigmav4*e*c
+	DENst<- N*sigmav4*d^2
+	DENtt<- T*sigmav4*g^2 * e
+	DENfot<- 2* sigmav4 *g*h*d
+	DENfit<- sigmav4*h^2* c
+	DEN<- DENft - DENst - DENtt + DENfot - DENfit
+	LMmu <- Dmu^2*NUM / DEN
+	LMmustar<- sqrt(LMmu)
+	statistics<-LMmustar
+  pval <- pnorm(LMmustar, lower.tail=FALSE)
+
+  names(statistics)="LM*-mu"
+	method<- "Baltagi, Song and Koh LM*- mu conditional LM test (assuming lambda may or may not be = 0)"
+	#alt<-"serial corr. in error terms, sub RE and spatial dependence"
+  ##(insert usual htest features)
+  dname <- deparse(formula)
+  RVAL <- list(statistic = statistics,
+               method = method,
+               p.value = pval, data.name=deparse(frm), alternative="Random regional effects")
+  class(RVAL) <- "htest"
+  return(RVAL)
+
+}
+


Property changes on: pkg/splm/R/clmmtest.model.R
___________________________________________________________________
Added: svn:executable
   + 

Added: pkg/splm/R/fixed_effects.R
===================================================================
--- pkg/splm/R/fixed_effects.R	                        (rev 0)
+++ pkg/splm/R/fixed_effects.R	2010-10-13 15:59:16 UTC (rev 86)
@@ -0,0 +1,410 @@
+feerror<-function(env, beta,sige, effects, method,lambda, legacy){
+
+	y<-get("y", envir = env)
+	x<-get("x", envir = env)
+	
+
+	yt<-get("yt", envir = env)
+	xt<-get("xt", envir = env)	
+	N<-get("n", envir = env)
+	T<-get("T", envir = env)
+	NT<-get("NT", envir = env)
+	k<-get("k", envir = env)
+	listw<-get("listw", envir = env)
+	inde<-get("inde", envir = env)
+
+
+mx<-apply(x,2,mean)
+intercept<-mean(y)-mx%*%beta
+if (effects =="spfe"){
+	ysms<-get("ysms", envir = env)
+	xsms<-get("xsms", envir = env)
+
+	sige<-as.numeric(sige)
+	res.sfe <- as.matrix(ysms) - xsms %*% as.matrix(beta) - as.numeric(intercept)
+	xhat <- x %*% as.matrix(beta) + rep(res.sfe,T) + as.numeric(intercept)
+	res.var.sfe<- (sige / T)  + (as.numeric(sige)*(xsms%*% solve(crossprod(xt)) %*% t(xsms)))
+	res.se.sfe<-sqrt(diag(res.var.sfe))
+	res.t.sfe <- res.sfe / res.se.sfe 
+	res.se.con<-sqrt(as.numeric(sige) / NT + as.numeric(sige) * t(as.matrix(mx)) %*% 	solve(crossprod(xt)) %*% as.matrix(mx))
+	res.t.con <- as.numeric(intercept) / res.se.con
+	N.vars <- k + N
+	res.e <- y - xhat
+	FE.out<-list(res.sfe=res.sfe, res.se.sfe=res.se.sfe, intercept=intercept, res.se.con=res.se.con,xhat=xhat,N.vars=N.vars,res.e=res.e)
+	}
+	
+if (effects== "tpfe")	{
+	
+	ytms<-get("ytms", envir = env)
+	xtms<-get("xtms", envir = env)
+
+ 	sige<-as.numeric(sige)
+	res.tfe <- as.matrix(ytms) - xtms %*% as.matrix(beta) - as.numeric(intercept)
+	xhat <- x %*% as.matrix(beta) + rep(res.tfe,each=N) + as.numeric(intercept)
+	res.var.tfe <- (sige / N)  + (as.numeric(sige)*(xtms%*% solve(crossprod(xt)) %*% t(xtms)))
+	res.se.tfe <-sqrt(diag(res.var.tfe))
+	res.t.tfe <- res.tfe/res.se.tfe
+	res.se.con<-sqrt(as.numeric(sige) / NT + as.numeric(sige) * t(as.matrix(mx)) %*% 	solve(crossprod(xt)) %*% as.matrix(mx))
+	res.t.con <- as.numeric(intercept) / res.se.con
+	N.vars <- k + T
+		res.e <- y - xhat
[TRUNCATED]

To get the complete diff run:
    svnlook diff /svnroot/splm -r 86


More information about the Splm-commits mailing list