1

数据文件(下面代码线程中的 X)包含二十年期间每月数据 X[t] 的记录。

数据可以建模为 X[12j+i] = Mu + s[i] + Y[12j+i] 其中 (i=1,...,12; j=1,...,k) 其中 Mu , s[1],...,s[12] 是模型的参数,Z[t] 是白噪声 WN(0,sigma^2),k=20。给定 Mu 和 Mu+s[i] 的最小二乘估计量分别是第 i 个周期内记录的所有观测值的总体平均值和平均值。获得该模型与数据的最小二乘拟合。

X <- c(20.73,20.51,21.04,21.34,21.60,21.67,21.93,22.18,21.55,21.38,20.78,20.75,20.57,20.09,20.61,21.33,21.72,21.83,21.70,22.62,21.40,21.53,20.71,20.82,20.73,20.65,20.67,21.40,21.21,21.63,21.77,22.20,21.29,21.44,21.01,20.75,20.64,20.24,21.03,21.61,21.46,21.61,22.08,22.66,21.21,20.95,20.88,20.37,20.53,20.30,21.26,21.14,21.99,21.88,22.46,22.31,21.65,21.60,20.62,20.71,20.64,20.94,20.89,21.19,21.57,21.91,21.71,21.95,21.52,21.06,20.77,20.50,20.67,20.77,21.06,21.70,20.73,21.83,21.71,22.99,21.81,20.97,20.72,20.43,20.49,20.33,20.95,21.34,21.61,21.88,22.28,22.33,21.16,21.00,21.07,20.59,20.87,20.59,21.06,21.23,21.59,21.80,21.76,22.48,21.91,20.96,20.83,20.86,20.36,20.48,20.89,21.35,21.80,21.87,22.13,22.54,21.91,21.33,21.18,20.67,20.98,20.77,21.22,21.09,21.37,21.71,22.45,22.25,21.70,21.67,20.59,21.12,20.35,20.86,20.87,21.29,21.96,21.85,21.90,22.10,21.64,21.56,20.46,20.43,20.87,20.38,21.05,20.78,21.99,21.59,22.29,22.23,21.70,21.12,20.69,20.47,20.42,20.51,21.10,21.39,21.98,21.86,22.40,22.04,21.69,21.32,20.74,20.51,20.21,20.29,20.64,21.29,22.03,21.90,22.22,22.07,21.95,21.57,21.01,20.27,20.97,20.64,20.95,21.19,22.02,21.73,22.35,22.45,21.50,21.15,21.04,20.28,20.27,20.48,20.83,21.78,22.11,22.31,21.80,22.52,21.41,21.13,20.61,20.81,20.82,20.42,21.20,21.19,21.39,22.33,21.91,22.36,21.53,21.53,21.12,20.37,21.01,20.23,20.71,21.17,21.63,21.89,22.34,22.23,21.45,21.32,21.05,20.90,20.80,20.69,20.49,21.28,21.68,21.98,21.67,22.63,21.77,21.36,20.61,20.83)

我找到了 Mu 和 (Mu+s[i]) 的最小二乘估计量

lse.Mu <- mean(X)
IndicatorVar <- rep(1:12,20)
lse.Mu.si <- c(1:12)
for(i in 1:12){lse.Mu.si[i] <- mean(X[IndicatorVar==i])

这就是我感到困惑的地方。我不确定接下来要做什么来找到模型的最小二乘拟合。我试图找到 Y 的估计量:

est.Y <- c(1:240)
for(i in 1:12){for(j in 0:19){est.Y[(12*j)+i] <- X[(12*j)+i] - lse.Mu.si[i]}}

但我仍然不知道如何使用它来找到最小二乘拟合或 Z[t] 白噪声进入其中的位置。

你能帮我指出正确的方向或让我知道使用什么代码吗?我在谷歌上花了三天,我仍然无法解决!

在此之后,我需要通过将数据与模型进行图形比较来检查模型的有效性,并使用任何被认为合适的统计测试。任何关于最好使用哪些图表和统计测试的建议将不胜感激。

4

0 回答 0