61
Canonical Grid model
Economics - Inference conventions
Synthetic illustration of covariance and inference choices; no causal identification claim.
- Scale
- Small
- Source
- economics-inference-conventions.grid
- Length
- 36 lines
- Collection
- Advanced language
- Level
- Intermediate
- Runtime
- Portable
- Version
- 1.0.0
MODEL "Economics - Inference conventions"
DESCRIPTION "Synthetic illustration of covariance and inference choices; no causal identification claim."
VERSION "1.0.0"
AUTHOR "Grid"
TAGS "economics", "econometrics", "regression"
# Six illustrative observations, one exposure and three groups.
# Three clusters are too few for dependable conventional asymptotic inference.
Outcome = [1, 3, 4, 7, 8, 10]
Exposure = [1; 2; 3; 4; 5; 6]
Groups = [1, 1, 2, 2, 3, 3]
input Confidence = 0.95
VALIDATE BETWEEN 0.8 AND 0.999 MESSAGE "Choose a confidence fraction between 0.8 and 0.999."
Labels = {termNames: ["Constant", "Exposure"]}
ClusterLabels = {inference: "cluster_t", termNames: ["Constant", "Exposure"]}
Classical = REGRESS(Outcome, Exposure, "classical", 0, TRUE, Confidence, Labels)
Robust = REGRESS(Outcome, Exposure, "hc1", 0, TRUE, Confidence, Labels)
ClusterResidual = REGRESS(Outcome, Exposure, "cluster", Groups, TRUE, Confidence, Labels)
ClusterGroups = REGRESS(Outcome, Exposure, "cluster", Groups, TRUE, Confidence, ClusterLabels)
output Comparison = REGRESS.TABLE(Classical, Robust, ClusterResidual, ClusterGroups)
output ExposureCoefficient = INDEX(ClusterGroups.coefficients, 1, 2)
output SameCoefficient = ASSERT_IDENTITY(ExposureCoefficient, INDEX(ClusterResidual.coefficients, 1, 2))
output ResidualDegrees = ClusterGroups.residualDf
output InferenceDegrees = ClusterGroups.inferenceDf
A1 = "Inference comparison: inspect or open the table"
B2 = Comparison
A4 = "Exposure coefficient"
B4 = ExposureCoefficient
A5 = "Residual degrees of freedom"
B5 = ResidualDegrees
A6 = "Inference degrees of freedom (clusters minus one)"
B6 = InferenceDegrees
A8 = "Synthetic illustration; statistical significance does not establish causality."
END MODEL