## ----include = FALSE----------------------------------------------------------
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
options(hcinfer.use_emoji = FALSE)

## -----------------------------------------------------------------------------
library(hcinfer)

schools <- transform(
  PublicSchools,
  income_scaled = income / 10000,
  income_scaled_sq = (income / 10000)^2
)
fit <- lm(expenditure ~ income_scaled + income_scaled_sq, data = schools)
cov <- vcov_hc(fit, type = "hcbeta")

cov$method_params[c("a_tilde", "b_tilde", "a_max", "b_max")]
max(cov$weights)

## -----------------------------------------------------------------------------
n <- cov$n
p <- cov$p

all(cov$weights >= n / (n - p))

