[Splm-commits] r100 - / pkg pkg/R pkg/chm pkg/data pkg/man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Apr 20 23:36:38 CEST 2011


Author: gpiras
Date: 2011-04-20 23:36:38 +0200 (Wed, 20 Apr 2011)
New Revision: 100

Added:
   pkg/
   pkg/ChangeLog
   pkg/DESCRIPTION
   pkg/NAMESPACE
   pkg/R/
   pkg/R/.Rapp.history
   pkg/R/REmod.R
   pkg/R/bsktest.R
   pkg/R/fixed_effects.R
   pkg/R/ivplm.b2sls.R
   pkg/R/ivplm.ec2sls.R
   pkg/R/ivplm.g2sls.R
   pkg/R/ivplm.w2sls.R
   pkg/R/ivsplm.R
   pkg/R/likelihoodsFE.R
   pkg/R/listw2dgCMatrix.R
   pkg/R/lrtest.splm.R
   pkg/R/olsmod.R
   pkg/R/print.splm.R
   pkg/R/print.summary.splm.R
   pkg/R/sarREmod.R
   pkg/R/sarem2REmod.R
   pkg/R/saremREmod.R
   pkg/R/saremmod.R
   pkg/R/saremsrREmod.R
   pkg/R/saremsrmod.R
   pkg/R/sarmod.R
   pkg/R/sarsrREmod.R
   pkg/R/sarsrmod.R
   pkg/R/sem2REmod.R
   pkg/R/semREmod.R
   pkg/R/semmod.R
   pkg/R/semsrREmod.R
   pkg/R/semsrmod.R
   pkg/R/spfeml.R
   pkg/R/spgm.R
   pkg/R/sphtest.R
   pkg/R/spreml.R
   pkg/R/ssrREmod.R
   pkg/R/ssrmod.R
   pkg/R/summary.effects.splm.R.old
   pkg/R/summary.splm.R
   pkg/R/sumres.R
   pkg/R/tss.R
   pkg/R/utilities_GM.R
   pkg/R/vcov.splm.R
   pkg/chm/
   pkg/chm/00Index.html
   pkg/chm/Rchm.css
   pkg/chm/bsjktest.html
   pkg/chm/bsktest.html
   pkg/chm/effects.splm.html
   pkg/chm/logo.jpg
   pkg/chm/print.splm.html
   pkg/chm/spfeml.html
   pkg/chm/splm-package.html
   pkg/chm/splm.hhp
   pkg/chm/splm.toc
   pkg/chm/spregm.html
   pkg/chm/spreml.html
   pkg/chm/spsegm.html
   pkg/chm/summary.splm.html
   pkg/data/
   pkg/data/usaww.rda
   pkg/man/
   pkg/man/bsktest.Rd
   pkg/man/effects.splm.Rd
   pkg/man/listw2dgCMatrix.Rd
   pkg/man/print.effects.splm.Rd
   pkg/man/print.splm.Rd
   pkg/man/spfeml.Rd
   pkg/man/spgm.Rd
   pkg/man/sphettest.Rd
   pkg/man/splm-package.Rd
   pkg/man/spreml.Rd
   pkg/man/summary.effects.splm.Rd.old
   pkg/man/summary.splm.Rd
   pkg/man/usaww.Rd
   pkg/man/write.effects.splm.Rd
Log:
Deleted simultaneous equations and test bsjk, added hausman test

Added: pkg/ChangeLog
===================================================================
--- pkg/ChangeLog	                        (rev 0)
+++ pkg/ChangeLog	2011-04-20 21:36:38 UTC (rev 100)
@@ -0,0 +1,23 @@
+Changes in Version 0.8-01
+  o added spgm: general function that deals with all the GM estimators
+  o added the methodologies in Mutl and Pfaffermeyer (2011) and Piras (2011) 
+  for the estimation of the GM models sperrorgm and spsarargm
+  o includes the following estimators: ivplm.w2sls, ivplm.b2sls, ivplm.ec2sls, ivplm.g2sls
+  along with ivsplm that is the wrapper to use them. 
+  
+Changes in Version 0.2-04
+  o dependency changed from kinship to bdsmatrix; removed require(kinship) from all functions
+
+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. 
+ 
+  


Property changes on: pkg/ChangeLog
___________________________________________________________________
Added: svn:executable
   + 

Added: pkg/DESCRIPTION
===================================================================
--- pkg/DESCRIPTION	                        (rev 0)
+++ pkg/DESCRIPTION	2011-04-20 21:36:38 UTC (rev 100)
@@ -0,0 +1,10 @@
+Package: splm
+Title: Econometric Models for Spatial Panel Data
+Version: 0.8-02
+Date: 2011-04-13
+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, bdsmatrix, spam
+License: GPL-2
+LazyLoad: yes


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

Added: pkg/NAMESPACE
===================================================================
--- pkg/NAMESPACE	                        (rev 0)
+++ pkg/NAMESPACE	2011-04-20 21:36:38 UTC (rev 100)
@@ -0,0 +1,23 @@
+importFrom(stats, model.matrix, model.response, aggregate, effects)
+import(nlme)
+import(spdep)
+import(Matrix)
+importFrom(bdsmatrix,bdsmatrix)
+importFrom(MASS,ginv)
+
+export(bsktest, sphtest,
+effects.splm, print.effects.splm, write.effects.splm, 
+print.splm, spfeml, spgm, spreml, summary.splm, lrtest.splm, sphtest, listw2dgCMatrix)
+
+
+
+S3method(print, splm)
+S3method(print, summary.splm)
+S3method(effects, splm)
+S3method(print, effects.splm)
+S3method(bsktest, formula)
+S3method(bsktest, lm)
+S3method(bsktest, splm)
+S3method(sphtest, formula)
+S3method(sphtest, splm)
+


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

