RenewGLM.outloop: Renewable GLM function processing data batches externally

RenewGLM.outloopR Documentation

Renewable GLM function processing data batches externally

Description

Take in data batches sequentially and update the regression coefficients and their standard errors

Usage

RenewGLM_out(X, y, type, betahat, infomats, intercept, s, phi)

Arguments

X

covariate matrix for the current data batch

y

response vector for the current data batch

type

the GLM family you want to fit your data to c("gaussian","binomial","poisson")

betahat

the old estimates that need to be updated

infomats

the old cumulative information matrix that need to be updated

intercept

if an intercept is included in the model

s

the cumulative sample size (only needs to be specified in Gaussian model, does not include the samples in the current data batch)

phi

the old estimate of the dispersion parameter in Gaussian model

Value

updated coefficient estimates and the cumulative information matrix

Examples

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")

luolsph/RenewGLM_pkg documentation built on April 17, 2023, 12:36 a.m.