vcov_conley | R Documentation |
Compute VCOVs robust to spatial correlation, a la Conley (1999).
vcov_conley(
x,
lat = NULL,
lon = NULL,
cutoff = NULL,
pixel = 0,
distance = "triangular",
ssc = NULL,
vcov_fix = TRUE
)
conley(cutoff = NULL, pixel = NULL, distance = NULL)
x |
A |
lat |
A character scalar or a one sided formula giving the name of the variable representing the latitude. The latitude must lie in [-90, 90], [0, 180] or [-180, 0]. |
lon |
A character scalar or a one sided formula giving the name of the variable representing the longitude. The longitude must be in [-180, 180], [0, 360] or [-360, 0]. |
cutoff |
The distance cutoff, in km. You can express the cutoff in miles by writing the number in character form and adding "mi" as a suffix: cutoff = "100mi" would be 100 miles. If missing, a rule of thumb is used to deduce the cutoff. |
pixel |
A positive numeric scalar, default is 0. If a positive number, the coordinates of
each observation are pooled into |
distance |
How to compute the distance between points. It can be equal to "triangular" (default) or "spherical". The latter case corresponds to the great circle distance and is more precise than triangular but is a bit more intensive computationally. |
ssc |
An object returned by the function |
vcov_fix |
Logical scalar, default is |
This function computes VCOVs that are robust to spatial correlations by assuming a correlation between the units that are at a geographic distance lower than a given cutoff.
The kernel is uniform.
If the cutoff is not provided, an estimation of it is given. This cutoff ensures that a minimum of units lie within it and is robust to sub-sampling. This automatic cutoff is only here for convenience, the most appropriate cutoff shall depend on the application and shall be provided by the user.
The function conley
does not compute VCOVs directly but is meant to be used in the argument
vcov
of fixest
functions (e.g. in vcov.fixest
or even in the estimation calls).
If the first argument is a fixest
object, then a VCOV is returned (i.e. a symmetric matrix).
If the first argument is not a fixest
object, then a) implicitly the arguments are shifted to
the left (i.e. vcov_conley("lat", "long")
is equivalent to
vcov_conley(lat = "lat", lon = "long")
) and b) a VCOV-request is returned and NOT a VCOV.
That VCOV-request can then be used in the argument vcov
of various fixest
functions
(e.g. vcov.fixest
or even in the estimation calls).
Conley TG (1999). "GMM Estimation with Cross Sectional Dependence", Journal of Econometrics, 92, 1-45.
data(quakes)
# We use conley() in the vcov argument of the estimation
feols(depth ~ mag, quakes, conley(100))
# Post estimation
est = feols(depth ~ mag, quakes)
vcov_conley(est, cutoff = 100)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.