I am trying to use speedglm
to achieve a faster GLM estimation than glm
, but why it is even slower?
set.seed(0)
n=1e3
p=1e3
x=matrix(runif(n*p),nrow=n)
y=sample(0:1,n,replace = T)
ptm <- proc.time()
fit=glm(y~x,family=binomial())
print(proc.time() - ptm)
# user system elapsed
# 10.71 0.07 10.78
library(speedglm)
ptm <- proc.time()
fit=speedglm(y~x,family=binomial())
print(proc.time() - ptm)
# user system elapsed
# 15.11 0.12 15.25
glm.fit()
directly ... – Depolarize