bootstrap_pvals: Calculate Bootstrap p-values for fixed effects

View source: R/pvals.R

bootstrap_pvalsR Documentation

Calculate Bootstrap p-values for fixed effects

Description

Perform bootstrap tests based on the t-statistic for each fixed effect in order to calculate approximate p-values.

Usage

bootstrap_pvals(
  model,
  type,
  B,
  resample = NULL,
  reb_type = NULL,
  hccme = NULL,
  aux.dist = NULL
)

## S3 method for class 'merMod'
bootstrap_pvals(
  model,
  type,
  B,
  resample = NULL,
  reb_type = NULL,
  hccme = NULL,
  aux.dist = NULL
)

## S3 method for class 'lme'
bootstrap_pvals(
  model,
  type,
  B,
  resample = NULL,
  reb_type = NULL,
  hccme = NULL,
  aux.dist = NULL
)

Arguments

model

The model object you wish to bootstrap.

type

A character string indicating the type of bootstrap that is being requested. Possible values are "parametric", "residual", "case", "wild", or "reb" (random effect block bootstrap).

B

The number of bootstrap resamples.

resample

A logical vector specifying whether each level of the model should be resampled in the cases bootstrap. The levels should be specified from the highest level (largest cluster) of the hierarchy to the lowest (observation-level); for example for students within a school, specify the school level first, then the student level.

reb_type

Specification of what random effect block bootstrap version to implement. Possible values are 0, 1 or 2.

hccme

either "hc2" or "hc3", indicating which heteroscedasticity consistent covariance matrix estimator to use.

aux.dist

one of "mammen", "rademacher", "norm", "webb", or "gamma" indicating which auxiliary distribution to draw the errors from

Details

The bootstrap test compares the fitted model specified by the user to reduced models that eliminate a single fixed effect, the same comparison summarized by the table of coefficients in the summary. The bootstrap p-value is then calculated as $(n_extreme + 1) / (B + 1)$.

Value

A tibble giving the table of coefficients from the model summary with a column appended containing bootstrap p-values.

References

Davison, A., & Hinkley, D. (1997). Tests. In Bootstrap Methods and their Application (Cambridge Series in Statistical and Probabilistic Mathematics, pp. 136-190). Cambridge: Cambridge University Press. doi:10.1017/CBO9780511802843.005

Examples

## Not run: 
# This takes a while to run
bootstrap_pvals.merMod(jsp_mod, type = "wild", B = 1000, hccme = "hc2", aux.dist = "mammen")

## End(Not run)


lmeresampler documentation built on Feb. 16, 2023, 6:53 p.m.