# returns expanded summary of logistic regression model
# output includes coefficient values with stardard errors
# odds ratios with 95% confidence intervals
# Wald test p-values for each coefficient
# likelihood-based r-square measure
# likelihood ratio test for all coefficients combined
 
glm.sum<-function(obj)
{
resid<-obj$residuals
cla<-class(obj)[1]
rank<-obj$rank
obj<-summary(obj)
coeff<-obj$coefficients
beta<-coeff[,"Value"]
se<-coeff[,"Std. Error"]
pval<-2*(1-pt(abs(coeff[,"t value"]),(obj$df)[2]))
or<-exp(beta)
lcl<-exp(beta-1.96*se)
ucl<-exp(beta+1.96*se)
n<-length(resid)
dev<-obj$deviance
null.dev<-obj$null.deviance
dif<-null.dev-dev
r.sq<-1-exp((dev-null.dev)/n)
lrtest<-1-pchisq(dif,rank-1)
newstuff<-round(cbind(beta,se,or,lcl,ucl,pval),4)
dimnames(newstuff)<-list(dimnames(coeff)[[1]],c('value','stderr','or','lcl',  'ucl', 'p-value'))
list(funtion.call=obj$call,estimated.results=newstuff,data.size=n,
r.sq=r.sq,lrtest.pval=lrtest)
}