R 中的 T 测试无法 运行 在一起

T tests in R- unable to run together

我有一家航空公司 dataset 来自我正在尝试分析的统计计算。

有变量 DepTime 和 ArrDelay(出发时间和到达延迟)。我正在尝试分析到达延迟如何随出发时间的某些部分而变化。我的 objective 是找出一个人在订票时应该避开哪些时间段以避免到达延误

我的理解-如果出发时间>1800的到达延误和出发时间>1900的到达延误之间的单尾t检验显示出很高的显着性,这意味着应该避免1800到1900之间的航班。(请更正如果我错了我)。我想 运行 所有出发时间都进行此类测试。

** 对编程和数据科学完全陌生。任何帮助将不胜感激。

数据看起来像这样。突出显示的列是我正在分析的列

共享数据图像与提供数据供我们使用不同...

也就是说我去抓取了一年的数据并进行了处理。

flights <- read.csv("~/Downloads/1995.csv", header=T)

flights <- flights[, c("DepTime", "ArrDelay")]
flights$Dep <- round(flights$DepTime-30, digits = -2)
head(flights, n=25)

# This tests each hour of departures against the entire day. 
# Alternative is set to "less" because we want to know if a given hour
# has less delay than the day as a whole.

pVsDay <- tapply(flights$ArrDelay, flights$Dep, 
                 function(x) t.test(x, flights$ArrDelay, alternative = "less"))

# This tests each hour of departures against every other hour of the day. 
# Alternative is set to "less" because we want to know if a given hour
# has less delay than the other hours.
pAllvsAll <- tapply(flights$ArrDelay, flights$Dep, 
                           function(x) tapply(flights$ArrDelay, flights$Dep, function (z) 
                             t.test(x, z, alternative = "less")))

我会让你想出多重假设检验之类的。

全部对全部