rstar_glm {holi} | R Documentation |
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.
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 class '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 class '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 class 'poisson'
rstar_glm(
.formula,
.data,
.model = c("logistic", "linear", "poisson"),
.psidesc = "Coefficient of Interest",
.psival = 0,
.fpsi = 2,
.rstar.ci = FALSE,
trace = FALSE,
...
)
## Default S3 method:
rstar_glm(
.formula,
.data,
.model = c("logistic", "linear", "poisson"),
.psidesc = "Coefficient of Interest",
.psival = 0,
.fpsi = 2,
.rstar.ci = FALSE,
trace = FALSE,
...
)
.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. |
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
).
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.
# 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()