RenewGLM.outloop | R Documentation |
Take in data batches sequentially and update the regression coefficients and their standard errors
RenewGLM_out(X, y, type, betahat, infomats, intercept, s, phi)
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 |
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 |
updated coefficient estimates and the cumulative information matrix
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.