{
  "name": "Documented Newey-West (HAC) defaults in statsmodels and R sandwich",
  "description": "Compares how three documented software routes set the lag, kernel, prewhitening and small-sample correction for Newey-West standard errors. Compiled from the statsmodels cov_hac and get_robustcov_results documentation pages and the R sandwich NeweyWest help page, read on 2026-11-18.",
  "page": "https://casrai.org/guides/newey-west-standard-errors",
  "publisher": "CASRAI",
  "license": "https://creativecommons.org/licenses/by/4.0/",
  "dateModified": "2026-11-18T05:37:57Z",
  "temporalCoverage": null,
  "spatialCoverage": null,
  "columns": [
    {
      "name": "Software route",
      "unit": "",
      "description": ""
    },
    {
      "name": "Lag rule",
      "unit": "",
      "description": ""
    },
    {
      "name": "Kernel",
      "unit": "",
      "description": ""
    },
    {
      "name": "Prewhitening",
      "unit": "",
      "description": ""
    },
    {
      "name": "Small-sample correction",
      "unit": "",
      "description": ""
    }
  ],
  "rows": [
    {
      "Software route": "statsmodels cov_hac (defaults)",
      "Lag rule": "nlags=None gives floor[4(T/100)^(2/9)]",
      "Kernel": "Bartlett (only kernel currently)",
      "Prewhitening": "None",
      "Small-sample correction": "use_correction=True by default"
    },
    {
      "Software route": "statsmodels get_robustcov_results, cov_type='HAC'",
      "Lag rule": "maxlags is required (an integer you supply)",
      "Kernel": "bartlett (default) or uniform",
      "Prewhitening": "None",
      "Small-sample correction": "use_correction is an argument (True/False)"
    },
    {
      "Software route": "R sandwich NeweyWest (defaults)",
      "Lag rule": "lag=NULL gives floor(bwNeweyWest(x)), the Newey-West (1994) automatic bandwidth",
      "Kernel": "Bartlett",
      "Prewhitening": "VAR(1) prewhitening (prewhite=TRUE)",
      "Small-sample correction": "adjust=FALSE; TRUE multiplies by n/(n-k)"
    },
    {
      "Software route": "R sandwich NeweyWest, 1987 recipe",
      "Lag rule": "User-specified lag",
      "Kernel": "Bartlett",
      "Prewhitening": "prewhite=FALSE",
      "Small-sample correction": "adjust=FALSE unless set to TRUE"
    }
  ],
  "sources": [
    {
      "title": "statsmodels: sandwich_covariance.cov_hac",
      "url": "https://www.statsmodels.org/stable/generated/statsmodels.stats.sandwich_covariance.cov_hac.html",
      "accessed": "2026-11-18"
    },
    {
      "title": "statsmodels: RegressionResults.get_robustcov_results",
      "url": "https://www.statsmodels.org/stable/generated/statsmodels.regression.linear_model.RegressionResults.get_robustcov_results.html",
      "accessed": "2026-11-18"
    },
    {
      "title": "R sandwich: NeweyWest help page",
      "url": "https://www.rdocumentation.org/packages/sandwich/versions/3.1-1/topics/NeweyWest",
      "accessed": "2026-11-18"
    }
  ]
}