knitr::opts_chunk$set(comment = "#>", collapse = TRUE)

For an overview of the oola package see the vignette oola: Object-oriented loglikelihood adjustment.

@CB2007 @sandwich

library(oola)

Unless stated otherwise, the examples below are taken from the help files of the relevant function.

NOTE: add illustrations for what oola adds to sandwich.

Poisson

counts <- c(18,17,15,20,10,20,25,13,12)
outcome <- gl(3,1,9)
treatment <- gl(3,3)
d.AD <- data.frame(treatment, outcome, counts)
glm.D93 <- glm(counts ~ outcome + treatment, family = poisson, data = d.AD)
adj_pois <- alogLik(glm.D93)
summary(adj_pois)

Binomial

We replicate and example from Section 5.2 of the vignette Object-Oriented Computation of Sandwich Estimators of the sandwich package @sandwich.

got_AER <- requireNamespace("AER", quietly = TRUE)
if (got_AER) {
  data("Affairs", package = "AER")
  fm_probit <- glm(I(affairs > 0) ~ age + yearsmarried + religiousness +
                   occupation + rating, data = Affairs,
                   family = binomial(link = "probit"))
  adj_binom <- alogLik(fm_probit)
  summary(adj_binom)
}

References



paulnorthrop/oola documentation built on May 12, 2019, 10:52 a.m.