seqER: Computes sequential evidence ratios

Description Usage Arguments Author(s) See Also Examples

View source: R/seqER.R

Description

Computes sequential evidence ratios, either based on the AIC or the BIC. 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, seqER will suppose that there is only one observation (i.e., one line) per subject.

Usage

1
2
seqER(ic = bic, 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 <[email protected]>

See Also

simER

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
31
32
## Not run: 
data(mtcars)
mod1 <- lm(mpg ~ cyl, mtcars)
mod2 <- lm(mpg ~ cyl + disp, mtcars)
seqER(ic = bic, mod1, mod2, nmin = 10)

# Example with ten permutation samples
data(mtcars)
mod1 <- lm(mpg ~ cyl, mtcars)
mod2 <- lm(mpg ~ cyl + disp, mtcars)
seqER(ic = bic, mod1, mod2, nmin = 10, nsims = 10)

# Example with blinding
data(mtcars)
mod1 <- lm(mpg ~ cyl, mtcars)
mod2 <- lm(mpg ~ cyl + disp, mtcars)
seqER(ic = bic, 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)
seqER(ic = bic, 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)
seqER(ic = WAIC, mod1, mod2, nmin = 10, id = "Subject", nsims = 10)

## End(Not run)

ESTER documentation built on May 2, 2019, 12:13 p.m.