flipscores {flipscores} | R Documentation |
Robust testing in GLMs, by sign-flipping score contributions
Description
Provides robust tests for testing in GLMs, by sign-flipping score contributions. The tests are often robust against overdispersion, heteroscedasticity and, in some cases, ignored nuisance variables.
Usage
flipscores(formula, family, data, score_type,
n_flips=5000, alternative ="two.sided",
id = NULL, seed = NULL, ...)
Arguments
formula |
see |
family |
see |
data |
see |
score_type |
The type of score that is computed. It can be "orthogonalized", "effective" or "basic". Both "orthogonalized" and "effective" take into account the nuisance estimation and they provide the same test statistic. In case of small samples "effective score" might have a slight anti-conservative behaviour. "orthogonalized effective score" gives a solution for this issue. Note that in case of a big model matrix, the "orthogonalized" may take a long time. |
n_flips |
The number of random flips of the score contributions.
When |
alternative |
It can be "greater", "less" or "two.sided" (default) |
id |
a |
seed |
|
... |
see |
Details
flipscores
borrow the same parameters from function glm
(and glm.nb
). See these helps for more details about parameters such as formula
,
data
, family
. Note: in order to use Negative Binomial family, family
reference must have quotes (i.e. family="negbinom"
).
Value
glm class object with sign-flip score test.
See also the related functions (summary.flipscores
, anova.flipscores
, print.flipscores
).
Author(s)
Livio Finos, Riccardo De Santis, Vittorio Giatti, Jesse Hemerik and Jelle Goeman
References
"Robust testing in generalized linear models by sign-flipping score contributions" by J.Hemerik, J.Goeman and L.Finos.
See Also
anova.flipscores
, summary.flipscores
, flip
Examples
set.seed(1)
dt=data.frame(X=rnorm(20),
Z=factor(rep(LETTERS[1:3],length.out=20)))
dt$Y=rpois(n=20,lambda=exp(dt$Z=="C"))
mod=flipscores(Y~Z+X,data=dt,family="poisson")
summary(mod)
# Equivalent to:
model=glm(Y~Z+X,data=dt,family="poisson")
mod2=flipscores(model)
summary(mod2)