permtest: Randomization test

View source: R/test.R

permtestR Documentation

Randomization test

Description

Carry out a randomization test for a treatment effect using a fitted model object or user defined test statistic.

Usage

permtest(f, trtname, runit, strat = NULL, data, nperm = 1000,
  ncores = 1, seed, quietly = T)

Arguments

f

fitted model object or function. If f is a fitted model object, then the coefficient corresponding to trtname is used as the test statistic. If f is a function, it must be defined such that when applied to data, it returns the observed univariate test statistic. This function can be as simple or complex as desired as long as its one input argument is a data frame structured the same as data.

trtname

character string specifying the name of randomized treatment variable in data (variable to permute)

runit

character string specifying the name of unit of randomization in data

strat

an optional character string specifying the name of the variable in data upon which randomization was stratified

data

a data frame containing the variables necessary for the function f. This argument is passed to f.

nperm

number of permutations for randomization test

ncores

number of cores to use for computation. If ncores > 1, permtest runs in parallel.

seed

a numerical seed to use, passed to set.seed (if ncores == 1) or registerDoRNG (if ncores > 1).

quietly

logical; if TRUE (and if ncores == 1), status updates will be printed to Console otherwise, suppress updates.

See Also

permci for a randomization-based CI


djrabideau/permuter documentation built on Jan. 9, 2025, 11:45 p.m.