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. formula should be specified as, for example, ~ x1 + x2, where x1 and x2 are control variables, which can include contextual variables such as averages or quantiles among peers.

Glist

The adjacency matrix. For networks consisting of multiple subnets (e.g., schools), Glist must be a list of subnets, with the m-th element being an n_m \times n_m adjacency matrix, where n_m is the number of nodes in the m-th subnet.

parms

A vector defining the true values of (\rho, \lambda', \beta')', where \rho is the substitution parameter of the CES function and \lambda is either the peer effect parameter for the reduced-form specification or a 2-vector with the first component being conformity peer effects and the second component representing total peer effects. The parameters \rho, \lambda, and \beta can also be specified separately using the arguments rho, lambda, and beta (see the Details section of cespeer).

rho

The true value of the substitution parameter of the CES function.

lambda

The true value of the peer effect parameter \lambda. It must include conformity and total peer effects for the structural model.

beta

The true value of the vector \beta.

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 cespeer).

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 cespeer).

init

An optional initial guess for the equilibrium.

tol

The tolerance value used in the Fixed Point Iteration Method to compute the outcome y. The process stops if the \ell_1-distance between two consecutive values of y is less than tol.

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 data, it is retrieved from environment(formula), typically the environment from which cespeer.sim is called.

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

cespeer, qpeer.sim

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

[Package QuantilePeer version 0.0.1 Index]