if (requireNamespace("sandwich", quietly = TRUE)) {
x <- cbind(1, matrix(rnorm(500 * 4), ncol = 4))
y <- rbinom(500, 1, plogis(x %*% c(0.2, 0.3, -0.4, 0.1, 0.2)))
fit <- fastglm(x, y, family = binomial())
sandwich::vcovHC(fit)
sandwich::vcovHC(fit, type = "HC0")
}
Run the code above in your browser using DataLab