【发布时间】:2019-10-10 14:02:12
【问题描述】:
在 R 中,使用 HarmonicRegression 库,我试图将谐波回归模型与趋势拟合,但我正在努力弄清楚如何调用harmonic.regression 函数并绘制拟合模型。
library(TSA)
library(HarmonicRegression)
data(tempdub)
har_model <- harmonic.regression(tempdub, time(tempdub), Tau = 24, normalize = TRUE, norm.pol = FALSE, norm.pol.degree = 1, trend.eliminate = FALSE, trend.degree = 1)
plot(ts(fitted(har_model), freq=1, start=c(1964,1)), type='l', ylim=range(c(fitted(har_model), tempdub)))
points(tempdub)
我遇到的第一个错误是:
Error in if (nrow(inputts) != length(inputtime)) stop(paste("Length of time series (inputts):", :
argument is of length zero
知道如何实现吗?
【问题讨论】:
标签: r time-series modeling