Logistic or Poisson regression with a single categorical predictor {Rfast}R Documentation

Logistic or Poisson regression with a single categorical predictor

Description

Logistic or Poisson regression with a single categorical predictor.

Usage

logistic.cat1(y, x, logged = FALSE)
poisson.cat1(y, x, logged = FALSE) 

Arguments

y

A numerical vector with values 0 or 1.

x

A numerical vector with discrete numbers 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. Note: For the "binomial.anova" if this is a numerical vector it must contain strictly positive numbers, i.e. 1, 2, 3, 4, ..., no zeros are allowed.

logged

Should the p-values be returned (FALSE) or their logarithm (TRUE)?

Details

There is a closed form solution for the logistic regression in the case of a single predictor variable. See the references for more information.

Value

info

A matrix similar to the one produced by the glm command. The estimates, their standard error, the Wald value and the relevant p-value.

devs

For the logistic regression case a vector with the null and the residual deviances, their difference and the significance of this difference.

res

For the Poisson regression case a vector with the log likelihood ratio test statistic value and its significance.

Author(s)

Michail Tsagris

R implementation and documentation: Michail Tsagris <mtsagris@uoc.gr> and Manos Papadakis <papadakm95@gmail.com>.

References

Stan Lipovetsky (2015). Analytical closed-form solution for binary logit regression by categorical predictors. Journal of Applied Statistics, 42(1): 37–49.

See Also

poisson.anova, poisson.anovas, anova, logistic_only, poisson_only

Examples

y <- rbinom(20000, 1, 0.6)
x <- as.factor( rbinom(20000, 3, 0.5) )
a1 <- logistic.cat1(y, x)
#a2 <- glm(y ~ x, binomial) 

y <- rpois(20000, 10)
x <- as.factor( rbinom(20000, 3, 0.5) )
a1 <- poisson.cat1(y, x)
#a2 <- glm(y ~ x, poisson) 

x<-y<-a1<-a2<-NULL

[Package Rfast version 2.1.0 Index]