lmMult {reverseR} | R Documentation |
Checks and analyzes leave-multiple-out (LMO) p-values in linear regression
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 \alpha
-level.
Usage
lmMult(model, max = 5, n = 10000, alpha = 0.05,
method = c("pearson", "spearman"), verbose = TRUE)
Arguments
model |
the linear model of class |
max |
the maximum number of points to eliminate. |
n |
the number of samples to draw for each 1... |
alpha |
the |
method |
select either parametric ( |
verbose |
logical. If |
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 |
stat |
for each 1... |
Author(s)
Andrej-Nikolai Spiess
Examples
## 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)