RenewGLM-package | R Documentation |
This package updates the regression coefficients and their standard errors in generalized linear models as data batches arrive sequentially.
This package aims to update the regression coefficients as data batches arrive sequentially. There are two main functions in package. RenewGLM.inloop
is used to processing a sequence of datasets that are stored in a given directory, and the major input is the name of the directory. RenewGLM.outloop
is applied in the case where data batches are imported externally, and the form of the input is X
and y
of the current data batch.
Lan Luo and Peter X.-K. Song
Maintainer: Lan Luo <luolsph@umich.edu>
#Processing data batches internally
N=1000
B=10
p=5
n=N/B
beta<-c(0.2,-0.2,0.2,-0.2,0.2)
tempdatadir<-"~/Desktop/tempdata"
datagenerator_in(beta=beta,n=n, p=p, B=B, family="binomial", construct="cs",
rho=0.5, tempdatadir=tempdatadir)
RenewGLM_in(B, tempdatadir=tempdatadir, "binomial", p=p, intercept=TRUE)
unlink(tempdatadir)
#Processing data batches externally
N=1000
B=10
p=5
n=N/B
beta<-c(0.2,-0.2,0.2,-0.2,0.2)
infomats<-diag(0,p,p);
betahat<-rep(0,p)
for(b in 1:10){
data<-datagenerator_out(beta,b,n,"binomial","cs",0.5)
y<-data[,1]
X<-data[,-1]
summary<-RenewGLM_out(X,y,"binomial",betahat,infomats,intercept=TRUE,s,phi)
betahat<-summary[[1]]
infomats<-summary[[2]]
rm(data)
}
sd<-sqrt(diag(solve(infomats)));
pvalue<-2*pnorm(-abs(betahat)/sd)
result<-cbind(betahat=betahat,sd=sd,pvalue=pvalue)
colnames(result)<-c("Estimates","Std.Errors","p-values")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.