Performs exact tests on specified coefficients of a linear model object using permutation tests to generate p-values and confidence intervals around the estimated coefficients. This function can handle both studentized and non-studentized test statistics, and allows the user to specify various parameters for the test.

exactt(
  model,
  data,
  side = "both",
  alpha = 0.05,
  variables = NULL,
  beta0 = NULL,
  nBlocks = 5,
  nPerms = NULL,
  studentize = TRUE,
  optimize = FALSE,
  seed = 31740,
  denominator = "GX1",
  Q.X1 = NULL,
  GX.indices = NULL,
  root.tolerance = 1e-09,
  ...
)

Arguments

model

A formula specifying the model.

data

A data frame or matrix containing the variables used in the model.

side

A character to indicate the side of the test.

alpha

The significance level used for the hypothesis tests; defaults to 0.05.

variables

Optional; a character vector of predictor names to test. If NULL, all predictors in the model are tested.

beta0

Optional; a numeric vector of null hypothesis values for the coefficients. Must be the same length as variables if not NULL.

nBlocks

The number of blocks to use for block permutations.

nPerms

Optional; the number of permutations to perform. If NULL or greater than the number of possible permutations, all permutations are used.

studentize

Logical indicating whether to use studentized residuals for the test.

optimize

Logical indicating whether to optimize the ordering of the data.

seed

Seed used when optimizing using GA::ga(). Default is 31740.

denominator

Character argument indicating how to calculate epsilon hat.

Q.X1

Use custom QX1 value.

GX.indices

Indices for max rank GX. Used for warm start.

root.tolerance

Tolerance for determining real and extraneous roots (when denominator = "X1" or "noX1").

...

Additional arguments passed to GA::ga() for optimizing power. This can include parameters like popSize, maxiter, parallel, etc., that are used to configure the genetic algorithm. Note that when sample size is large optimizing is computationally expensive and has little effect.

Value

The p-value of the test that the null values of beta are 0.

Details

The function divides the data into blocks specified by nBlocks and performs permutations within across blocks to generate the null distribution of the test statistic. The user can specify a set number of permutations with nPerms, or allow the function to calculate all possible permutations if nPerms is unspecified or too large.

If studentize is TRUE, studentized residuals are used to adjust the test statistics, potentially leading to more robust inference under model misspecification.

The function allows for a high degree of customization through its parameters and can handle large datasets and complex model structures efficiently.