cespeer {QuantilePeer}R Documentation

Estimation of CES-Based Peer Effects Models

Description

cespeer estimates the CES-based peer effects model introduced by Boucher et al. (2024). See Details.

Usage

cespeer(
  formula,
  instrument,
  Glist,
  structural = FALSE,
  fixed.effects = FALSE,
  set.rho = NULL,
  grid.rho = seq(-400, 400, radius),
  radius = 5,
  tol = 1e-08,
  drop = NULL,
  compute.cov = TRUE,
  HAC = "iid",
  data
)

Arguments

formula

An object of class formula: a symbolic description of the model. formula should be specified as y ~ x1 + x2, where y is the outcome and x1 and x2 are control variables, which can include contextual variables such as averages or quantiles among peers.

instrument

An object of class formula indicating the excluded instrument. It should be specified as ~ z, where z is the excluded instrument for the outcome. Following Boucher et al. (2024), it can be an OLS exogenous prediction of y. This prediction is used to compute instruments for the CES function of peer outcomes.

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.

structural

A logical value indicating whether the reduced-form or structural specification should be estimated (see details).

fixed.effects

A logical value or string specifying whether the model includes subnet fixed effects. The fixed effects may differ between isolated and non-isolated nodes. Accepted values are "no" or "FALSE" (indicating no fixed effects), "join" or TRUE (indicating the same fixed effects for isolated and non-isolated nodes within each subnet), and "separate" (indicating different fixed effects for isolated and non-isolated nodes within each subnet). Note that "join" fixed effects are not applicable for structural models; "join" and TRUE are automatically converted to "separate".

set.rho

A fixed value for the CES substitution parameter to estimate a constrained model. Given this value, the other parameters can be estimated.

grid.rho

A finite grid of values for the CES substitution parameter \rho (see Details). This grid is used to obtain the starting value and define the GMM weight. It is recommended to use a finely subdivided grid.

radius

The radius of the subset in which the estimate for \rho is determined. The subset is a segment centered at the optimal \rho found using grid.rho. For better numerical optimization performance, use a finely subdivided grid.rho and a small radius.

tol

A tolerance value used in the QR factorization to identify columns of explanatory variable and instrument matrices that ensure a full-rank matrix (see the qr function). The same tolerance is also used in the to minimize the concentrated GMM objective function (see optimise).

drop

A dummy vector of the same length as the sample, indicating whether an observation should be dropped. This can be used, for example, to remove false isolates or to estimate the model only on non-isolated agents. These observations cannot be directly removed from the network by the user because they may still be friends with other agents.

compute.cov

A logical value indicating whether the covariance matrix of the estimator should be computed.

HAC

A character string specifying the correlation structure among the idiosyncratic error terms for covariance computation. Options are "iid" for independent errors, "hetero" for heteroskedastic non-autocorrelated errors, and "cluster" for heteroskedastic errors with potential within-subnet correlation.

data

An optional data frame, list, or environment (or an object that can be coerced by as.data.frame to a data frame) containing the variables in the model. If not found in data, the variables are taken from environment(formula), typically the environment from which cespeer is called.

Details

Let \mathcal{N} be a set of n agents indexed by the integer i \in [1, n]. Agents are connected through a network characterized by an adjacency matrix \mathbf{G} = [g_{ij}] of dimension n \times n, where g_{ij} = 1 if agent j is a friend of agent i, and g_{ij} = 0 otherwise. In weighted networks, g_{ij} can be a nonnegative variable (not necessarily binary) that measures the intensity of the outgoing link from i to j. The model can also accommodate such networks. Note that the network generally consists of multiple independent subnets (e.g., schools). The Glist argument is the list of subnets. In the case of a single subnet, Glist should be a list containing one matrix.

The reduced-form specification of the CES-based peer effects model is given by:

y_i = \lambda\left(\sum_{j = 1}^n g_{ij}y_j^{\rho}\right)^{1/\rho} + \mathbf{x}_i^{\prime}\beta + \varepsilon_i,

where \varepsilon_i is an idiosyncratic error term, \lambda captures the effect of the social norm \left(\sum_{j = 1}^n g_{ij}y_j^{\rho}\right)^{1/\rho}, and \beta captures the effect of \mathbf{x}_i on y_i. The parameter \rho determines the form of the social norm in the model.

The structural specification of the model differs for isolated and non-isolated individuals. For an isolated i, the specification is similar to a standard linear-in-means model without social interactions, given by:

y_i = \mathbf{x}_i^{\prime}\beta + \varepsilon_i.

If node i is non-isolated, the specification is:

y_i = \lambda\left(\sum_{j = 1}^n g_{ij}y_j^{\rho}\right)^{1/\rho} + (1 - \lambda_2)\mathbf{x}_i^{\prime}\beta + \varepsilon_i,

where \lambda_2 determines whether preferences exhibit conformity or complementarity/substitution. Identification of \beta and \lambda_2 requires the network to include a sufficient number of isolated individuals.

Value

A list containing:

model.info

A list with information about the model, including the number of subnets, the number of observations, and other key details.

gmm

A list of GMM estimation results, including parameter estimates, the covariance matrix, and related statistics.

first.search

A list containing initial estimations on the grid of values for \rho.

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

qpeer, linpeer

Examples


set.seed(123)
ngr  <- 50  # Number of subnets
nvec <- rep(30, ngr)  # Size of subnets
n    <- sum(nvec)

### Simulating Data
## Network matrix
G <- lapply(1:ngr, function(z) {
  Gz <- matrix(rbinom(nvec[z]^2, 1, 0.3), nvec[z], nvec[z])
  diag(Gz) <- 0
  # Adding isolated nodes (important for the structural model)
  niso <- sample(0:nvec[z], 1, prob = (nvec[z] + 1):1 / sum((nvec[z] + 1):1))
  if (niso > 0) {
    Gz[sample(1:nvec[z], niso), ] <- 0
  }
  # Row-normalization
  rs   <- rowSums(Gz); rs[rs == 0] <- 1
  Gz/rs
})

X   <- cbind(rnorm(n), rpois(n, 2))
l   <- 0.55
b   <- c(2, -0.5, 1)
rho <- -2
eps <- rnorm(n, 0, 0.4)

## Generating `y`
y <- cespeer.sim(formula = ~ X, Glist = G, rho = rho, lambda = l,
                 beta = b, epsilon = eps)$y

### Estimation
## Computing instruments
z <- fitted.values(lm(y ~ X))

## Reduced-form model
rest <- cespeer(formula = y ~ X, instrument = ~ z, Glist = G, fixed.effects = "yes",
                radius = 5, grid.rho = seq(-10, 10, 1))
summary(rest)

## Structural model
sest <- cespeer(formula = y ~ X, instrument = ~ z, Glist = G, fixed.effects = "yes",
                radius = 5, structural = TRUE, grid.rho = seq(-10, 10, 1))
summary(sest)

## Quantile model
z    <- qpeer.inst(formula = ~ X, Glist = G, tau = seq(0, 1, 0.1), max.distance = 2, 
                   checkrank = TRUE)$instruments
qest <- qpeer(formula = y ~ X, excluded.instruments  = ~ z, Glist = G, 
              fixed.effects = "yes", tau = seq(0, 1, 1/3), structural = TRUE)
summary(qest)


[Package QuantilePeer version 0.0.1 Index]