stepadj: Multipicity correction for Stepwise Selected models

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

Corrects the p-value due to model selection. It works with models of class glm and selected with function step {stats\).

Usage

1
2
3
step.adj(object, MC = 1000, scope = NULL, scale = 0, 
         direction = c("both", "backward", "forward"), 
         trace = 0, keep = NULL, steps = 1000, k = 2) 

Arguments

object

object of class glm. Note that formula have to write by variables name like y~var1+var2+var3, data is a data.frame (see example below), offset is not yet implemented, avoid its use, glm(formula, data, family=gaussian) produce the same result of lm(formula, data), then linear model can be allways performed

MC

number of random permutations for the dependent variable

scope

as in function step

scale

as in function step

direction

as in function step

trace

as in function step

keep

as in function step

steps

as in function step

k

as in function step, other arguments are not implemented yet.

Details

It performs anova function (stats library) on the model selected by function step vs the null model with the only intercept and it corrects for multiplicity. For lm models and gaussian glm models it computes a F-test, form other models it uses Chisquare-test (see also anova.glm and anova.lm help).

Value

An anova table with an extra column reporting the corrected p-value

Author(s)

Livio Finos and Chiara Brombin

References

L. Finos, C. Brombin, L. Salmaso (2010). Adjusting stepwise p-values in generalized linear models. Communications in Statistics - Theory and Methods.

See Also

glm, anova

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
set.seed(17)
y=rnorm(10)
x=matrix(rnorm(50),10,5)
#define a data.frame to be used in the glm function
DATA=data.frame(y,x)
#fit the model on a toy dataset
mod=glm(y~X1+X2+X3+X4+X5,data=DATA)

#select the model using function step
mod.step=step(mod, trace=0)
#test the selected model vs the null model
anova(glm(y~1, data=DATA),mod.step,test="F")

#step.adj do the same, but it also provides multiplicity control
step.adj(mod,MC=101, trace=0)

Example output

Analysis of Deviance Table

Model 1: y ~ 1
Model 2: y ~ X1 + X2 + X3 + X5
  Resid. Df Resid. Dev Df Deviance     F   Pr(>F)   
1         9     6.1606                              
2         5     0.5852  4   5.5754 11.91 0.009072 **
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Analysis of Deviance Table on Selected Model 
with Multiplicity Correction (weak FWE-control)
based on 101 Random permutations

Model 1: y ~ 1
Model 2: y ~ X1 + X2 + X3 + X5
  Resid. Df Resid. Dev Df Deviance     F    Pr(>F)  sw.adj P
1         9     6.1606                                      
2         5     0.5852  4   5.5754 11.91 0.0090721  0.089109

someMTP documentation built on March 1, 2021, 9:06 a.m.