sim_binomial_probit: Simulate the dependent variable of a SAR/SEM/SARAR model.

Description Usage Arguments Details Value See Also Examples

Description

The function sim_binomial_probit is used to generate the dependent variable of a spatial binomial probit model, where all the data and parameters of the model can be modified by the user.

Usage

1
2
sim_binomial_probit(W,X,beta,rho,model="SAR",M=NULL,lambda=NULL,
sigma2=1,ord_iW=6,seed=123)

Arguments

W

the spatial weight matrix (works for "SAR" and "SEM" models).

X

the matrix of covariates.

beta

the value of the covariates parameters.

rho

the value of the spatial dependence parameter (works for "SAR" and "SEM" models).

model

the type of model, between "SAR", "SEM", "SARAR" (Default is "SAR").

M

the second spatial weight matrix (only if model is "SARAR").

lambda

the value of the spatial dependence parameter (only if model is "SARAR").

sigma2

the variance of the error term (Defaul is 1).

ord_iW

the order of approximation of the matrix (I_n-ρ W)^{-1}.

seed

to set the random generator seed of the error term.

Details

The sim_binomial_probit generates a vector of dependent variables for a spatial probit model. It allows to simulate the following DGPs (Data Generating Process): SAR

z = (I_n-ρ W)^{-1}(Xβ+ε)

SEM

z = (Xβ+(I_n-ρ W)^{-1}ε)

SARAR

z = (I_n-ρ W)^{-1}(Xβ+(I_n-λ M)^{-1}ε)

where ε are independent and normally distributed with mean zero and variance sigma2 (default is 1).

The matrix X of covariates, the corresponding parameters beta, the spatial weight matrix W and the corresponding spatial depndence parameter rho need to be passed by the user. The matrix (I_n-ρ W)^{-1} is computed using the ApproxiW function, that can either invert (I_n-ρ W) exactely, if order_iW=0 (not suitable for n bigger than 1000), or using the Taylor approximation

(I_n-ρ W)^{-1}= I_n+ρ W+ρ^2 W^2+…

of order order_iW (default is approximation of order 6).

Value

a vector of zeros and ones

See Also

generate_W, SpatialProbitFit.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
n <- 1000
nneigh <- 3
rho <- 0.5
beta <- c(4,-2,1)
W <- generate_W(n,nneigh)
X <- cbind(1,rnorm(n,2,2),rnorm(n,0,1))
y <- sim_binomial_probit(W,X,beta,rho,model="SAR") #SAR model
y <- sim_binomial_probit(W,X,beta,rho,model="SEM") #SEM model
M <- generate_W(n,nneigh,seed=1)
lambda <- -0.5
y <- sim_binomial_probit(W,X,beta,rho,model="SARAR",M=M,lambda=lambda) #SARAR 


Search within the ProbitSpatial package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.