pois.reg<-function(x,y,n,maxits=20,eps=.0001,scale=1.0,offset=0){ if(is.vector(x)) x<-matrix(x,ncol=1) m<-length(y) r<-ncol(x) # obtain starting values by regressing log(y+.5)-offset on x beta<-lsfit(x,log(y+.5)-offset,intercept=F)$coef # run iteratively reweighted least squares (IRLS) algorithm llvec<-rep(0,maxits) # stores loglikelihoods for all iterations iter<-0 cvgd<-F cat("Running: ") while((iter