我的数据类似于下面的示例数据。我试图使用带有xreg预测变量的arima来预测TiTa,并且我正在寻找一种识别滞后预测变量的好方法。有没有人知道找到滞后预测变量的好方法,包或函数?我想的可能是类似于重复滞后DateTime变量并寻找TiTa与数据中所有其他字段之间的相关性,除非所有其他字段滞后。例如,从DateTime中减去30分钟寻找与Tita的相关性,从DateTime中减去一小时寻找与Tita的相关性...我想知道某人是否已经想出了更好的方法此
示例数据:
dput(droplevels(dataset[1:5,]))
structure(list(DateTime = structure(1:5, .Label = c("2013-01-01 00:00:00",
"2013-01-01 02:00:00", "2013-01-01 03:00:00", "2013-01-01 04:00:00",
"2013-01-01 05:00:00"), class = "factor"), CustCount = c(3,
1, 4, 1, 3), TiTa = structure(c(2L, 1L, 3L, 4L,
2L), .Label = c("11", "2", "3", "39"), class = "factor"), IIP = c(26,
153, 134.5, 195, 120), ToTa = structure(c(3L, 1L, 2L, 1L, 1L), .Label = c("",
"493", "565"), class = "factor"), RtD = structure(c(2L,
4L, 3L, 1L, 5L), .Label = c("", "16.5", "42.5", "43", "62.5"), class = "factor"),
ItD = structure(c(1L, 4L, 2L, 5L, 3L), .Label = c("111",
"210", "250", "253", "356"), class = "factor"), ToTd = structure(c(1L,
3L, 2L, 5L, 4L), .Label = c("205", "255", "296", "343", "375"
), class = "factor"), TTR = c(41, 99, 89, 169, 124.5
), Dd = structure(c(3L, 4L, 2L, 1L, 5L), .Label = c("19",
"22", "29", "43", "93"), class = "factor"), Da = structure(c(3L,
1L, 2L, 1L, 1L), .Label = c("", "409", "544"), class = "factor")), .Names = c("DateTime",
"CustCount", "TiTa", "IIP",
"TATA", "RtD", "ItD", "TATD", "TTR",
"Dd", "Da"), na.action = structure(c(2L, 12L, 28L, 31L,
32L, 53L, 54L, 70L, 72L, 74L, 75L, 76L, 77L, 78L, 88L, 101L
), class = "omit"), row.names = c(1L, 3L, 4L, 5L, 6L), class = "data.frame")