data(lsq)
X <- model.matrix(lsq) #extract the design matrix
y <- model.response(lsq) # extract the rhs
X1 <- as.matrix(X)
slm.time <- unix.time(slm(y~X1-1) -> slm.o) # pretty fast
lm.time <- unix.time(lm(y~X1-1) -> lm.o) # very slow
cat("slm time =",slm.time,"")
cat("slm Results: Reported Coefficients Truncated to 5 ","")
sum.slm <- summary(slm.o)
sum.slm$coef <- sum.slm$coef[1:5,]
sum.slm
cat("lm time =",lm.time,"")
cat("lm Results: Reported Coefficients Truncated to 5 ","")
sum.lm <- summary(lm.o)
sum.lm$coef <- sum.lm$coef[1:5,]
sum.lmRun the code above in your browser using DataLab