【发布时间】:2016-10-21 05:28:43
【问题描述】:
我有时间序列数据:
library(xts)
library(splines)
set.seed(123)
time <- seq(as.POSIXct("2015-09-01"),as.POSIXct("2015-09-01 23:59:59"),by="hour")
ob <- xts(rnorm(length(time),150,5),time))
对象ob 是每小时时间序列对象。现在,我想对其进行样条回归。我想在早上 7 点和下午 4 点打结。
R 中的以下语句是否确保这一点
ns(ob,knots = c(7,16)) # 7 corresponds to 7 AM and 16 corresponds to 4 PM
另外,我应该如何交叉检查结是否在上述时间放置?
【问题讨论】:
标签: r time-series regression spline cubic-spline