cespeer.sim {QuantilePeer} | R Documentation |
Simulating Peer Effect Models with a CES Social Norm
Description
cespeer.sim
simulates peer effect models with a Constant Elasticity of Substitution (CES) based social norm (Boucher et al., 2024).
Usage
cespeer.sim(
formula,
Glist,
parms,
rho,
lambda,
beta,
epsilon,
structural = FALSE,
init,
tol = 1e-10,
maxit = 500,
data
)
Arguments
formula |
A formula object (formula): a symbolic description of the model. |
Glist |
The adjacency matrix. For networks consisting of multiple subnets (e.g., schools), |
parms |
A vector defining the true values of |
rho |
The true value of the substitution parameter of the CES function. |
lambda |
The true value of the peer effect parameter |
beta |
The true value of the vector |
epsilon |
A vector of idiosyncratic error terms. If not specified, it will be simulated from a standard normal distribution (see the model specification in the Details section of |
structural |
A logical value indicating whether simulations should be performed using the structural model. The default is the reduced-form model (see the Details section of |
init |
An optional initial guess for the equilibrium. |
tol |
The tolerance value used in the Fixed Point Iteration Method to compute the outcome |
maxit |
The maximum number of iterations for the Fixed Point Iteration Method. |
data |
An optional data frame, list, or environment containing the model variables. If a variable is not found in |
Value
A list containing:
y |
The simulated variable. |
epsilon |
The idiosyncratic error. |
init |
The initial guess. |
iteration |
The number of iterations before convergence. |
References
Boucher, V., Rendall, M., Ushchev, P., & Zenou, Y. (2024). Toward a general theory of peer effects. Econometrica, 92(2), 543-565, doi:10.3982/ECTA21048.
See Also
Examples
set.seed(123)
ngr <- 50
nvec <- rep(30, ngr)
n <- sum(nvec)
G <- lapply(1:ngr, function(z){
Gz <- matrix(rbinom(nvec[z]^2, 1, 0.3), nvec[z])
diag(Gz) <- 0
Gz/rowSums(Gz) # Row-normalized network
})
tau <- seq(0, 1, 0.25)
X <- cbind(rnorm(n), rpois(n, 2))
l <- 0.55
rho <- 3
b <- c(4, -0.5, 1)
out <- cespeer.sim(formula = ~ X, Glist = G, rho = rho, lambda = l, beta = b)
summary(out$y)
out$iteration