Added: pkg/R/.Rapp.history
===================================================================
--- pkg/R/.Rapp.history	                        (rev 0)
+++ pkg/R/.Rapp.history	2011-04-20 21:36:38 UTC (rev 100)
@@ -0,0 +1,373 @@
+)
+etr_mom <- trW(eWs, m = 24, type = "moments")
+summary.connection
+eW <- as(as_dgRMatrix_listw(elw), "CsparseMatrix")
+set.seed(100831)
+system.time(etr_MC <- trW(eW, m = 24, type = "MC"))#
+system.time(etr_mult <- trW(eW, m = 24, type = "mult"))
+eWs <- spdep:::listw2U_Matrix(spdep:::similar.listw_Matrix(elw))
+eWs
+system.time(etr_mom <- trW(eWs, m = 24, type = "moments"))
+etr_mom <- trW(eWs, m = 24, type = "moments")
+2007 - 1963
+map('state', "west virginia", fill = TRUE, col="#FFCC00", bg="#003366")
+par(mfrow=c(2,2))
+map('state', "west virginia", fill = TRUE, col="#FFCC00", bg="#003366")
+library(maps)
+install.packages("maps")
+library(maps)
+map('state', "west virginia", fill = TRUE, col="#FFCC00", bg="#003366")
+map('state', "west virginia", fill = TRUE, col="#003366", bg="#FFCC00")
+map('state', "west virginia", fill = TRUE, col="blue", bg="gold")
+map('state', "west virginia", fill = TRUE, col="gold", bg="blue")
+map('state', "west virginia")
+par(mfrow=c(2,2))#
+map('state', "west virginia", fill = TRUE, col="#FFCC00", bg="#003366")#
+map('state', "west virginia", fill = TRUE, col="#003366", bg="#FFCC00")#
+map('state', "west virginia", fill = TRUE, col="blue", bg="gold")#
+map('state', "west virginia", fill = TRUE, col="gold", bg="blue")
+col="#FFCC00"
+map('state', "west virginia", fill = TRUE, col="#FFCC00", bg="#003366")
+library(splm)
+help(splm)
+spfeml
+help(spdep)
+sacsarlm
+lagsarlm
+sacsarlm
+spdep
+spdep:::sacsar.f
+spdep:::sacsar_sse
+spfeml
+spdep:::sacsar_sse
+		wyt<-wy-wysm
+		w2yt<-w2y - w2ysm - w2ytm + rep(mean(w2y),NT)
+spfeml
+splaglm
+splm:::splaglm
+splm:::sperrorlm
+sarpanelerror
+splm:::sarpanelerror
+spfeml
+sacsarlm
+eigen.setup
+spdep:::eigen.setup
+spdep:::eigen_setup
+lagsarlm
+        W2 <- as(as_dgRMatrix_listw(listw2), "CsparseMatrix")
+spdep:::sacsar.f
+spdep:::sacsar.sse
+spdep:::sacsar_sse
+spfeml
+sacsarlm
+N=3
+Diagonal(3)
+getVmatsac
+spdep:::getVmatsac
+spdep:::f_sac_hess
+spdep:::sar_sac_hess_sse
+spregm
+spreml
+source("spfeml")
+source("likelihoodsFE.R")
+source("spfeml.R")
+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)
+source("spfeml.R")
+lag <- spfeml(fm, data = Produc, listw = mat2listw(usaww), effects = "sptpfe", method = "eigen", quiet = TRUE)
+source("likelihoodsFE.R")#
+source("spfeml.R")
+lag <- spfeml(fm, data = Produc, listw = mat2listw(usaww), effects = "sptpfe", method = "eigen", quiet = TRUE)
+source("fixed_effects")
+source("fixed_effects.R")
+lag <- spfeml(fm, data = Produc, listw = mat2listw(usaww), effects = "sptpfe", method = "eigen", quiet = TRUE)
+source("likelihoodsFE.R")#
+source("spfeml.R")#
+source("fixed_effects.R")
+lag <- spfeml(fm, data = Produc, listw = mat2listw(usaww), effects = "sptpfe", method = "eigen", quiet = TRUE)
+source("likelihoodsFE.R")#
+source("spfeml.R")#
+source("fixed_effects.R")
+lag <- spfeml(fm, data = Produc, listw = mat2listw(usaww), effects = "sptpfe", method = "eigen", quiet = TRUE)
+source("likelihoodsFE.R")
+source("spfeml.R")
+source("fixed_effects.R")
+lag <- spfeml(fm, data = Produc, listw = mat2listw(usaww), effects = "sptpfe", method = "eigen", quiet = TRUE)
+source("likelihoodsFE.R")#
+source("spfeml.R")#
+source("fixed_effects.R")
+lag <- spfeml(fm, data = Produc, listw = mat2listw(usaww), effects = "sptpfe", method = "eigen", quiet = TRUE)
+source("likelihoodsFE.R")#
+source("spfeml.R")#
+source("fixed_effects.R")
+lag <- spfeml(fm, data = Produc, listw = mat2listw(usaww), effects = "sptpfe", method = "eigen", quiet = TRUE)
+summary(lag)
+lag <- spfeml(fm, data = Produc, listw = mat2listw(usaww), effects = "spfe", method = "eigen", quiet = TRUE)
+summary(lag)
+err <- spfeml(fm, data = Produc, listw = mat2listw(usaww), model = "error", effects = "tpfe", method = "eigen", quiet = TRUE)#
+summary(err)
+source("likelihoodsFE.R")#
+source("spfeml.R")#
+source("fixed_effects.R")
+lag <- spfeml(fm, data = Produc, listw = mat2listw(usaww), effects = "sptpfe", method = "eigen", quiet = TRUE)
+summary(lag)
+lag <- spfeml(fm, data = Produc, listw = mat2listw(usaww), effects = "spfe", method = "eigen", quiet = TRUE)
+summary(lag)
+err <- spfeml(fm, data = Produc, listw = mat2listw(usaww), model = "error", effects = "tpfe", method = "eigen", quiet = TRUE)
+source("likelihoodsFE.R")#
+source("spfeml.R")#
+source("fixed_effects.R")
+lag <- spfeml(fm, data = Produc, listw = mat2listw(usaww), effects = "spfe", method = "eigen", quiet = TRUE)
+summary(lag)
+err <- spfeml(fm, data = Produc, listw = mat2listw(usaww), model = "error", effects = "tpfe", method = "eigen", quiet = TRUE)
+source("likelihoodsFE.R")#
+source("spfeml.R")#
+source("fixed_effects.R")
+lag <- spfeml(fm, data = Produc, listw = mat2listw(usaww), effects = "spfe", method = "eigen", quiet = TRUE)
+summary(lag)
+err <- spfeml(fm, data = Produc, listw = mat2listw(usaww), model = "error", effects = "tpfe", method = "eigen", quiet = TRUE)
+summary(err)
+sarar <- spfeml(fm, data = Produc, listw = mat2listw(usaww), model = "sarar", effects = "tpfe", method = "eigen", quiet = TRUE)
+source("likelihoodsFE.R")#
+source("spfeml.R")#
+source("fixed_effects.R")
+sarar <- spfeml(fm, data = Produc, listw = mat2listw(usaww), model = "sarar", effects = "tpfe", method = "eigen", quiet = TRUE)
+source("likelihoodsFE.R")#
+source("spfeml.R")#
+source("fixed_effects.R")
+lag <- spfeml(fm, data = Produc, listw = mat2listw(usaww), effects = "spfe", method = "eigen", quiet = TRUE)
+err <- spfeml(fm, data = Produc, listw = mat2listw(usaww), model = "error", effects = "tpfe", method = "eigen", quiet = TRUE)
+sarar <- spfeml(fm, data = Produc, listw = mat2listw(usaww), model = "sarar", effects = "tpfe", method = "eigen", quiet = TRUE)
+sacsarlm
+source("likelihoodsFE.R")#
+source("spfeml.R")#
+source("fixed_effects.R")
+sarar <- spfeml(fm, data = Produc, listw = mat2listw(usaww), model = "sarar", effects = "tpfe", method = "eigen", quiet = TRUE)
+source("likelihoodsFE.R")#
+source("spfeml.R")#
+source("fixed_effects.R")
+sarar <- spfeml(fm, data = Produc, listw = mat2listw(usaww), model = "sarar", effects = "tpfe", method = "eigen", quiet = TRUE)
+source("likelihoodsFE.R")#
+source("spfeml.R")#
+source("fixed_effects.R")
+sarar <- spfeml(fm, data = Produc, listw = mat2listw(usaww), model = "sarar", effects = "tpfe", method = "eigen", quiet = TRUE)
+source("likelihoodsFE.R")#
+source("spfeml.R")#
+source("fixed_effects.R")
+sarar <- spfeml(fm, data = Produc, listw = mat2listw(usaww), model = "sarar", effects = "tpfe", method = "eigen", quiet = TRUE)
+source("likelihoodsFE.R")#
+source("spfeml.R")#
+source("fixed_effects.R")
+sarar <- spfeml(fm, data = Produc, listw = mat2listw(usaww), model = "sarar", effects = "tpfe", method = "eigen", quiet = TRUE)
+source("likelihoodsFE.R")#
+source("spfeml.R")#
+source("fixed_effects.R")
+sarar <- spfeml(fm, data = Produc, listw = mat2listw(usaww), model = "sarar", effects = "tpfe", method = "eigen", quiet = TRUE)
+sacsarlm
+source("likelihoodsFE.R")#
+source("spfeml.R")#
+source("fixed_effects.R")
+sarar <- spfeml(fm, data = Produc, listw = mat2listw(usaww), model = "sarar", effects = "tpfe", method = "eigen", quiet = TRUE)
+source("likelihoodsFE.R")#
+source("spfeml.R")#
+source("fixed_effects.R")
+sarar <- spfeml(fm, data = Produc, listw = mat2listw(usaww), model = "sarar", effects = "tpfe", method = "eigen", quiet = TRUE)
+source("likelihoodsFE.R")#
+source("spfeml.R")#
+source("fixed_effects.R")
+sarar <- spfeml(fm, data = Produc, listw = mat2listw(usaww), model = "sarar", effects = "tpfe", method = "eigen", quiet = TRUE)
+source("likelihoodsFE.R")#
+source("spfeml.R")#
+source("fixed_effects.R")
+sarar <- spfeml(fm, data = Produc, listw = mat2listw(usaww), model = "sarar", effects = "tpfe", method = "eigen", quiet = TRUE)
+source("likelihoodsFE.R")#
+source("spfeml.R")#
+source("fixed_effects.R")
+sarar <- spfeml(fm, data = Produc, listw = mat2listw(usaww), model = "sarar", effects = "tpfe", method = "eigen", quiet = TRUE)
+source("likelihoodsFE.R")#
+source("spfeml.R")#
+source("fixed_effects.R")
+sarar <- spfeml(fm, data = Produc, listw = mat2listw(usaww), model = "sarar", effects = "tpfe", method = "eigen", quiet = TRUE)
+source("likelihoodsFE.R")#
+source("spfeml.R")#
+source("fixed_effects.R")
+sarar <- spfeml(fm, data = Produc, listw = mat2listw(usaww), model = "sarar", effects = "tpfe", method = "eigen", quiet = TRUE)
+source("likelihoodsFE.R")#
+source("spfeml.R")#
+source("fixed_effects.R")
+sarar <- spfeml(fm, data = Produc, listw = mat2listw(usaww), model = "sarar", effects = "tpfe", method = "eigen", quiet = TRUE)
+source("likelihoodsFE.R")#
+source("spfeml.R")#
+source("fixed_effects.R")
+sarar <- spfeml(fm, data = Produc, listw = mat2listw(usaww), model = "sarar", effects = "tpfe", method = "eigen", quiet = TRUE)
+source("likelihoodsFE.R")#
+source("spfeml.R")#
+source("fixed_effects.R")
+sarar <- spfeml(fm, data = Produc, listw = mat2listw(usaww), model = "sarar", effects = "tpfe", method = "eigen", quiet = TRUE)
+source("likelihoodsFE.R")#
+source("spfeml.R")#
+source("fixed_effects.R")
+sarar <- spfeml(fm, data = Produc, listw = mat2listw(usaww), model = "sarar", effects = "tpfe", method = "eigen", quiet = TRUE)
+source("likelihoodsFE.R")#
+source("spfeml.R")#
+source("fixed_effects.R")
+sarar <- spfeml(fm, data = Produc, listw = mat2listw(usaww), model = "sarar", effects = "tpfe", method = "eigen", quiet = TRUE)
+source("likelihoodsFE.R")#
+source("spfeml.R")#
+source("fixed_effects.R")
+sarar <- spfeml(fm, data = Produc, listw = mat2listw(usaww), model = "sarar", effects = "tpfe", method = "eigen", quiet = TRUE)
+source("likelihoodsFE.R")#
+source("spfeml.R")#
+source("fixed_effects.R")
+sarar <- spfeml(fm, data = Produc, listw = mat2listw(usaww), model = "sarar", effects = "tpfe", method = "eigen", quiet = TRUE)
+source("likelihoodsFE.R")#
+source("spfeml.R")#
+source("fixed_effects.R")
+sarar <- spfeml(fm, data = Produc, listw = mat2listw(usaww), model = "sarar", effects = "tpfe", method = "eigen", quiet = TRUE)
+source("likelihoodsFE.R")#
+source("spfeml.R")#
+source("fixed_effects.R")
+sarar <- spfeml(fm, data = Produc, listw = mat2listw(usaww), model = "sarar", effects = "tpfe", method = "eigen", quiet = TRUE)
+source("likelihoodsFE.R")#
+source("spfeml.R")#
+source("fixed_effects.R")
+sarar <- spfeml(fm, data = Produc, listw = mat2listw(usaww), model = "sarar", effects = "tpfe", method = "eigen", quiet = TRUE)
+source("likelihoodsFE.R")#
+source("spfeml.R")#
+source("fixed_effects.R")
+sarar <- spfeml(fm, data = Produc, listw = mat2listw(usaww), model = "sarar", effects = "tpfe", method = "eigen", quiet = TRUE)
+source("likelihoodsFE.R")#
+source("spfeml.R")#
+source("fixed_effects.R")
+sarar <- spfeml(fm, data = Produc, listw = mat2listw(usaww), model = "sarar", effects = "tpfe", method = "eigen", quiet = TRUE)
+source("likelihoodsFE.R")#
+source("spfeml.R")#
+source("fixed_effects.R")
+sarar <- spfeml(fm, data = Produc, listw = mat2listw(usaww), model = "sarar", effects = "tpfe", method = "eigen", quiet = TRUE)
+source("likelihoodsFE.R")#
+source("spfeml.R")#
+source("fixed_effects.R")
+sarar <- spfeml(fm, data = Produc, listw = mat2listw(usaww), model = "sarar", effects = "tpfe", method = "eigen", quiet = TRUE)
+summary(sarar)
+summary(lag)
+summary(err)
+sarar <- spfeml(fm, data = Produc, listw = mat2listw(usaww), model = "sarar", effects = "spfe", method = "eigen", quiet = TRUE)
+summary(sarar)
+source("likelihoodsFE.R")#
+source("spfeml.R")#
+source("fixed_effects.R")
+lag <- spfeml(fm, data = Produc, listw = mat2listw(usaww), effects = "spfe", method = "eigen", quiet = TRUE)
+summary(lag)
+err <- spfeml(fm, data = Produc, listw = mat2listw(usaww), model = "error", effects = "tpfe", method = "eigen", quiet = TRUE)
+summary(err)
+sarar <- spfeml(fm, data = Produc, listw = mat2listw(usaww), model = "sarar", effects = "tpfe", method = "eigen", quiet = TRUE)
+summary(sarar)
+sarar <- spfeml(fm, data = Produc, listw = mat2listw(usaww), model = "sarar", effects = "pooled", method = "eigen", quiet = TRUE)
+sarar <- spfeml(fm, data = Produc, listw = mat2listw(usaww), model = "sarar", effects = "tpfe", method = "eigen", quiet = TRUE)
+summary(sarar)
+sarar <- spfeml(fm, data = Produc, listw = mat2listw(usaww), model = "sarar", effects = "sptpfe", method = "eigen", quiet = TRUE)
+summary(sarar)
+sarar <- spfeml(fm, data = Produc, listw = mat2listw(usaww), model = "sarar", effects = "tpfe", method = "eigen", quiet = TRUE)
+summary(sarar)
+sarar <- spfeml(fm, data = Produc, listw = mat2listw(usaww), model = "sarar", effects = "spfe", method = "eigen", quiet = TRUE)
+summary(sarar)
+sarar <- spfeml(fm, data = Produc, listw = mat2listw(usaww), model = "sarar", effects = "spfe", method = "eigen", quiet = TRUE)
+source("likelihoodsFE.R")#
+source("spfeml.R")#
+source("fixed_effects.R")
+sarar <- spfeml(fm, data = Produc, listw = mat2listw(usaww), model = "sarar", effects = "spfe", method = "eigen", quiet = TRUE)
+summary(sarar)
+source("likelihoodsFE.R")#
+source("spfeml.R")#
+source("fixed_effects.R")
+lag <- spfeml(fm, data = Produc, listw = mat2listw(usaww), effects = "spfe", method = "eigen", quiet = TRUE)
+summary(lag)
+err <- spfeml(fm, data = Produc, listw = mat2listw(usaww), model = "error", effects = "tpfe", method = "eigen", quiet = TRUE)
+summary(err)
+sarar <- spfeml(fm, data = Produc, listw = mat2listw(usaww), model = "sarar", effects = "spfe", method = "eigen", quiet = TRUE)
+source("likelihoodsFE.R")#
+source("spfeml.R")#
+source("fixed_effects.R")
+sarar <- spfeml(fm, data = Produc, listw = mat2listw(usaww), model = "sarar", effects = "spfe", method = "eigen", quiet = TRUE)
+source("likelihoodsFE.R")#
+source("spfeml.R")#
+source("fixed_effects.R")
+sarar <- spfeml(fm, data = Produc, listw = mat2listw(usaww), model = "sarar", effects = "spfe", method = "eigen", quiet = TRUE)
+source("likelihoodsFE.R")#
+source("spfeml.R")#
+source("fixed_effects.R")
+sarar <- spfeml(fm, data = Produc, listw = mat2listw(usaww), model = "sarar", effects = "spfe", method = "eigen", quiet = TRUE)
+summary(sarar)
+sarar <- spfeml(fm, data = Produc, listw = mat2listw(usaww), model = "sarar", effects = "sptpfe", method = "eigen", quiet = TRUE)
+summary(sarar)
+sarar <- spfeml(fm, data = Produc, listw = mat2listw(usaww), model = "sarar", effects = "pooled", method = "eigen", quiet = TRUE)
+summary(sarar)
+sarar <- spfeml(fm, data = Produc, listw = mat2listw(usaww), model = "sarar", effects = "spfe", method = "eigen", quiet = TRUE)
+summary(sarar)
+source("likelihoodsFE.R")#
+source("spfeml.R")#
+source("fixed_effects.R")
+sarar <- spfeml(fm, data = Produc, listw = mat2listw(usaww), model = "sarar", effects = "spfe", method = "eigen", quiet = TRUE)
+summary(sarar)
+lag <- spfeml(fm, data = Produc, listw = mat2listw(usaww), effects = "spfe", method = "eigen", quiet = TRUE)
+summary(lag)
+err <- spfeml(fm, data = Produc, listw = mat2listw(usaww), model = "error", effects = "spfe", method = "eigen", quiet = TRUE)
+summary(err)
+sarar <- spfeml(fm, data = Produc, listw = mat2listw(usaww), model = "sarar", effects = "spfe", method = "eigen", quiet = TRUE)
+summary(sarar)
+spgm(fm, data=Produc,  listw = mat2listw(usaww),
+ lag=TRUE, spatial.error=TRUE, effects = "fixed", control = list())
+sarargm<-spgm(fm, data=Produc,  listw = mat2listw(usaww),  lag=TRUE, spatial.error=TRUE, effects = "fixed", control = list())
+summary(sarargm)
+source("likelihoodsFE.R")#
+source("spfeml.R")#
+source("fixed_effects.R")#
+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 = "spfe", method = "eigen", quiet = TRUE)#
+summary(lag)#
+#
+err <- spfeml(fm, data = Produc, listw = mat2listw(usaww), model = "error", effects = "spfe", method = "eigen", quiet = TRUE)#
+summary(err)#
+#
+#
+sarar <- spfeml(fm, data = Produc, listw = mat2listw(usaww), model = "sarar", effects = "spfe", method = "eigen", quiet = TRUE)#
+summary(sarar)#
+#
+#
+#
+sarargm<-spgm(fm, data=Produc,  listw = mat2listw(usaww),  lag=TRUE, spatial.error=TRUE, effects = "fixed", control = list())#
+summary(sarargm)
+library(splm)
+help(spdep)
+source("likelihoodsFE.R")#
+source("spfeml.R")#
+source("fixed_effects.R")#
+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 = "spfe", method = "eigen", quiet = TRUE)
+summary(lag)
+err <- spfeml(fm, data = Produc, listw = mat2listw(usaww), model = "error", effects = "spfe", method = "eigen", quiet = TRUE)
+summary(err)
+sarar <- spfeml(fm, data = Produc, listw = mat2listw(usaww), model = "sarar", effects = "spfe", method = "eigen", quiet = TRUE)
+summary(sarar)
+sarargm<-spgm(fm, data=Produc,  listw = mat2listw(usaww),  lag=TRUE, spatial.error=TRUE, effects = "fixed", control = list())
+summary(sarargm)
+sarar <- spfeml(fm, data = Produc, listw = mat2listw(usaww), model = "sarar", effects = "spfe", method = "eigen", quiet = FALSE)
+sarargm<-spgm(fm, data=Produc,  listw = mat2listw(usaww),  lag=TRUE, spatial.error=TRUE, effects = "fixed", control = list(), quite = FALSE)
+sarargm<-spgm(fm, data=Produc,  listw = mat2listw(usaww),  lag=TRUE, spatial.error=TRUE, effects = "fixed", control = list())
+sarar <- spfeml(fm, data = Produc, listw = mat2listw(usaww), model = "sarar", effects = "spfe", method = "eigen", quiet = FALSE)
+sarar <- spfeml(fm, data = Produc, listw = mat2listw(usaww), model = "sarar", effects = "tpfe", method = "eigen", quiet = FALSE)
+summary(sarar)
+sarar <- spfeml(fm, data = Produc, listw = mat2listw(usaww), model = "sarar", effects = "spfe", method = "eigen", quiet = FALSE)
+library(splm)
+help(sacsarlm)


