| Title: | Partial Maximum Likelihood Estimation of Spatial Probit Models |
|---|---|
| Description: | Estimate spatial autoregressive nonlinear probit models with and without autoregressive disturbances using partial maximum likelihood estimation. Estimation and inference regarding marginal effects is also possible. For more details see Bille and Leorato (2020) <doi:10.1080/07474938.2019.1682314>. |
| Authors: | Daniele Spinelli [aut, cre], Anna Gloria Bille' [aut], Samantha Leorato [aut] |
| Maintainer: | Daniele Spinelli <[email protected]> |
| License: | GPL (>= 3) |
| Version: | 1.0.1 |
| Built: | 2026-05-26 06:39:23 UTC |
| Source: | https://github.com/d-spinelli/pmlsp |
Average partial (i.e., marginal) total, direct and indirect effects from a pmlsprobit object
ape(mod, variables = NULL)ape(mod, variables = NULL)
mod |
Object of class inheriting from "pmlsbp" |
variables |
a string including the variable names of the covariates for
which the marginal effects should be calculated using numeric derivatives. It is valid only if |
A numeric vector with predicted values.
# load the data data(oldcol, package="spdep") # create binary response variable COL.OLD$y<-as.numeric(COL.OLD$CRIME>35) # prepare the spatial weight matrix listw <- spdep::nb2listw(COL.nb, style="W") set.seed(857489) # fit a SAR model mod<-pmlsbp (y~HOVAL+INC, COL.OLD, W=listw, model = 'SAR',print.level = 2, mvtnorm_control=list(M=25e2, sim_type="mc" , tol = .Machine$double.eps, fast = FALSE), grouping = 7, na.action=na.omit, spectral = TRUE, iterlim=1e5, tol.solve = 1e-300) # estimate the average partial effects ape(mod)# load the data data(oldcol, package="spdep") # create binary response variable COL.OLD$y<-as.numeric(COL.OLD$CRIME>35) # prepare the spatial weight matrix listw <- spdep::nb2listw(COL.nb, style="W") set.seed(857489) # fit a SAR model mod<-pmlsbp (y~HOVAL+INC, COL.OLD, W=listw, model = 'SAR',print.level = 2, mvtnorm_control=list(M=25e2, sim_type="mc" , tol = .Machine$double.eps, fast = FALSE), grouping = 7, na.action=na.omit, spectral = TRUE, iterlim=1e5, tol.solve = 1e-300) # estimate the average partial effects ape(mod)
The eurostat data frame has 312 row and 10 variables. Unit of analysis: 312 regions in Europe. Additionally, the eurostat.nb includes the neighbour list based on a consider a k-nearest neighbour approach with k = 11
data(eurostat)data(eurostat)
A data frame with 312 rows and 10 variables:
nuts_idRegion identifier
country_idCountry identfier
employmentEmployement rate in percentage
gdpGDP per capita
isced_02percentage of residents aged 25-64 with secondary school achievement or lower
isced_34percentage of residents aged 25-64 with high school achievement or lower
isced_58percentage of residents aged 25-64 with bachelor degree or higher
longLongitude
latLatitude
https://ec.europa.eu/eurostat/data/database
Estimation of Partial Maximum Likelihood Spatial Autoregressive (SAR) Probit Models and Spatial Autoregressive Probit Models with Autoregressive Disturbances (SARAR).
The model structure for the SARAR model is:
+ u |
|
where and . The SAR model assumes
pmlsbp(formula,data, model="SAR", grouping=2, W=NULL, zero.policy =spatialreg::get.ZeroPolicyOption(), M=NULL, formula_xlag=NULL, W2=NULL, method_inv="solve", start=NULL, subset=NULL, na.action=na.fail,qu=Inf, iterlim=1000, mvtnorm_control=list(M=1e4, sim_type="qmc" , tol = .Machine$double.eps, fast = FALSE), finalHessian=ifelse( method=="bhhh",method,TRUE), method="bhhh",print.level=2, vce.type='asy' , Conley=list(coords=NULL,LM=2),nBoot=1e3 , spectral=F, tol.solve= .Machine$double.eps, version=0, ...) ## S3 method for class 'pmlsprobit' summary(object, ...) ## S3 method for class 'pmlsprobit' vcov(object, ...) ## S3 method for class 'pmlsprobit' coef(object, ...) ## S3 method for class 'pmlsprobit' print(x, digits = max(3, getOption("digits") - 3), ...)pmlsbp(formula,data, model="SAR", grouping=2, W=NULL, zero.policy =spatialreg::get.ZeroPolicyOption(), M=NULL, formula_xlag=NULL, W2=NULL, method_inv="solve", start=NULL, subset=NULL, na.action=na.fail,qu=Inf, iterlim=1000, mvtnorm_control=list(M=1e4, sim_type="qmc" , tol = .Machine$double.eps, fast = FALSE), finalHessian=ifelse( method=="bhhh",method,TRUE), method="bhhh",print.level=2, vce.type='asy' , Conley=list(coords=NULL,LM=2),nBoot=1e3 , spectral=F, tol.solve= .Machine$double.eps, version=0, ...) ## S3 method for class 'pmlsprobit' summary(object, ...) ## S3 method for class 'pmlsprobit' vcov(object, ...) ## S3 method for class 'pmlsprobit' coef(object, ...) ## S3 method for class 'pmlsprobit' print(x, digits = max(3, getOption("digits") - 3), ...)
formula |
an object of class "formula": a symbolic description of the model to be fit. |
data |
an optional data frame containing the variables in the model. By default the variables are taken from the environment which the function is called. |
model |
a character ( |
grouping |
an integer defining the number of observations to include in the tuples to be used for estimation, the default is 2. |
W |
a listw object created for example by |
zero.policy |
default NULL, use global option value; if TRUE assign zero to the lagged
value of zones without neighbours, if FALSE (default) assign NA - causing
|
M |
a listw object created for example by |
formula_xlag |
an object of class "formula": a symbolic description of the covariates to be spatially lagged. |
W2 |
a listw object created for example by |
method_inv |
a character for setting the inversion of |
start |
numeric vector, initial value of parameters. |
subset |
an optional vector specifying a subset of observations to be used for fitting |
na.action |
a function (default |
qu |
an integer to be used only if |
iterlim |
an intenger. Maximum number of iterations to be used by |
mvtnorm_control |
an optional object of class |
finalHessian |
how (and if) to calculate the final Hessian. Either |
method |
maximisation method to be used by |
print.level |
Integer, debugging information. Larger number prints more details (see |
vce.type |
an optional character specifying the type of variance covariance
estimation (VCE) to be performed. It can be either |
Conley |
a list with two members, which is relevant only for |
nBoot |
an integer, the number of bootstrap samples to be used for vce.type="bootstrap".
It is relevant only if |
spectral |
a boolean. If |
tol.solve |
the tolerance to be used by |
version |
an integer that affects the calculation only if the number of observations is even and |
... |
additional arguments to be passed to |
object |
a |
x |
a |
digits |
integer, used for number formatting the decimal digits |
pmlsbp returns an object of class "pmlsprobit".
The function summary is used to obtain and print a summary of the results.
A object of class "pmlsprobit" is list containing the following components:
beta |
a named vector including the and , the coefficents attached to the variables resulting from formula and formula_xlag |
call |
the call |
code |
|
estimate |
a named vector of model estimates |
f |
a list including useful matrices to be used in predict |
maximum |
the value of the partial log-likelihood given the data and the model estimates |
message |
convergence message |
model |
|
model.type |
either "SAR" or "SARAR" |
rho |
a named scalar for the parameter |
slx |
TRUE if the model includes spatially lagged covariates |
start |
a named vector, the starting values used in estimation |
terms |
the terms object used. |
vcov |
the variance-covariance matrix of the estimates |
W |
matrix |
lambda |
a named scalar for parameter (only for SARAR models) |
M |
matrix (only for SARAR models) |
W2 |
matrix (only if slx=TRUE)
|
summary(pmlsprobit): computes and returns a list of summary statistics of the fitted spatial probit model
vcov(pmlsprobit): returns the variance covariance matrix of a "pmlsprobit" object
coef(pmlsprobit): returns the coefficients estimate from a "pmlsprobit" object
print(pmlsprobit): prints the call and the coefficient estimates of a "pmlsprobit" object
Bille', A. G., & Leorato, S. (2020). Partial ML estimation for spatial autoregressive nonlinear probit models with autoregressive disturbances. Econometric Reviews, 39(5), 437-475.
# load the data data(oldcol, package="spdep") # create binary response variable COL.OLD$y<-as.numeric(COL.OLD$CRIME>35) # prepare the spatial weight matrix listw <- spdep::nb2listw(COL.nb, style="W") set.seed(857489) # fit a SAR model mod<-pmlsbp (y~HOVAL+INC, COL.OLD, W=listw, model = 'SAR',print.level = 2, grouping = 7, na.action=na.omit, spectral = TRUE, iterlim=1e5)# load the data data(oldcol, package="spdep") # create binary response variable COL.OLD$y<-as.numeric(COL.OLD$CRIME>35) # prepare the spatial weight matrix listw <- spdep::nb2listw(COL.nb, style="W") set.seed(857489) # fit a SAR model mod<-pmlsbp (y~HOVAL+INC, COL.OLD, W=listw, model = 'SAR',print.level = 2, grouping = 7, na.action=na.omit, spectral = TRUE, iterlim=1e5)
Predicted values based on pmlsprobit object
## S3 method for class 'pmlsprobit' predict( object, type = "prob", newdata = NULL, variables = NULL, delta.method = F, ... )## S3 method for class 'pmlsprobit' predict( object, type = "prob", newdata = NULL, variables = NULL, delta.method = F, ... )
object |
a |
type |
|
newdata |
An optional data frame in which to look for variables with which to predict. If omitted, the fitted values are used. |
variables |
a string including the variable names of the covariates for
which the marginal effects should be calculated using numeric derivatives. It is valid only if |
delta.method |
a boolean. If |
... |
additional arguments |
A numeric vector with predicted values.
# load the data data(oldcol, package="spdep") # create binary response variable COL.OLD$y<-as.numeric(COL.OLD$CRIME>35) # prepare the spatial weight matrix listw <- spdep::nb2listw(COL.nb, style="W") set.seed(857489) # fit a SAR model mod<-pmlsbp (y~HOVAL+INC, COL.OLD, W=listw, model = 'SAR',print.level = 2, mvtnorm_control=list(M=25e2, sim_type="mc" , tol = .Machine$double.eps, fast = FALSE), grouping = 7, na.action=na.omit, spectral = TRUE, iterlim=1e5, tol.solve = 1e-300) # estimate the average partial effects prob <- predict(mod) head(prob)# load the data data(oldcol, package="spdep") # create binary response variable COL.OLD$y<-as.numeric(COL.OLD$CRIME>35) # prepare the spatial weight matrix listw <- spdep::nb2listw(COL.nb, style="W") set.seed(857489) # fit a SAR model mod<-pmlsbp (y~HOVAL+INC, COL.OLD, W=listw, model = 'SAR',print.level = 2, mvtnorm_control=list(M=25e2, sim_type="mc" , tol = .Machine$double.eps, fast = FALSE), grouping = 7, na.action=na.omit, spectral = TRUE, iterlim=1e5, tol.solve = 1e-300) # estimate the average partial effects prob <- predict(mod) head(prob)