Simulate the dependent variable of a SAR/SEM/SARAR model.
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 
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. 
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

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker. Vote for new features on Trello.