rstar_glm {holi}R Documentation

Compute r* Statistics for Generalized Linear Models

Description

The rstar_glm function computes r* statistics for hypothesis testing on coefficients of interest in generalized linear models (GLMs). It supports logistic, linear, and Poisson regression models. For logistic models, the outcome must be binary.

Usage

rstar_glm(
  .formula,
  .data,
  .model = c("logistic", "linear", "poisson"),
  .psidesc = "Coefficient of Interest",
  .psival = 0,
  .fpsi = 2,
  .rstar.ci = FALSE,
  ...
)

## S3 method for class 'logistic'
rstar_glm(
  .formula,
  .data,
  .model = c("logistic", "linear", "poisson"),
  .psidesc = "Coefficient of Interest",
  .psival = 0,
  .fpsi = 2,
  .rstar.ci = FALSE,
  ...
)

## S3 method for class 'linear'
rstar_glm(
  .formula,
  .data,
  .model = c("logistic", "linear", "poisson"),
  .psidesc = "Coefficient of Interest",
  .psival = 0,
  .fpsi = 2,
  .rstar.ci = FALSE,
  ...
)

## S3 method for class 'poisson'
rstar_glm(
  .formula,
  .data,
  .model = c("logistic", "linear", "poisson"),
  .psidesc = "Coefficient of Interest",
  .psival = 0,
  .fpsi = 2,
  .rstar.ci = FALSE,
  ...
)

## Default S3 method:
rstar_glm(
  .formula,
  .data,
  .model = c("logistic", "linear", "poisson"),
  .psidesc = "Coefficient of Interest",
  .psival = 0,
  .fpsi = 2,
  .rstar.ci = FALSE,
  ...
)

Arguments

.formula

A formula specifying the model.

.data

A data frame containing the variables in the model.

.model

The type of GLM model: "logistic", "linear", or "poisson".

.psidesc

A description of the parameter of interest.

.psival

The value of the parameter of interest under the null hypothesis.

.fpsi

The index of the parameter of interest.

.rstar.ci

Logical; if TRUE, compute confidence intervals for r*.

...

Additional arguments passed to the likelihoodAsy functions.

Value

A list with the object returned from likelihoodAsy::rstar (rs), the object returned from likelihoodAsy::rstar.ci (rs_ci), and the object returned from stats::glm (fit_glm).

References

Pierce, D. A., & Bellio, R. (2017). Modern Likelihood-Frequentist Inference. International Statistical Review / Revue Internationale de Statistique, 85(3), 519–541. doi:10.1111/insr.12232

Bellio R, Pierce D (2020). likelihoodAsy: Functions for Likelihood Asymptotics. R package version 0.51, https://CRAN.R-project.org/package=likelihoodAsy.

Examples


# Logistic model
rstar_glm(law ~ DriversKilled + VanKilled + drivers + kms,
          .data = Seatbelts,
          .model = "logistic") |> suppressWarnings()

# Poisson model
rstar_glm(count ~ spray,
          .data = InsectSprays,
          .model = "poisson") |> suppressWarnings()

# Linear model
rstar_glm(mpg ~ wt + hp,
          .data = mtcars,
          .model = "linear") |> suppressWarnings()


[Package holi version 0.1.0 Index]