seqtest: Sequential testing with evidence ratios

Description Usage Arguments Author(s) See Also Examples

Description

Computes sequential evidence ratios, either based on the AIC, BIC, WAIC, or LOOIC. Supported models currently include lm, merMod, or brmsfit models. When data involve repeated measures (and so multiple lines per subject), a column indicating the subject "id" should be provided to the id argument. If nothing is passed to the id argument, seqtest will suppose that there is only one observation (i.e., one line) per subject.

Usage

1
2
seqtest(ic = aic, mod1, mod2, nmin = 10, id = NULL, boundary = Inf,
  blind = FALSE, nsims = NULL)

Arguments

ic

Indicates whether to use the aic or the bic.

mod1

A model of class lm or lmerMod.

mod2

A model of class lm or lmerMod (of the same class of mod1).

nmin

Minimum sample size from which start to compute sequential evidence ratios.

id

If applicable (i.e., repeated measures), name of the "id" column of your dataframe, in character string.

boundary

The Evidence Ratio (or its reciprocal) at which the run is stopped as well

blind

If true, the function only returns a "continue or stop" message

nsims

Number of permutation samples to evaluate (is ignored if blind = TRUE)

Author(s)

Ladislas Nalborczyk <ladislas.nalborczyk@gmail.com>

See Also

ictab

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
## Not run: 
# A first simple example
data(mtcars)
mod1 <- lm(mpg ~ cyl, mtcars)
mod2 <- lm(mpg ~ cyl + disp, mtcars)
seqtest(ic = aic, mod1, mod2, nmin = 10)

# Plotting the results
seqtest(ic = aic, mod1, mod2, nmin = 10) %>% plot

# Example with 10 permutation samples
seqtest(ic = aic, mod1, mod2, nmin = 10, nsims = 10)

# Example with blinding
seqtest(ic = aic, mod1, mod2, nmin = 10, boundary = 10, blind = TRUE)

# Example with repeated measures
library(lme4)
data(sleepstudy)
mod1 <- lmer(Reaction ~ Days + (1|Subject), sleepstudy)
mod2 <- lmer(Reaction ~ Days + I(Days^2) + (1|Subject), sleepstudy)
seqtest(ic = aic, mod1, mod2, nmin = 10, id = "Subject", nsims = 10)

# Example with brmsfit models
library(brms)
mod1 <- brm(Reaction ~ Days + (1|Subject), sleepstudy)
mod2 <- brm(Reaction ~ Days + I(Days^2) + (1|Subject), sleepstudy)
seqtest(ic = WAIC, mod1, mod2, nmin = 10, id = "Subject")

## End(Not run)

lnalborczyk/ESTER documentation built on May 21, 2019, 7:36 a.m.