[Splm-commits] r126 - in pkg: . R man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sat Jun 11 12:45:54 CEST 2011
Author: the_sculler
Date: 2011-06-11 12:45:54 +0200 (Sat, 11 Jun 2011)
New Revision: 126
Modified:
pkg/ChangeLog
pkg/R/spfeml.R
pkg/R/spml.R
pkg/R/spreml.R
pkg/man/spml.Rd
Log:
Fixed call reporting in spml. Modified example(spml) to report a FE example along with an RE one.
Modified: pkg/ChangeLog
===================================================================
--- pkg/ChangeLog 2011-06-10 20:13:03 UTC (rev 125)
+++ pkg/ChangeLog 2011-06-11 10:45:54 UTC (rev 126)
@@ -1,3 +1,8 @@
+Changes in Version 0.9-05
+ o the call reported by spml is now, correctly, the user-level one instead of spreml' or spfeml's one
+ o example(spml) now produces a fixed effects and a random effects example
+ o the 'usaww' contiguity matrix for USA continental states has been fixed (Florida's neighbours were wrong) and documentation in usaww.Rd has been improved
+
Changes in Version 0.9-04
o added visible vcov.splm method for interoperability with lmtest, car
Modified: pkg/R/spfeml.R
===================================================================
--- pkg/R/spfeml.R 2011-06-10 20:13:03 UTC (rev 125)
+++ pkg/R/spfeml.R 2011-06-11 10:45:54 UTC (rev 126)
@@ -1,4 +1,4 @@
-spfeml<-function(formula, data=list(), index=NULL,listw,listw2 = NULL, model=c("lag","error", "sarar"),effects=c('pooled','spfe','tpfe','sptpfe'), method="eigen",na.action=na.fail,quiet=TRUE,zero.policy = NULL, interval = NULL, tol.solve = 1e-10, control=list(), legacy = FALSE, llprof = NULL){
+spfeml<-function(formula, data=list(), index=NULL,listw,listw2 = NULL, model=c("lag","error", "sarar"),effects=c('pooled','spfe','tpfe','sptpfe'), method="eigen",na.action=na.fail,quiet=TRUE,zero.policy = NULL, interval = NULL, tol.solve = 1e-10, control=list(), legacy = FALSE, llprof = NULL, cl = NULL, ...){
###
##model should be one between "lag" or "error"
##effects should be one of:
@@ -45,7 +45,8 @@
tindex <- data[,2]
## record call
-cl <- match.call()
+ ## now passed on from spml() but to be sure:
+ if(is.null(cl)) cl <- match.call()
#check the model
model<-match.arg(model)
@@ -168,7 +169,6 @@
mt<-terms(formula,data=data)
mf<-lm(formula,data,method="model.frame")#,na.action=na.fail
na.act<-attr(mf,'na.action')
- cl<-match.call()
indic<-seq(1,T)
inde<-as.numeric(rep(indic,each=N)) ####takes the first n observations
Modified: pkg/R/spml.R
===================================================================
--- pkg/R/spml.R 2011-06-10 20:13:03 UTC (rev 125)
+++ pkg/R/spml.R 2011-06-11 10:45:54 UTC (rev 126)
@@ -6,6 +6,9 @@
## wrapper function for all ML models
+ ## record call
+ cl <- match.call()
+
## check class(listw)
checklw <- function(x) {
if(!("listw" %in% class(x))) {
@@ -34,7 +37,7 @@
res <- spfeml(formula=formula, data=data, index=index,
listw=listw, listw2=listw2,
model=model, effects=effects,
- ...)
+ cl=cl, ...)
}, random={
switch(match.arg(effect),
time={stop("time random effects not implemented")},
@@ -44,13 +47,13 @@
b="semre", kkp="sem2re", none="re")})
res <- spreml(formula=formula, data=data, index=index,
w=listw2mat(listw), w2=listw2mat(listw2),
- lag=lag, errors=errors, ...)
+ lag=lag, errors=errors, cl=cl, ...)
}, pooling={
errors <- switch(match.arg(spatial.error),
b="sem", kkp="sem", none="ols")
res <- spreml(formula=formula, data=data, index=index,
w=listw2mat(listw), w2=listw2mat(listw2),
- lag=lag, errors=errors, ...)
+ lag=lag, errors=errors, cl=cl, ...)
})
return(res)
Modified: pkg/R/spreml.R
===================================================================
--- pkg/R/spreml.R 2011-06-10 20:13:03 UTC (rev 125)
+++ pkg/R/spreml.R 2011-06-11 10:45:54 UTC (rev 126)
@@ -4,7 +4,7 @@
"re", "sr", "sem","ols", "sem2re"),
pvar = FALSE, hess = FALSE, quiet = TRUE,
initval = c("zeros", "estimate"),
- x.tol = 1.5e-18, rel.tol = 1e-15, ...)
+ x.tol = 1.5e-18, rel.tol = 1e-15, cl = NULL, ...)
{
## added call to "sem2re" error structure (KKP)
@@ -17,7 +17,10 @@
}
index <- data[, 1]
tindex <- data[, 2]
- cl <- match.call()
+
+ ## retrieve call only if not passed on
+ if(is.null(cl)) cl <- match.call()
+
require(nlme)
if (!is.matrix(w)) {
if ("listw" %in% class(w)) {
Modified: pkg/man/spml.Rd
===================================================================
--- pkg/man/spml.Rd 2011-06-10 20:13:03 UTC (rev 125)
+++ pkg/man/spml.Rd 2011-06-11 10:45:54 UTC (rev 126)
@@ -78,10 +78,11 @@
data(Produc, package = "Ecdat")
data(usaww)
fm <- log(gsp) ~ log(pcap) + log(pc) + log(emp) + unemp
-## the two standard specifications:
-## random effects panel with spatial errors
-respaterr <- spml(fm, data = Produc, listw = mat2listw(usaww), model="random", spatial.error="b")
-summary(respaterr)
+## the two standard specifications (SEM and SAR) one with FE
+## and the other with RE:
+## fixed effects panel with spatial errors
+fespaterr <- spml(fm, data = Produc, listw = mat2listw(usaww), model="within", spatial.error="b")
+summary(fespaterr)
## random effects panel with spatial lag
respatlag <- spml(fm, data = Produc, listw = mat2listw(usaww), model="random", spatial.error="none", lag=TRUE)
summary(respatlag)
More information about the Splm-commits
mailing list