Table of Contents

R

Sample

list.files()
setwd('project')
library(survival)
df <- read.csv('sample.csv', header=TRUE)
data <- df[, c(1, 2, 3, 4, 5)]
model <- glm(data$OBJ ~ ., data=data, family=binomial(link='logit'))
model <- coxph(Surv(data$DUR, data$EVT) ~ ., data=data, method='breslow')
summary <- summary(model)
coef <- summary$coefficient

Statistics

aic <- AIC(model)
bic <- BIC(model)

Concordance

library(survival)
conc <- concordance(model)

Odds Ratio

odds <- exp(coef[, 1])
odds.low <- exp(coef[, 1] - 1.96 * coef[, 2])
odds.hi <- exp(coef[, 1] + 1.96 * coef[, 2])

Type-III Test

require(car)
ttt <- Anova(model, type='III')

Likelihood-Ratio Test

lrt <- anova(model, test='LRT')
sum(lrt$Deviance, na.rm=TRUE)

Score Test

rao <- anova(model, test='Rao')
sum(rao$Rao, na.rm=TRUE)

Wald Test

library(aod)
wt <- wald.test(Sigma=vcov(model), b=coef(model), Terms=2:5)