## ----setup, include = FALSE--------------------------------------------------- knitr::opts_chunk$set(collapse = TRUE, comment = "#>", eval = FALSE) ## ----------------------------------------------------------------------------- # install.packages("spefa_0.1.0.tar.gz", repos = NULL, type = "source") # library(spefa) ## ----------------------------------------------------------------------------- # spefa(formula, data, index, W, # endogenous = NULL, scaling = NULL, mu = FALSE, # control = list(maxit = 500, reltol = 1e-9)) ## ----------------------------------------------------------------------------- # library(spefa) # data(spefademo) # # fit <- spefa(y ~ x1 + q1, data = spefademo, index = c("id", "time"), # W = spefaW, endogenous = list(q1 = ~ z1, q2 = ~ z2), # scaling = ~ x2 + q2) # # summary(fit) ## ----------------------------------------------------------------------------- # impacts(fit) # direct / indirect / total marginal effects # ef <- efficiency(fit) # spatially-corrected technical efficiency # summary(as.vector(ef$eff))