[Splm-commits] r162 - in pkg: R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Apr 5 17:09:43 CEST 2013


Author: the_sculler
Date: 2013-04-05 17:09:42 +0200 (Fri, 05 Apr 2013)
New Revision: 162

Added:
   pkg/man/spreml.Rd
Modified:
   pkg/R/sarem2srREmod.R
   pkg/R/sem2srREmod.R
   pkg/man/effects.splm.Rd
   pkg/man/write.effects.splm.Rd
Log:
Added spreml.Rd, fixed parms' names in s(ar)em2srREmod.R


Modified: pkg/R/sarem2srREmod.R
===================================================================
--- pkg/R/sarem2srREmod.R	2013-04-04 23:34:29 UTC (rev 161)
+++ pkg/R/sarem2srREmod.R	2013-04-05 15:09:42 UTC (rev 162)
@@ -22,7 +22,7 @@
 
     ## set names for final parms vectors
     nam.beta <- dimnames(X)[[2]]
-    nam.errcomp <- c("phi", "rho", "lambda", "psi")
+    nam.errcomp <- c("phi", "psi", "rho", "lambda")
 
     ## initialize values for optimizer
     myparms0 <- coef0
@@ -220,11 +220,11 @@
     ## final parms
     betas <- as.vector(beta[[1]])
     sigma2 <- as.numeric(beta[["sigma2"]])
-    arcoef <- myparms[which(nam.errcomp=="psi")]  # lag-specific line
-    errcomp <- myparms[which(nam.errcomp!="psi")]
+    arcoef <- myparms[which(nam.errcomp=="lambda")]  # lag-specific line
+    errcomp <- myparms[which(nam.errcomp!="lambda")]
     names(betas) <- nam.beta
-    names(arcoef) <- "psi"                        # lag-specific line
-    names(errcomp) <- nam.errcomp[which(nam.errcomp!="psi")]
+    names(arcoef) <- "lambda"                        # lag-specific line
+    names(errcomp) <- nam.errcomp[which(nam.errcomp!="lambda")]
 
     dimnames(covB) <- list(nam.beta, nam.beta)
     dimnames(covAR) <- list(names(arcoef), names(arcoef))

Modified: pkg/R/sem2srREmod.R
===================================================================
--- pkg/R/sem2srREmod.R	2013-04-04 23:34:29 UTC (rev 161)
+++ pkg/R/sem2srREmod.R	2013-04-05 15:09:42 UTC (rev 162)
@@ -22,7 +22,7 @@
 
     ## set names for final parms vectors
     nam.beta <- dimnames(X)[[2]]
-    nam.errcomp <- c("phi", "rho", "lambda")
+    nam.errcomp <- c("phi", "psi", "rho")
 
     ## initialize values for optimizer
     myparms0 <- coef0
@@ -194,9 +194,9 @@
     betas <- as.vector(beta[[1]])
     sigma2 <- as.numeric(beta[["sigma2"]])
     arcoef <- NULL
-    errcomp <- myparms[which(nam.errcomp!="psi")]
+    errcomp <- myparms
     names(betas) <- nam.beta
-    names(errcomp) <- nam.errcomp[which(nam.errcomp!="psi")]
+    names(errcomp) <- nam.errcomp
 
     dimnames(covB) <- list(nam.beta, nam.beta)
     dimnames(covPRL) <- list(names(errcomp), names(errcomp))

Modified: pkg/man/effects.splm.Rd
===================================================================
--- pkg/man/effects.splm.Rd	2013-04-04 23:34:29 UTC (rev 161)
+++ pkg/man/effects.splm.Rd	2013-04-05 15:09:42 UTC (rev 162)
@@ -55,10 +55,10 @@
 data(Produc, package = "Ecdat")
 data(usaww)
 fm <- log(gsp) ~ log(pcap) + log(pc) + log(emp) + unemp
-lag <- spml(fm, data = Produc, listw = mat2listw(usaww), model="within", effect="twoways", lag=TRUE, method="eigen", Hess = TRUE)
-summary(lag)
-eff <- effects(lag) 
-print(eff)
+#lag <- spml(fm, data = Produc, listw = mat2listw(usaww), model="within", effect="twoways", lag=TRUE, method="eigen", Hess = TRUE)
+#summary(lag)
+#eff <- effects(lag) 
+#print(eff)
 err <- spml(fm, data = Produc, listw = mat2listw(usaww), model="within", effect="time", spatial.error="b", method="eigen", Hess = FALSE)
 summary(err)
 eff <- effects(err) 

