spml function

Spatial Panel Model by Maximum Likelihood

Spatial Panel Model by Maximum Likelihood

Maximum likelihood (ML) estimation of spatial panel models, possibly with fixed or random effects.

spml(formula, data, index=NULL, listw, listw2=listw, na.action, model=c("within","random","pooling"), effect=c("individual","time","twoways"), lag=FALSE, spatial.error=c("b","kkp","none"), ...) ## S3 method for class 'splm_ML' impacts(obj, listw = NULL, time = NULL, ..., tr = NULL, R = 200, type = "mult", empirical = FALSE, Q = NULL) ## S3 method for class 'splm_GM' impacts(obj, ..., tr=NULL, R=NULL, listw=NULL, type = "mult", time = NULL, evalues=NULL, tol=1e-6, empirical=FALSE, Q=NULL, KPformula = FALSE, prt = TRUE)

Arguments

  • formula: a symbolic description of the model to be estimated
  • data: an object of class data.frame or pdata.frame. A data frame containing the variables in the model. When the object is a data.frame, the first two columns shall contain the indexes, unless otherwise specified. See index
  • index: if not NULL (default), a character vector to identify the indexes among the columns of the data.frame
  • listw: an object of class listw or a matrix. It represents the spatial weights to be used in estimation.
  • listw2: an object of class listw or a matrix. Second of set spatial weights for estimation, if different from the first (e.g., in a 'sarar' model).
  • na.action: see spdep for more details.
  • model: one of c("within", "random", "pooling").
  • effect: one of c("individual","time","twoways"); the effects introduced in the model.
  • lag: default=FALSE. If TRUE, a spatial lag of the dependent variable is added.
  • spatial.error: one of c("b","kkp","none"). The type of spatial error in the specification, if any. See details.
  • ...: additional argument to pass over to other functions
  • obj: fitted model object
  • time: ??time??
  • tr: A vector of traces of powers of the spatial weights matrix created using 'trW', for approximate impact measures
  • R: If given, simulations are used to compute distributions for the impact measures, returned as 'mcmc' objects
  • type: Either "mult" (default) for powering a sparse matrix (with moderate or larger N, the matrix becomes dense, and may lead to swapping), or "MC" for Monte Carlo simulation of the traces (the first two simulated traces are replaced by their analytical equivalents), or "moments" to use the looping space saving algorithm proposed by Smirnov and Anselin (2009) - for "moments", 'W' must be symmetric, for row-standardised weights through a similarity transformation
  • empirical: Argument passed to 'mvrnorm' (default FALSE)
  • Q: default NULL, else an integer number of cumulative power series impacts to calculate if 'tr' is given
  • evalues: vector of eigenvalues of spatial weights matrix for impacts calculations
  • tol: Argument passed to 'mvrnorm'
  • KPformula: not yet implemented
  • prt: not yet implemented

Details

The models are estimated by two-step Maximum Likelihood. Further optional parameters to be passed on to the estimator may be: pvar: if TRUE the pvar function is called hess: if TRUE use numerical Hessian instead of GLS for the standard errors of the estimates quiet: if FALSE report function and parameters values during optimization initval: one of c("zeros", "estimate"), the initial values for the parameters. If "zeros" a vector of zeros is used. if "estimate" the initial values are retreived from the estimation of the nested specifications. Alternatively, a numeric vector can be specified. x.tol: Tolerance. See nlminb for details. rel.tol: Relative tolerance. See nlminb for details.

Returns

An object of class "splm". - coefficients: coefficients estimate of the model parameters

  • arcoef: the coefficient for the spatial lag on y

  • errcomp: the estimates of the error variance components

  • vcov: the asymptotic variance covariance matrix of the estimated coefficients

  • vcov.arcoef: the asymptotic variance of the estimated spatial lag parameter

  • vcov.errcomp: the asymptotic variance covariance matrix of the estimated error covariance parameters

  • type: 'random effects ML'

  • residuals: the model residuals

  • fitted.values: the fitted values, calculated as y^=Xβ^\hat{y}=X \hat{\beta}

  • sigma2: GLS residuals variance

  • model: the matrix of the data used

  • call: the call used to create the object

  • logLik: the value of the log likelihood function at the optimum

  • errors: the value of the errors argument

References

Baltagi, B.H., Song, S.H., Jung B. and Koh, W. (2007) Testing panel data regression models with spatial and serial error correlation. Journal of Econometrics, 140 , 5-51.

Millo, G., Piras, G. (2012) splm: Spatial Panel Data Models in R. Journal of Statistical Software, 47(1) , 1--38. URL http://www.jstatsoft.org/v47/i01/.

Author(s)

Giovanni Millo

See Also

spgm

Examples

data(Produc, package = "plm") data(usaww) fm <- log(gsp) ~ log(pcap) + log(pc) + log(emp) + unemp ## 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 = spdep::mat2listw(usaww), model="within", spatial.error="b", Hess = FALSE) summary(fespaterr) ## random effects panel with spatial lag respatlag <- spml(fm, data = Produc, listw = spdep::mat2listw(usaww), model="random", spatial.error="none", lag=TRUE) summary(respatlag) ## calculate impact measures #impac1 <- impacts.splm(respatlag, listw = spdep::mat2listw(usaww, #style = "W"), time = 17) #summary(impac1, zstats=TRUE, short=TRUE)
  • Maintainer: Giovanni Millo
  • License: GPL-2
  • Last published: 2023-12-20

Useful links