# Read in data set
data(psa)
attach(psa)
# Perform t-test
ttest(pretxpsa, null.hypoth = 100, alternative = "greater", more.digits = 1)
# Define new binary variable as indicator
# of whether or not bss was worst possible
bssworst <- bss
bssworst[bss == 1] <- 0
bssworst[bss == 2] <- 0
bssworst[bss == 3] <- 1
# Perform t-test allowing for unequal
# variances between strata -#
ttest(pretxpsa, by = bssworst)
# Perform matched t-test
ttest(pretxpsa, nadirpsa, matched = TRUE, conf.level = 99/100, more.digits = 1)
Run the code above in your browser using DataLab