## 500 variables, hence 500 univariate regressions are to be fitted
x = matrix( rnorm(100 * 500), ncol = 500 )
y = rpois(100, 10)
system.time( poisson_only(x, y) )
b1 = poisson_only(x, y)
b1 = as.vector(b1)
b2 = numeric(500)
system.time( for (i in 1:500) b2[i] = glm(y ~ x[, i], poisson)$deviance )
b2 = as.vector(glm(y ~ 1, poisson)$null.dev) - as.vector(b2)
Run the code above in your browser using DataLab