Property changes on: pkg/R/.Rapp.history
___________________________________________________________________
Added: svn:executable
   + 

Added: pkg/R/REmod.R
===================================================================
--- pkg/R/REmod.R	                        (rev 0)
+++ pkg/R/REmod.R	2011-04-20 21:36:38 UTC (rev 100)
@@ -0,0 +1,157 @@
+REmod <-
+function (X, y, ind, tind, n, k, t, nT, w, w2, coef0 = rep(0, 2),
+    hess = FALSE, trace = trace, x.tol = 1.5e-18, rel.tol = 1e-15,
+    ...)
+{
+
+## optimizing version 1:
+    ##
+    ## exploit ordering reversal
+    ## and bdsmatrix functions as in ssrmod, sarsrmod, sarREmod...
+    ##
+    ## a) lag y etc.
+    ## b) reverse ordering and exploit bds nature of vcov(e)
+    ##
+    ## maybe exploit analytical inverse of the submatrix block (gains on
+    ## large-N problems)?? but how likely is it to have laaaarge T?
+
+    ## extensive function rewriting, Giovanni Millo 04/10/2010
+    ## structure:
+    ## a) specific part
+    ## - set names, bounds and initial values for parms
+    ## - define building blocks for likelihood and GLS as functions of parms
+    ## - define likelihood
+    ## b) generic part(independent from ll.c() and #parms)
+    ## - fetch covariance parms from max lik
+    ## - calc last GLS step
+    ## - fetch betas
+    ## - calc final covariances
+    ## - make list of results
+
+    ## change this to 'bdsmatrix'
+    #require(kinship)
+
+    ## set names for final parms vectors
+    nam.beta <- dimnames(X)[[2]]
+    nam.errcomp <- c("phi")
+
+    ## initialize values for optimizer
+    myparms0 <- coef0
+    ## set bounds for optimizer
+    lower.bounds <- c(1e-08)
+    upper.bounds <- c(1e+09)
+
+    ## rearranging module
+    ## save this for eventually re-rearranging output
+    oo.0 <- order(tind, ind)
+    ## reorder as stacked time series, as in std. panels
+    oo <- order(ind, tind)
+    X <- X[oo, ]
+    y <- y[oo]
+    #wy <- wy[oo]
+    ind <- ind[oo]
+    tind <- tind[oo]
+
+    ## modules for likelihood
+    bSigma <- function(phipsi, n, t, w) {
+        ## single block of the original *scaled* covariance
+        ## maintain w for homogeneity with generic part
+        Jt <- matrix(1, ncol = t, nrow = t)
+        It <- diag(1, t)
+        ## retrieve parms
+        phi <- phipsi[1]
+        ## psi not used: here passing 2 parms, but works anyway
+        ## because psi is last one
+        ## calc inverse
+        bSigma <- phi * Jt + It
+        bSigma
+    }
+    detSigma <- function(phi, n, t) {
+        detSigma <- -n/2 * log(t * phi + 1)
+        detSigma
+    }
+    fullSigma <- function(phipsi, n, t, w) {
+        sigma.i <- bSigma(phipsi, n, t, w)
+        fullSigma <- bdsmatrix(rep(t, n), rep(as.numeric(sigma.i),
+            n))
+        fullSigma
+    }
+
+    ## likelihood function, both steps included
+    ll.c <- function(phipsi, y, X, n, t, w, w2, wy) {
+        ## retrieve parms
+        phi <- phipsi[1]
+        ## calc inverse sigma
+        sigma <- fullSigma(phipsi, n, t, w)
+        ## do GLS step to get e, s2e
+        glsres <- GLSstepBDS(X, y, sigma)
+        e <- glsres[["ehat"]]
+        s2e <- glsres[["sigma2"]]
+        ## calc ll
+        due <- detSigma(phi, n, t)
+        tre <- -n * t/2 * log(s2e)
+        quattro <- -1/(2 * s2e) * crossprod(e, solve(sigma, e))
+        const <- -(n * t)/2 * log(2 * pi)
+        ll.c <- const + due + tre + quattro
+        ## invert sign for minimization
+        llc <- -ll.c
+    }
+
+    ## generic from here
+
+    ## GLS step function for bdsmatrices
+    GLSstepBDS <- function(X, y, sigma) {
+        b.hat <- solve(crossprod(X, solve(sigma, X)), crossprod(X,
+            solve(sigma, y)))
+        ehat <- y - X %*% b.hat
+        sigma2ehat <- crossprod(ehat, solve(sigma, ehat))/(n * t)
+        return(list(betahat=b.hat, ehat=ehat, sigma2=sigma2ehat))
+    }
+
+    ## lag y unneeded here, keep parm for compatibility
+    wy <- NULL
+
+    ## max likelihood
+    optimum <- nlminb(start = myparms0, objective = ll.c,
+                      gradient = NULL, hessian = NULL,
+                      y = y, X = X, n = n, t = t, w = w, w2 = w2, wy = wy,
+                      scale = 1, control = list(x.tol = x.tol,
+                                 rel.tol = rel.tol, trace = trace),
+                      lower = lower.bounds, upper = upper.bounds)
+
+    ## log likelihood at optimum (notice inverted sign)
+    myll <- -optimum$objective
+    ## retrieve optimal parms
+    myparms <- optimum$par
+
+    ## one last GLS step at optimal vcov parms
+    sigma <- fullSigma(myparms, n, t, w)
+    beta <- GLSstepBDS(X, y, sigma)
+
+    ## final vcov(beta)
+    covB <- as.numeric(beta[[3]]) *
+        solve(crossprod(X, solve(sigma, X)))
+
+    ## final vcov(errcomp)
+    covTheta <- solve(-fdHess(myparms, function(x) -ll.c(x,
+        y, X, n, t, w, w2, wy))$Hessian)          # lag-specific line: wy
+    nvcovpms <- length(nam.errcomp)
+    covAR <- NULL
+    covPRL <- covTheta[1:nvcovpms, 1:nvcovpms, drop=FALSE]
+
+    ## final parms
+    betas <- as.vector(beta[[1]])
+    arcoef <- NULL
+    errcomp <- myparms[which(nam.errcomp!="psi")]
+    names(betas) <- nam.beta
+    names(errcomp) <- nam.errcomp[which(nam.errcomp!="psi")]
+
+    dimnames(covB) <- list(nam.beta, nam.beta)
+    dimnames(covPRL) <- list(names(errcomp), names(errcomp))
+
+    ## result
+    RES <- list(betas = betas, arcoef=arcoef, errcomp = errcomp,
+                covB = covB, covAR=covAR, covPRL = covPRL, ll = myll)
+
+    return(RES)
+}


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

