Learn R Programming

holi (version 0.1.1)

rstar_glm: 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,
  trace = FALSE,
  ...
)

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

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

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

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

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).

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*.

trace

Logical; if TRUE, print information about computation. (Default is FALSE)

...

Additional arguments passed to the likelihoodAsy functions.

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

Run this code

# 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()

Run the code above in your browser using DataLab