Analysis of variance with a count variable
Analysis of variance with a count variable.
poisson.anova(y, ina, logged = FALSE) geom.anova(y, ina, type = 1, logged = FALSE) quasipoisson.anova(y, ina, logged = FALSE)
y |
A numerical vector with discrete valued data, i.e. counts. |
ina |
A numerical vector with discrete numbers starting from 1, i.e. 1, 2, 3, 4,... or a factor variable. This is suppose to be a categorical predictor. If you supply a continuous valued vector the function will obviously provide wrong results. |
type |
This argument is for the geometric distribution. Type 1 refers to the case where the minimum is zero and type 2 for the case of the minimum being 1. |
logged |
Should the p-values be returned (FALSE) or their logarithm (TRUE)? |
This is the analysis of variance with Poisson or geometric distributed data. What we do is a log-likelihood ratio
test. However, this is exactly the same as Poisson regression with a single predictor variable who happens to be
categorical. Needless to say that this is faster function than the glm command in R. For the same purpose with
a Bernoulli variable use g2Test
. The quasinpoisson.anova is when in the glm function you specify
family = quasipoisson. This is suitable for the case of over or under-dispersed data.
A vector with two values, the difference in the deviances (or the scale difference in the case of quasi poisson) and the relevant p-value. The quasipoisson.anova also returns the estimate of the φ parameter.
Michail Tsagris
R implementation and documentation: Michail Tsagris <mtsagris@yahoo.gr> and Manos Papadakis <papadakm95@gmail.com>.
y <- rpois(300, 10) ina <- rbinom(300, 3, 0.5) + 1 a1 <- poisson.anova(y, ina) a2 <- glm(y ~ ina, poisson) ## Not run: res<-anova(a2, test = "Chisq") ## End(Not run) y <- rgeom(300, 0.7) res<-geom.anova(y, ina)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.