lmMult: Checks and analyzes leave-multiple-out (LMO) p-values in...

Description Usage Arguments Details Value Author(s) Examples

View source: R/lmMult.R

Description

This function calculates leave-multiple-out (LMO) p-values for an increasing number of data points and identifies those resulting in "significance reversal" of the model, i.e. in the slope's p-value traversing the user-defined α-level.

Usage

1
2
lmMult(model, max = 5, n = 10000, alpha = 0.05, 
       method = c("pearson", "spearman"), verbose = TRUE) 

Arguments

model

the linear model of class lm.

max

the maximum number of points to eliminate.

n

the number of samples to draw for each 1...max.

alpha

the α-level to use as the threshold border.

method

select either parametric ("pearson") or rank-based ("spearman") statistics.

verbose

logical. If TRUE, results for each 1...max will be printed to the console.

Details

The algorithm
1) calculates the p-value of the full model (all data points),
2) calculates a LMO-p-value for all n sampled groups of 1...max points removed,
3) checks for significance reversal in the resulting model and
4) returns all n samples and the corresponding p-values.

Value

A list with the following items:

sample

a matrix with all max * n iterations, where a 1 indicates the left-out sample(s), as well as the corresponding p-values and group.

stat

for each 1...max LMO's, the percentage of model significance reversers.

Author(s)

Andrej-Nikolai Spiess

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## Example with single influencers and insignificant model (p = 0.115).
set.seed(123)
a <- 1:20
b <- 5 + 0.08 * a + rnorm(20, 0, 1)
LM1 <- lm(b ~ a)
res1 <- lmMult(LM1)
multPlot(res1)
stability(res1)

## Large example with 100 data points and highly significant model (p = 6.72E-8).
## No significance reversal up to the elimination of 20 points.
set.seed(123)
a <- 1:100
b <- 5 + 0.08 * a + rnorm(100, 0, 5)
LM2 <- lm(b ~ a)
res2 <- lmMult(LM2, max = 20)
multPlot(res2)
stability(res2)

reverseR documentation built on May 2, 2019, 10:59 a.m.