# package for big n methods library(datadr) # divide the data into separate chunks to be processed rrSA<- divide(SAheart, by = rrDiv(100), update = TRUE) # BLB method ###### Here you choose your own statistics of interest ###### I am asking for the L and U limits of a 95% CI for each regression coefficient here ###### but you could ask for the estimates also SABlb <- rrSA %>% addTransform(function(x) { drBLB(x, statistic = function(x, weights) coef(lm(ldl ~ ., data = x, weights = weights)), metric = function(x) quantile(x, c(0.05, 0.95)), R = 100, n = nrow(rrSA) ) }) ###### coefs <- recombine(SABlb, combMean) # compare BLB and full data results matrix(coefs, ncol = 2, byrow = TRUE) confint(lm(ldl~.,data=SAheart)) ######################################################################3 ### Leveraging library(rsvd) # random SVD for fast computation data(spam) ss<-rsvd(as.matrix(spam[,-58])) lev<-apply(ss$u^2,1,sum) # the leverage values # sampling 500 observations with different probabilities given by leverage probs<-lev*500/sum(lev) probs[probs>1]<-1 pp<-rbinom(4601,prob=probs,size=1) # Leverage results mm<-glm(as.factor(chd)~., data=SAheart,subset=seq(1,4601)[pp==1],family=binomial) coef(mm)