The Data

The data analyzed in this page originated from some big hospital somewhere in the US. It has some strange discrepancies, so those are filtered out.

Medicare Patient Completion Times

Any patient 65 years or older qualifies for Medicare. The table below represents the completion times of X-ray orders for Medicare patients.

The shape of this histogram represents an exponential distribution. The majority of patients experience relatively long completion times while some experience long completion times.

Comparison of Technicians 62 and 65

Below is a comparison drawn between Radiology Technicians 62 and 65.

## Radiology Technician 62's median completion time: 80
## Radiology Technician 65's median completion time: 27

Radiology technician 62’s median completion time is nearly 300% more than technician 65. The only conclusion we can draw from this is that technician 62 is very lazy.

STAT vs Routine X-Ray Order Times

The boxplots below represent the completion times for the two priority levels of patients.

STAT orders generally take less time to complete than Routine orders, which is exactly the point of having a higher priority order. The deviation of STAT orders is also smaller, which suggests that Routine orders are typically more relaxed on their time frames for completion.

Comparison of Completion Times Between Floors 3W and 4W

Below is the unfiltered means and standard deviations for the 3W and 4W floors.

## Floor 3W Mean Completion Time: 1463.05147058824
## Floor 4W Mean Completion Time: 1675.4505988024
## 
## Floor 3W Standard Deviation of Completion Times: 3894.63942797006
## Floor 4W Standard Deviation of Completion Times: 4387.6443645218

These results are likely skewed significantly by outliers/long tails. So here are the results with the upper 10% trimmed off:

F3W <- F3W[F3W < quantile(F3W, 0.9)]
F4W <- F4W[F4W < quantile(F4W, 0.9)]

cat(paste0("Trimmed Times:\n", "Floor 3W Mean Completion Time: ", mean(F3W), "\nFloor 4W Mean Completion Time: ", mean(F4W), "\n\nFloor 3W Standard Deviation of Completion Times: ", sd(F3W), "\nFloor 4W Standard Deviation of Completion Times: ", sd(F4W)))
## Trimmed Times:
## Floor 3W Mean Completion Time: 358.601635514019
## Floor 4W Mean Completion Time: 436.292845257903
## 
## Floor 3W Standard Deviation of Completion Times: 845.357658594686
## Floor 4W Standard Deviation of Completion Times: 1050.40689295405

Floor 3W consistently completes orders significantly faster than Floor 4W. In other words, in the case of an emergency, go to floor 3W.

Code Summary

# Load in the data
link <- "https://raw.githubusercontent.com/tmatis12/datafiles/refs/heads/main/RadDat_IMSE.csv"
dat <- read.csv(link)

# Filter out bad data
dat <- dat[dat$Ordered.to.Complete...Mins > 0, ]




# Instruction 1

# Generate historgram on completion time for patients with age >= 65
# Restrict range to IQR

#hist(dat$PatientAge[dat$PatientAge >= 65])

#?quantile
#some <- c(1, 2, 3, 4)
#quantile(0.25, some)
#summary(some)[2]
#summary(some)[5]

#hist(dat$PatientAge[dat$PatientAge >= 65], xlim=c(summary(dat$PatientAge)[2]))
#?hist

#?seq
#hist(dat$PatientAge[dat$PatientAge >= 65], breaks = seq(summary(dat$PatientAge)[2], summary(dat$PatientAge)[5], 5))

#quantile(dat$Ordered.to.Complete...Mins[dat$PatientAge >= 65], 0.25)

MCQ1 <- quantile(dat$Ordered.to.Complete...Mins[dat$PatientAge >= 65], 0.25)
MCQ3 <- quantile(dat$Ordered.to.Complete...Mins[dat$PatientAge >= 65], 0.75)
# Why are they "Named num"s? That's silly

MOCT <- dat$Ordered.to.Complete...Mins[dat$PatientAge >= 65]

hist(MOCT[MOCT >= MCQ1 & MOCT <= MCQ3], xlim = c(MCQ1, MCQ3), main="Medicare Patients Order Time", xlab="Time to Completion", ylab="Number of Patients")




# Instruction 2

# Compare the performance of Radiology Technician 62 to 65 based on median times

RT62 <- dat[dat$Radiology.Technician == 62, ]
RT62MedTime <- as.numeric(quantile(RT62$Ordered.to.Complete...Mins, 0.50))


RT65 <- dat[dat$Radiology.Technician == 65, ]
RT65MedTime <- as.numeric(quantile(RT65$Ordered.to.Complete...Mins, 0.5))


cat(paste0("Radiology Technician 62's median completion time: ", RT62MedTime, "\nRadiology Technician 65's median completion time: ", RT65MedTime))




# Instruction 3

#?boxplot


STATOrders <- dat$Ordered.to.Complete...Mins[dat$Priority == "STAT"]
RoutineOrders <- dat$Ordered.to.Complete...Mins[dat$Priority == "Routine"]

# Trim the data cause there are some crazy outliers
STATOrders <- STATOrders[STATOrders < 200]
RoutineOrders <- RoutineOrders[RoutineOrders < 200]

#boxplot(STATOrders)
#boxplot(RoutineOrders)

boxplot(STATOrders, RoutineOrders, names=c("STAT", "Routine"), main="Times for STAT vs Routine Orders", ylab="Completion Time")




# Instruction 4

F3W <- dat$Ordered.to.Complete...Mins[dat$Loc.At.Exam.Complete == "3W"]
F4W <- dat$Ordered.to.Complete...Mins[dat$Loc.At.Exam.Complete == "4W"]

#mean(F3W)
#mean(F4W)
#sd(F3W)
#sd(F4W)

cat(paste0("Floor 3W Mean Completion Time: ", mean(F3W), "\nFloor 4W Mean Completion Time: ", mean(F4W), "\n\nFloor 3W Standard Deviation of Completion Times: ", sd(F3W), "\nFloor 4W Standard Deviation of Completion Times: ", sd(F4W)))

F3W <- F3W[F3W < quantile(F3W, 0.9)]
F4W <- F4W[F4W < quantile(F4W, 0.9)]

cat(paste0("Trimmed Times:\n", "Floor 3W Mean Completion Time: ", mean(F3W), "\nFloor 4W Mean Completion Time: ", mean(F4W), "\n\nFloor 3W Standard Deviation of Completion Times: ", sd(F3W), "\nFloor 4W Standard Deviation of Completion Times: ", sd(F4W)))