Added: pkg/R/bsktest.R
===================================================================
--- pkg/R/bsktest.R	                        (rev 0)
+++ pkg/R/bsktest.R	2011-04-20 21:36:38 UTC (rev 100)
@@ -0,0 +1,1044 @@
+`bsktest` <-
+function(x,...){
+  UseMethod("bsktest")
+}
+
+
+`bsktest.splm` <-
+function(x, listw, index=NULL, test=c("CLMlambda","CLMmu"), ...){
+	
+	switch(match.arg(test), CLMlambda = {
+
+    bsk = clmltest.model(x,listw, index, ...)
+
+  }, CLMmu = {
+
+    bsk = clmmtest.model(x,listw, index, ... )
+
+  })
+
+  return(bsk)
+}
+
+
+`bsktest.lm` <-
+function(x, listw, index=NULL, test=c("SLM1","SLM2","LMJOINT"), ...){
+	
+	switch(match.arg(test), SLM1 = {
+
+    bsk = slm1test.model(x,listw, index, ...)
+
+  }, SLM2 = {
+
+    bsk = slm2test.model(x,listw, index, ... )
+
+  }, LMJOINT = {
+
+    bsk = LMHtest.model(x,listw, index, ...)
+
+  })
+
+  return(bsk)
+}
+
+
+`bsktest.formula` <-
+function(x, data, listw, test=c("SLM1","SLM2","LMJOINT","CLMlambda","CLMmu"), index=NULL, ...){
+  
+
+switch(match.arg(test), SLM1 = {
+
+    bsk = slm1test(x, data, index,  listw, ...)
+
+  }, SLM2 = {
+
+    bsk = slm2test(x, data, index,  listw, ...)
+
+  }, LMJOINT = {
+
+    bsk = LMHtest(x, data, index,  listw, ...)
+
+  }, CLMlambda = {
+
+    bsk = clmltest(x, data, index,  listw, ...)
+
+  }, CLMmu = {
+
+    bsk = clmmtest(x, data, index,  listw, ...)
+
+  })
+
+  return(bsk)
+
+}
+
+
+
+
+
+`slm1test.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 listw 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)
+
+	XpXi<-solve(crossprod(x))
+
+   cl<-match.call()
+  oo<-order(tind,ind)
+  x<-x[oo,]
+  y<-y[oo]
+  e<-e[oo]
+  ind<-ind[oo]
+  tind<-tind[oo]
+
+  N<-length(unique(ind))
+  k<-dim(x)[[2]]
+  T<-max(tapply(x[,1],ind,length))
+  NT<-length(ind)
+	indic<-seq(1,T)
+	inde<-as.numeric(rep(indic,each=N))
+	ind1<-seq(1,N)
+	inde1<-as.numeric(rep(ind1,T)) 
+
+
+
+		JIe<-tapply(e,inde1,sum)
+		JIe<-rep(JIe,T) 
+		G<-(crossprod(e,JIe)/ee)-1 
+tr<-function(R) sum(diag(R))
+
+		LM1<-sqrt((NT/(2*(T-1))))*as.numeric(G) 
+		
+		s<-NT-k 
+		B<-XpXi%*%t(x)   
+		
+fun<-function(Q) tapply(Q,inde1,sum) 
+		JIx<-apply(x,2,fun)
+		JIX<-matrix(,NT,k)
+for (i in 1:k) JIX[,i]<-rep(JIx[,i],T) ## "NOTE ON THE TRACE.R"
+		di<-numeric(NT)
+		XpJIX<-crossprod(x,JIX)
+		d1<-NT-tr(XpJIX%*%XpXi) 
+		Ed1<-d1/s 
+
+		di2<-numeric(NT)
+		JIJIx<-apply(JIX,2,fun)
+		JIJIX<-matrix(,NT,k)
+for (i in 1:k) JIJIX[,i]<-rep(JIJIx[,i],T)
+		JIJIxxpx<-JIJIX%*%XpXi
+		di1<- crossprod(x, JIJIxxpx)
+		tr1<-tr(di1)
+		XpIJX<-crossprod(x,JIX)
+		fp<-XpIJX%*%B
+		sp<-JIX%*%XpXi
+		tr3<-tr(fp%*%sp)
+		fintr<-NT*T-2*tr1+tr3 
+		Vd1<-2*(s*fintr - (d1^2))/s^2*(s+2) 
+
+SLM1<-((G+1)- Ed1)/sqrt(Vd1) 
+
+STAT2<- qnorm(0.95,lower.tail=TRUE)
+	statistics<-SLM1
+  pval <- pnorm(SLM1, lower.tail=FALSE)
+	
+  names(statistics)="SLM1"
+	method<- "Baltagi, Song and Koh SLM1 marginal test"
+  dname <- deparse(formula)
+  RVAL <- list(statistic = statistics,
+               method = method,
+               p.value = pval, data.name=deparse(formula), alternative="Random effects")
+  class(RVAL) <- "htest"
+  return(RVAL)
+}
+
+
+
+`slm2test.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]
+
+  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)
+  XpXi<-solve(crossprod(x))
+
+   cl<-match.call()
+  oo<-order(tind,ind)
+  x<-x[oo,]
+  y<-y[oo]
+  e<-e[oo]
+  ind<-ind[oo]
+  tind<-tind[oo]
+
+  N<-length(unique(ind))
+  k<-dim(x)[[2]]
+  T<-max(tapply(x[,1],ind,length))
+  NT<-length(ind)
+	indic<-seq(1,T)
+	inde<-as.numeric(rep(indic,each=N)) 
+	ind1<-seq(1,N)
+	inde1<-as.numeric(rep(ind1,T)) 
+
+
+
+		Ws<-listw2dgCMatrix(listw) 
+		Wst<-t(Wst)  
+		WWp<-(Ws+Wst)/2 
+
+yy<-function(q){ 
+	wq<-WWp%*%q
+	wq<-as.matrix(wq)
+	}
+
+		IWWpe<-unlist(tapply(e,inde,yy)) 
+		H<-crossprod(e,IWWpe)/crossprod(e) 
+		W2<-Ws%*%Ws 
+		WW<-crossprod(Ws) 
+    tr<-function(R) sum(diag(R))
+	b<-tr(W2+WW) 
+		LM2<-sqrt((N^2*T)/b)*as.numeric(H)
+		s<-NT-k
+lag<-function(QQ)lag.listw(listw,QQ)
+fun2<-function(Q) unlist(tapply(Q,inde,lag))
+	Wx<-apply(x,2,fun2)
+	WX<-matrix(Wx,NT,k)
+	XpWx<-crossprod(x,WX)
+	D2M<-XpWx%*%XpXi 
+	Ed2<- (T*sum(diag(Ws)) - tr(D2M))/s 
+
+	WWx<-apply(WX,2,fun2)
+	WWX<-matrix(WWx,NT,k)
+	XpWWX<-crossprod(x,WWX)				
+	spb<-XpWWX%*%XpXi
+	spbb<-tr(spb)
+	tpb<-XpWx%*%XpXi%*%XpWx%*%XpXi
+	fintr2<-T*tr(W2) - 2* spbb + tr(tpb)
+	Vd2<-2*(s*fintr2 - (sum(diag(D2M))^2))/s^2*(s+2) 
+	We<-unlist(tapply(e,inde,function(W) lag.listw(listw,W)))
+	d2<-crossprod(e,We)/ee
+	
+	SLM2<- (d2-Ed2)/sqrt(Vd2) 
+
+STAT2<- qnorm(0.95,lower.tail=TRUE)
+	statistics<-SLM2
+  pval <- pnorm(SLM2, lower.tail=FALSE)
+
+  names(statistics)="SLM2"
+	method<- "Baltagi, Song and Koh SLM2 marginal test"
+  dname <- deparse(formula)
+  RVAL <- list(statistic = statistics,
+               method = method,
+               p.value = pval, data.name=deparse(formula), alternative="Spatial autocorrelation")
+  class(RVAL) <- "htest"
+  return(RVAL)
+
+
+}
+
+
+
+`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]
+
+  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)
+	XpXi<-solve(crossprod(x))
+
+   cl<-match.call()
+  oo<-order(tind,ind)
+  x<-x[oo,]
+  y<-y[oo]
+  e<-e[oo]
+  ind<-ind[oo]
+  tind<-tind[oo]
+
+  N<-length(unique(ind))
+  k<-dim(x)[[2]]
+  T<-max(tapply(x[,1],ind,length))
+  NT<-length(ind)
+	indic<-seq(1,T)
[TRUNCATED]

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


More information about the Splm-commits mailing list