knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
library(mets)

Utility functions for GLM objects

Getting the OR with confidence intervals using the GEE (sandwhich) standard errors

set.seed(100)

library(mets)
data(bmt); 
bmt$id <- sample(1:100,408,replace=TRUE)

glm1 <- glm(tcell~platelet+age,bmt,family=binomial)
summaryGLM(glm1)

## GEE robust standard errors
summaryGLM(glm1,id=bmt$id)

Predictions also simple

age <- seq(-2,2,by=0.1)
nd <- data.frame(platelet=0,age=seq(-2,2,by=0.1))
pnd <- predictGLM(glm1,nd)
head(pnd$pred)
plot(age,pnd$pred[,1],type="l",ylab="predictions",xlab="age",ylim=c(0,0.3))
matlines(age,pnd$pred[,-1],col=2)

SessionInfo

sessionInfo()


kkholst/mets documentation built on May 4, 2024, 1:26 p.m.