sart {CDatanet} | R Documentation |
Estimate sart model
Description
sart
is used to estimate peer effects on censored data (see details). The model is presented in Xu and Lee(2015).
Usage
sart(
formula,
contextual,
Glist,
theta0 = NULL,
yb0 = NULL,
optimizer = "fastlbfgs",
npl.ctr = list(),
opt.ctr = list(),
print = TRUE,
cov = TRUE,
RE = FALSE,
data
)
Arguments
formula |
an object of class formula: a symbolic description of the model. The |
contextual |
(optional) logical; if true, this means that all individual variables will be set as contextual variables. Set the
|
Glist |
the adjacency matrix or list sub-adjacency matrix. |
theta0 |
(optional) starting value of |
yb0 |
(optional) expectation of y. |
optimizer |
is either |
npl.ctr |
list of controls for the NPL method (see |
opt.ctr |
list of arguments to be passed in |
print |
a Boolean indicating if the estimate should be printed at each step. |
cov |
a Boolean indicating if the covariance should be computed. |
RE |
a Boolean which indicates if the model if under rational expectation of not. |
data |
an optional data frame, list or environment (or object coercible by as.data.frame to a data frame) containing the variables
in the model. If not found in data, the variables are taken from |
Details
Model
The left-censored variable \mathbf{y}
is generated from a latent variable \mathbf{y}^*
.
The latent variable is given for all i as
y_i^* = \lambda \mathbf{g}_i y + \mathbf{x}_i'\beta + \mathbf{g}_i\mathbf{X}\gamma + \epsilon_i,
where \epsilon_i \sim N(0, \sigma^2)
.
The count variable y_i
is then define that is y_i = 0
if
y_i^* \leq 0
and y_i = y_i^*
otherwise.
Value
A list consisting of:
info |
list of general information on the model. |
estimate |
Maximum Likelihood (ML) estimator. |
yb |
ybar (see details), expectation of y. |
Gyb |
average of the expectation of y among friends. |
cov |
List of covariances. |
details |
outputs as returned by the optimizer. |
References
Xu, X., & Lee, L. F. (2015). Maximum likelihood estimation of a spatial autoregressive Tobit model. Journal of Econometrics, 188(1), 264-280, doi:10.1016/j.jeconom.2015.05.004.
See Also
Examples
# Groups' size
M <- 5 # Number of sub-groups
nvec <- round(runif(M, 100, 1000))
n <- sum(nvec)
# Parameters
lambda <- 0.4
beta <- c(2, -1.9, 0.8)
gamma <- c(1.5, -1.2)
sigma <- 1.5
theta <- c(lambda, beta, gamma, sigma)
# X
X <- cbind(rnorm(n, 1, 1), rexp(n, 0.4))
# Network
Glist <- list()
for (m in 1:M) {
nm <- nvec[m]
Gm <- matrix(0, nm, nm)
max_d <- 30
for (i in 1:nm) {
tmp <- sample((1:nm)[-i], sample(0:max_d, 1))
Gm[i, tmp] <- 1
}
rs <- rowSums(Gm); rs[rs == 0] <- 1
Gm <- Gm/rs
Glist[[m]] <- Gm
}
# data
data <- data.frame(x1 = X[,1], x2 = X[,2])
rm(list = ls()[!(ls() %in% c("Glist", "data", "theta"))])
ytmp <- simsart(formula = ~ x1 + x2 | x1 + x2, Glist = Glist,
theta = theta, data = data)
y <- ytmp$y
# plot histogram
hist(y)
opt.ctr <- list(method = "Nelder-Mead",
control = list(abstol = 1e-16, abstol = 1e-11, maxit = 5e3))
data <- data.frame(yt = y, x1 = data$x1, x2 = data$x2)
rm(list = ls()[!(ls() %in% c("Glist", "data"))])
out <- sart(formula = yt ~ x1 + x2, optimizer = "nlm",
contextual = TRUE, Glist = Glist, data = data)
summary(out)