Tram vs Brt

Author

Uzoma

Quarto

Quarto enables you to weave together content and executable code into a finished document. To learn more about Quarto see https://quarto.org.

Running Code

When you click the Render button a document will be generated that includes both content and the output of embedded code. You can embed code like this:

1 + 1
[1] 2

You can add options to executable code like this

[1] 4

The echo: false option disables the printing of code (only output is displayed).

# Problem Statement

Swiss transport planners want to determine whether people use the tram more frequently than the Bus Rapid Transit (BRT). Understanding this difference helps guide infrastructure investment and sustainable transport policy decisions.

# Hypotheses

Null Hypothesis (Ho): There is no difference in average daily trips between tram and BRT users.

Alternative Hypothesis (H,): Tram users make more daily trips than BRT users.

# Description of the data

Sample data of daily trips per person:

| Mode | Trip per person |

Tram 1 5, 6, 5, 8, 7, 6, 4 I

BRT \ 1  4, 3, 5, 4, 3, 4, 6 |

Variable: trips (numeric)

Groups: mode (tram, BRT)

Sample size: 7 for each mode

# Justification of the chosen test

Two independent groups (tram vs BRT)

Numeric outcome variable (trips)

Two-sample t-test is appropriate to compare means

Assumptions:

Approximately normally distributed (Shapiro-Wilk test)

Equal variance (var.equal = TRUE)

If assumptions fail + non-parametric alternative: Mann-Whitney U test

# Create sample data

my_tram <- c(5, 6, 5, 8, 7, 6, 4) > 
my_brt <- c(4, 3, 5, 4, 3, 4, 6) > 

# Tram trips from Monday to Friday > 
tram_vector <- c(5, 6, 5, 8, 7, 6, 4) > 

# brt trips from Monday to Friday > 
brt_vector <- c(4, 3, 5, 4, 3, 4, 6) >

# The variable days_vector > 
days_vector <- c("Monday", "Tuesday", "Wednesday", "Thursday", "Friday") > 

# Assign the names of the day to tram_vector and brt_vector > 
names(tram_vector) <- c("Monday", "Tuesday", "Wednesday", "Thursday", "Friday") > 
names(brt_vector) <- c("Monday", "Tuesday", "Wednesday", "Thursday", "Friday")

# Shapiro-wilk normality test

data:  tram W = 0.96664, p-value = 0.8733

data:  brt
W = 0.89358, p-value = 0.2939
Two Sample t-test  

data:  tram and brt 
t = 2.6396, df = 12, p-value = 0.01079 alternative 

hypothesis: true difference in means is greater than 0 95 percent confidence interval:  
0.5568018       Inf 
sample estimates: 
mean of x mean of y   
5.857143  4.142857   

> mean(tram) 
[1] 5.857143 
> mean(brt) [1] 4.142857 
> trips_data <- data.frame( + trips = c(5, 6, 5, 8, 7, 6, 4, 4, 3, 5, 4, 3, 4, 6), +mode = c(rep("tram",7), rep("BRT",7)) + )

# Mean trips with tram  
mean_tram <- mean(tram)  

# Mean trips with brt 
mean_brt <- mean(brt) 

# mean trips overall > trip_week 
mean(tram_vector) + mean(brt_vector) 

# Print out trip_week 
trip_week [1] 10  

# Calculate mean trips for tram and brt > 
mean_tram <- mean(tram_vector) 
mean_brt <- mean(brt_vector) 

# Check if you realized higher mean trips in tram than in brt > mean_tram > mean_brt 
[1] TRUE > 

# Business Conclusion

The results indicate that tram services are used more frequently than BRT in Switzerland. From a practical perspective, this suggests that tram infrastructure may provide greater value to commuters, possibly due to higher reliability, coverage, or convenience.

Transport planners can use this information to:

  • Prioritize maintenance or expansion of tram networks

  • Investigate ways to increase BRT usage (e.g., improve coverage, frequency, or connectivity)

  • Make data-driven decisions for sustainable transport planning and resource allocation

Overall, the evidence supports focusing investment on modes that maximize commuter benefit while identifying opportunities to improve underused services.