anova.flipscores {flipscores}R Documentation

anova.flipscores

Description

This is the anova method for flipscores object. Remark: it performs type III deviance decomposition as in car::Anova.

Usage

## S3 method for class 'flipscores'
anova(object, model1 = NULL, score_type = NULL, n_flips = 5000, id = NULL, ...)

Arguments

object

(the object) glm (or flipscores) object with the model under the null hypothesis (i.e. the covariates, the nuisance parameters).

model1

a glm (or flipscores) or a matrix (or vector). If it is a glm object, it has the model under the alternative hypothesis. The variables in model1 are the same variables in object plus one or more variables to be tested. Alternatively, if model1 is a matrix, it contains the tested variables column-wise.

score_type

The type of score that is computed. It can be "orthogonalized", "effective" or "basic". Default is "orthogonalized". "effective" and "orthogonalized" take into account the nuisance estimation. The default is NULL, in this case the value is taken from object.

n_flips

The number of random flips of the score contributions. When n_flips is equal or larger than the maximum number of possible flips (i.e. n^2), all possible flips are performed. Default is 5000.

id

a vector identifying the clustered observations. If NULL (default) observations are assumed to be independent. NOTE: if object is a flipscores and model$flip_param_call$id is not NULL, this is considered in the inference.

...

other parameters allowed in stats::anova.

Examples

set.seed(1)
dt=data.frame(X=scale(rnorm(50)),
   Z=factor(rep(LETTERS[1:3],length.out=50)))
dt$Y=rpois(n=nrow(dt),lambda=exp(dt$X*(dt$Z=="C")))
mod0=flipscores(Y~Z+X,data=dt,family="poisson")
summary(mod0)
anova(mod0)

mod1=flipscores(Y~Z*X,data=dt,family="poisson")
summary(mod1)
anova(mod0,model1 = mod1)


[Package flipscores version 1.2.0 Index]