Learn R Programming

fastR (version 1.1)

Many univariate simple binary logistic regressions: Many univariate simple binary logistic regressions

Description

It performs very many univariate simple binary logistic regressions.

Usage

logistic_only(x, y)

Arguments

x
A matrix with the data, where the rows denote the samples (and the two groups) and the columns are the variables. Currently only continuous variables are allowed.
y
The dependent variable; a numerical vector with two values (0 and 1).

Value

A vector with the deviance of each simple binayr logistic regression model for each predictor variable.

Details

The function is written in C++ and this is why it is very fast. It can accept thousands of predictor variables. It is usefull for univariate screening. We provide no p-value correction (such as fdr or q-values); this is up to the user.

References

McCullagh, Peter, and John A. Nelder. Generalized linear models. CRC press, USA, 2nd edition, 1989.

See Also

allbetas, correls

Examples

Run this code
## 500 variables, hence 500 univariate regressions are to be fitted
x = matrix( rnorm(100 * 500), ncol = 500 )

## 100 observations in total
y = rbinom(100, 1, 0.6)   ## binary logistic regression
system.time( logistic_only(x, y) )

a1 = logistic_only(x, y)
 
a2 <- numeric(500)
system.time( for (i in 1:500) a2[i] = glm(y ~ x[, i], binomial)$deviance )

Run the code above in your browser using DataLab