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.
1 2  sim_binomial_probit(W,X,beta,rho,model="SAR",M=NULL,lambda=NULL,
sigma2=1,ord_iW=6,seed=123)

W 
the spatial weight matrix (works for 
X 
the matrix of covariates. 
beta 
the value of the covariates parameters. 
rho 
the value of the spatial dependence parameter (works for

model 
the type of model, between 
M 
the second spatial weight matrix (only if 
lambda 
the value of the spatial dependence parameter (only if

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. 
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).
a vector of zeros and ones
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

Questions? Problems? Suggestions? Tweet to @rdrrHQ 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.