Added: pkg/man/spreml.Rd
===================================================================
--- pkg/man/spreml.Rd	                        (rev 0)
+++ pkg/man/spreml.Rd	2013-04-05 15:09:42 UTC (rev 162)
@@ -0,0 +1,101 @@
+\name{spreml}
+\alias{spreml}
+\title{Spatial Panel Model with Random Effects by Maximum Likelihood}
+\description{Maximum likelihood (ML) estimation of spatial panel models
+  with random effects and serial error correlation.}
+
+
+\usage{
+spreml(formula, data, index = NULL, w, w2=w, lag = FALSE,
+          errors = c("semsrre", "semsr", "srre", "semre",
+          "re", "sr", "sem","ols", "sem2srre", "sem2re"),
+          pvar = FALSE, hess = FALSE, quiet = TRUE,
+          initval = c("zeros", "estimate"),
+          x.tol = 1.5e-18, rel.tol = 1e-15, ...) 
+}
+
+\arguments{
+  \item{formula}{a symbolic description of the model to be estimated}
+  \item{data}{an object of class \code{\link{data.frame}} or \code{pdata.frame}. A data frame containing the variables
+  in the model. When the object is a \code{\link{data.frame}}, the first two columns shall contain the indexes, unless otherwise specified. See \code{index}}
+  \item{index}{if not NULL (default), a character vector to identify the indexes among the columns of the \code{\link{data.frame}}}
+  \item{w}{an object of class \code{listw} or a \code{matrix}. It represents the spatial weights to be used in estimation.}
+  \item{w2}{an object of class \code{listw} or a
+  \code{matrix}. Second of set spatial weights for estimation, if
+  different from the first (e.g., in a 'sarar' model).}
+  \item{lag}{default=\code{FALSE}. If \code{TRUE}, a spatial lag of the dependent variable is added.}
+  \item{errors}{Specifies the error covariance structure. See details.}
+  \item{pvar}{legacy parameter here only for compatibility.}
+  \item{hess}{default=\code{FALSE}. If \code{TRUE} estimate the
+  covariance for beta_hat by numerical Hessian instead of GLS at optimal
+  values.}
+  \item{quiet}{default=\code{TRUE}. If \code{FALSE}, report function and
+  parameters values during optimization.}
+  \item{initval}{one of \code{c("zeros", "estimate")}, the initial values for
+  the parameters. If \code{"zeros"} a vector of zeros is used. if
+  \code{"estimate"} the initial values are retreived from the estimation
+  of the nested specifications. Alternatively, a numeric vector can be
+  specified.}
+  \item{x.tol}{control parameter for tolerance. See \code{\link{nlminb}} for details.}
+  \item{rel.tol}{control parameter for relative tolerance. See \code{\link{nlminb}} for details.}
+  \item{...}{additional arguments to pass over to other functions, e.g. \code{method}.}
+}
+\details{Second-level wrapper for estimation of random effects models
+  with serial and spatial correlation. The specifications without serial
+  correlation (no "sr" in \code{errors}) can be called through
+  \code{spml}, the extended ones only through \code{spreml}. 
+  The models are estimated by two-step Maximum Likelihood.
+  Abbreviations in \code{errors} correspond to: \code{"sem"}
+  Anselin-Baltagi type spatial autoregressive error: if
+  present, random effects are not spatially correlated;  \code{"sem2"}
+  Kapoor, Kelejin and Prucha-type spatial autoregressive error model
+  with spatially correlated random effects; \code{"sr"} serially
+  correlated remainder errors; \code{"re"} random effects; \code{"ols"}
+  spherical errors (usually combined with \code{lag=T}).
+  The optimization \code{method} can be passed on as optional
+  parameter. Default is \code{"nlminb"}; all constrained optimization
+  methods from \code{maxLik} are allowed (\code{"BFGS", "NM", "SANN"})
+  but the latter two are still experimental.
+} 
+
+\value{
+  An object of class \code{"splm"}.
+  \item{coefficients}{coefficients estimate of the model parameters }
+  \item{arcoef}{the coefficient for the spatial lag on \code{y}}
+  \item{errcomp}{the estimates of the error variance components}
+  \item{vcov}{the asymptotic variance covariance matrix of the estimated coefficients}
+  \item{vcov.arcoef}{the asymptotic variance of the
+  estimated spatial lag parameter}
+  \item{vcov.errcomp}{the asymptotic variance covariance matrix of the
+  estimated error covariance parameters}
+  \item{type}{'random effects ML'}
+  \item{residuals}{the model residuals}
+  \item{fitted.values}{the fitted values, calculated as \eqn{\hat{y}=X \hat{\beta}}}
+  \item{sigma2}{GLS residuals variance}
+  \item{model}{the matrix of the data used}
+  \item{call}{the call used to create the object}
+  \item{logLik}{the value of the log likelihood function at the optimum }
+  \item{errors}{the value of the \code{errors} argument}
+}
+\references{
+  Millo, G. (2013)
+  Maximum likelihood estimation of spatially and serially correlated
+  panels with random effects. Submitted to \emph{Computational
+  Statistics and Data Analysis}.
+}
+
+\author{Giovanni Millo}
+
+\seealso{\code{\link{spml}}}
+
+\examples{
+data(Produc, package = "Ecdat")
+data(usaww)
+fm <- log(gsp) ~ log(pcap) + log(pc) + log(emp) + unemp
+## random effects panel with spatial lag and serial error correlation
+## optimization method set to "BFGS"
+sarsrmod <- spreml(fm, data = Produc, w = usaww, errors="sr", lag=TRUE, method="BFGS")
+summary(sarsrmod)
+}
+
+\keyword{spatial}

Modified: pkg/man/write.effects.splm.Rd
===================================================================
--- pkg/man/write.effects.splm.Rd	2013-04-04 23:34:29 UTC (rev 161)
+++ pkg/man/write.effects.splm.Rd	2013-04-05 15:09:42 UTC (rev 162)
@@ -47,10 +47,10 @@
 data(Produc, package = "Ecdat")
 data(usaww)
 fm <- log(gsp) ~ log(pcap) + log(pc) + log(emp) + unemp
-lag <- spml(fm, data = Produc, listw = mat2listw(usaww), model="within", effect="twoways", lag=TRUE, method="eigen")
-summary(lag)
-eff <- effects(lag) 
-print(eff)
+#lag <- spml(fm, data = Produc, listw = mat2listw(usaww), model="within", effect="twoways", lag=TRUE, method="eigen")
+#summary(lag)
+#eff <- effects(lag) 
+#print(eff)
 err <- spml(fm, data = Produc, listw = mat2listw(usaww), model="within", effect="time", spatial.error="b", method="eigen", Hess= FALSE)
 summary(err)
 eff <- effects(err) 



More information about the Splm-commits mailing list