resample {LMMstar}R Documentation

Inference via Resampling for Linear Mixed Model

Description

Non-parametric bootstrap or permutation test for Linear Mixed Models.

Usage

resample(object, type, ...)

## S3 method for class 'lmm'
resample(
  object,
  type,
  effects,
  n.sample = 1000,
  studentized = TRUE,
  level = 0.95,
  correction = TRUE,
  trace = TRUE,
  seed = NULL,
  cpus = 1,
  export.cpus = NULL,
  ...
)

Arguments

object

a lmm object.

type

[character] should permutation test ("perm-var" or "perm-res") or non-parametric bootstrap ("boot") be used?

...

Not used. For compatibility with the generic method.

effects

[character vector] the variable(s) to be permuted or the effect(s) to be tested via non-parametric bootstrap. Can also be a function of the model parameters when performing non-parametric bootstrap.

n.sample

[integer] the number of samples used.

studentized

[logical] should a studentized boostrap or permutation test be used?

level

[numeric,0-1] the confidence level of the confidence intervals.

correction

[logical] correction to ensure non-0 p-values, e.g. with permutations the p.value is evaluated as (#more extreme + 1)/(n.sample + 1) instead of (#more extreme)/(n.sample).

trace

[logical] should the execution of the resampling be traced?

seed

[integer, >0] Random number generator (RNG) state used when starting resampling.

cpus

[integer, >0] number of child-processes for parallel evaluation. If NULL no state is set.

export.cpus

[character vector] name of the variables to export to each cluster.

Details

All approach are carried at the cluster level:

The studentized bootstrap keep the original estimate and standard error but uses the samples to evaluates the quantiles of the distribution used to form the confidence intervals. The studentized permutation test approximate the distribution of the test statistic under the null (instead of the distribution of the estimate under the null.).

P-values for the bootstrap are computed by centering the bootstrap distribution of the estimate or test statistic around 0 and evaluating the frequency at which it takes values more extreme than the observed estimate or test statistics.

References

Oliver E. Lee and Thomas M. Braun (2012), Permutation Tests for Random Effects in Linear Mixed Models. Biometrics, Journal 68(2).

Examples

## Not run: 

#### univariate linear regression ####
data(gastricbypassW, package = "LMMstar")
## rescale to ease optimization
gastricbypassW$weight1 <- scale(gastricbypassW$weight1)
gastricbypassW$weight2 <- scale(gastricbypassW$weight2)
gastricbypassW$glucagonAUC1 <- scale(gastricbypassW$glucagonAUC1)

e.lm <- lmm(weight2~weight1+glucagonAUC1, data = gastricbypassW)
model.tables(e.lm)

## non-parametric bootstrap
resample(e.lm, type = "boot", effects = c("weight1","glucagonAUC1"), seed = 10)
## permutation test
resample(e.lm, type = "perm-var", effects = "weight1", seed = 10) 
resample(e.lm, type = "perm-var", effects = "glucagonAUC1", seed = 10)
## using multiple cores
resample(e.lm, type = "boot", effects = c("weight1","glucagonAUC1"), cpus = 4)

#### random intercept model ####
data(gastricbypassL, package = "LMMstar")
gastricbypassL$weight <- scale(gastricbypassL$weight)
gastricbypassL$glucagonAUC <- scale(gastricbypassL$glucagonAUC)
gastricbypassL$gender <- as.numeric(gastricbypassL$id) %% 2
gastricbypassLR <- na.omit(gastricbypassL)

eCS.lmm <- lmm(weight~glucagonAUC+gender, data = gastricbypassLR,
               repetition = ~visit|id, structure = "CS")
model.tables(eCS.lmm)

## non-parametric bootstrap
resample(eCS.lmm, type = "boot", effects = c("glucagonAUC","gender"), seed = 10, trace = FALSE)
## permutation test
resample(eCS.lmm, type = "perm-var", effects = "gender", seed = 10)
resample(eCS.lmm, type = "perm-res", effects = "glucagonAUC", seed = 10) 

## End(Not run)


[Package LMMstar version 1.1.0 Index]