flipscores | R Documentation |
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.
flipscores(formula, family, data, score_type, n_flips=5000, alternative ="two.sided", id = NULL, seed = NULL, ...)
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 |
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"
).
glm class object with sign-flip score test.
See also the related functions (summary.flipscores
, anova.flipscores
, print.flipscores
).
Livio Finos, Riccardo De Santis, Vittorio Giatti, Jesse Hemerik and Jelle Goeman
"Robust testing in generalized linear models by sign-flipping score contributions" by J.Hemerik, J.Goeman and L.Finos.
anova.flipscores
, summary.flipscores
, flip
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.