Free Statistics

of Irreproducible Research!

Author's title

Author*The author of this computation has been verified*
R Software Modulerwasp_structuraltimeseries.wasp
Title produced by softwareStructural Time Series Models
Date of computationSat, 17 Dec 2016 15:57:34 +0100
Cite this page as followsStatistical Computations at FreeStatistics.org, Office for Research Development and Education, URL https://freestatistics.org/blog/index.php?v=date/2016/Dec/17/t1481986701372df686110jn2g.htm/, Retrieved Fri, 01 Nov 2024 03:36:56 +0000
Statistical Computations at FreeStatistics.org, Office for Research Development and Education, URL https://freestatistics.org/blog/index.php?pk=300837, Retrieved Fri, 01 Nov 2024 03:36:56 +0000
QR Codes:

Original text written by user:
IsPrivate?No (this computation is public)
User-defined keywords
Estimated Impact111
Family? (F = Feedback message, R = changed R code, M = changed R Module, P = changed Parameters, D = changed Data)
-       [Structural Time Series Models] [Structural Time S...] [2016-12-17 14:57:34] [153c3207812fd13fe5ceee3276565119] [Current]
Feedback Forum

Post a new message
Dataseries X:
6932.35	
6910.78	
6869.61	
6877.45	
6887.25	
6893.14	
6920.59	
6881.37	
6951.96	
6883.33	
6904.9	
6834.31	
6847.06	
6874.51	
6874.51	
7031.37	
7031.37




Summary of computational transaction
Raw Input view raw input (R code)
Raw Outputview raw output of R engine
Computing time3 seconds
R ServerBig Analytics Cloud Computing Center

\begin{tabular}{lllllllll}
\hline
Summary of computational transaction \tabularnewline
Raw Input view raw input (R code)  \tabularnewline
Raw Outputview raw output of R engine  \tabularnewline
Computing time3 seconds \tabularnewline
R ServerBig Analytics Cloud Computing Center \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=300837&T=0

[TABLE]
[ROW]
Summary of computational transaction[/C][/ROW] [ROW]Raw Input[/C] view raw input (R code) [/C][/ROW] [ROW]Raw Output[/C]view raw output of R engine [/C][/ROW] [ROW]Computing time[/C]3 seconds[/C][/ROW] [ROW]R Server[/C]Big Analytics Cloud Computing Center[/C][/ROW] [/TABLE] Source: https://freestatistics.org/blog/index.php?pk=300837&T=0

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=300837&T=0

As an alternative you can also use a QR Code:  

The GUIDs for individual cells are displayed in the table below:

Summary of computational transaction
Raw Input view raw input (R code)
Raw Outputview raw output of R engine
Computing time3 seconds
R ServerBig Analytics Cloud Computing Center







Structural Time Series Model -- Interpolation
tObservedLevelSlopeSeasonalStand. Residuals
16932.356932.35000
26910.786918.8617998745-14.1561174300181-8.08179987450186-0.717303528520587
36869.616874.92906971925-33.3247783983701-5.31906971925129-0.796545121457138
46877.456864.30739008153-18.001539428931913.14260991846920.661597690460011
56887.256878.401851171273.548695787674978.848148828729270.865936981497776
66893.146892.9812856680910.82786038874260.1587143319063160.294859604340015
76920.596917.0396104801119.58491674007563.550389519890090.355947231352772
86881.376897.61399590351-6.29327821748193-16.2439959035114-1.05000640530444
96951.966932.119774114420.776019971738519.84022588559891.0982564854987
106883.336905.86243076184-10.4231252715883-22.5324307618421-1.26589752138648
116904.96898.29119550395-8.531756323799746.608804496052840.0767395853245228
126834.316849.69329844624-35.1016747441297-15.383298446239-1.07803374535761
136847.066834.54665030889-21.914135079837512.51334969110670.537090363451122
146874.516854.24621874225.7102936319115920.26378125779631.1391777409422
156874.516882.1271080259320.0234573140771-7.617108025925170.575770245308412
167031.376994.9545903322779.127509779460536.41540966772562.43344830680419
177031.377046.3935667732161.2743376911307-15.0235667732138-0.728802132949225

\begin{tabular}{lllllllll}
\hline
Structural Time Series Model -- Interpolation \tabularnewline
t & Observed & Level & Slope & Seasonal & Stand. Residuals \tabularnewline
1 & 6932.35 & 6932.35 & 0 & 0 & 0 \tabularnewline
2 & 6910.78 & 6918.8617998745 & -14.1561174300181 & -8.08179987450186 & -0.717303528520587 \tabularnewline
3 & 6869.61 & 6874.92906971925 & -33.3247783983701 & -5.31906971925129 & -0.796545121457138 \tabularnewline
4 & 6877.45 & 6864.30739008153 & -18.0015394289319 & 13.1426099184692 & 0.661597690460011 \tabularnewline
5 & 6887.25 & 6878.40185117127 & 3.54869578767497 & 8.84814882872927 & 0.865936981497776 \tabularnewline
6 & 6893.14 & 6892.98128566809 & 10.8278603887426 & 0.158714331906316 & 0.294859604340015 \tabularnewline
7 & 6920.59 & 6917.03961048011 & 19.5849167400756 & 3.55038951989009 & 0.355947231352772 \tabularnewline
8 & 6881.37 & 6897.61399590351 & -6.29327821748193 & -16.2439959035114 & -1.05000640530444 \tabularnewline
9 & 6951.96 & 6932.1197741144 & 20.7760199717385 & 19.8402258855989 & 1.0982564854987 \tabularnewline
10 & 6883.33 & 6905.86243076184 & -10.4231252715883 & -22.5324307618421 & -1.26589752138648 \tabularnewline
11 & 6904.9 & 6898.29119550395 & -8.53175632379974 & 6.60880449605284 & 0.0767395853245228 \tabularnewline
12 & 6834.31 & 6849.69329844624 & -35.1016747441297 & -15.383298446239 & -1.07803374535761 \tabularnewline
13 & 6847.06 & 6834.54665030889 & -21.9141350798375 & 12.5133496911067 & 0.537090363451122 \tabularnewline
14 & 6874.51 & 6854.2462187422 & 5.71029363191159 & 20.2637812577963 & 1.1391777409422 \tabularnewline
15 & 6874.51 & 6882.12710802593 & 20.0234573140771 & -7.61710802592517 & 0.575770245308412 \tabularnewline
16 & 7031.37 & 6994.95459033227 & 79.1275097794605 & 36.4154096677256 & 2.43344830680419 \tabularnewline
17 & 7031.37 & 7046.39356677321 & 61.2743376911307 & -15.0235667732138 & -0.728802132949225 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=300837&T=1

[TABLE]
[ROW][C]Structural Time Series Model -- Interpolation[/C][/ROW]
[ROW][C]t[/C][C]Observed[/C][C]Level[/C][C]Slope[/C][C]Seasonal[/C][C]Stand. Residuals[/C][/ROW]
[ROW][C]1[/C][C]6932.35[/C][C]6932.35[/C][C]0[/C][C]0[/C][C]0[/C][/ROW]
[ROW][C]2[/C][C]6910.78[/C][C]6918.8617998745[/C][C]-14.1561174300181[/C][C]-8.08179987450186[/C][C]-0.717303528520587[/C][/ROW]
[ROW][C]3[/C][C]6869.61[/C][C]6874.92906971925[/C][C]-33.3247783983701[/C][C]-5.31906971925129[/C][C]-0.796545121457138[/C][/ROW]
[ROW][C]4[/C][C]6877.45[/C][C]6864.30739008153[/C][C]-18.0015394289319[/C][C]13.1426099184692[/C][C]0.661597690460011[/C][/ROW]
[ROW][C]5[/C][C]6887.25[/C][C]6878.40185117127[/C][C]3.54869578767497[/C][C]8.84814882872927[/C][C]0.865936981497776[/C][/ROW]
[ROW][C]6[/C][C]6893.14[/C][C]6892.98128566809[/C][C]10.8278603887426[/C][C]0.158714331906316[/C][C]0.294859604340015[/C][/ROW]
[ROW][C]7[/C][C]6920.59[/C][C]6917.03961048011[/C][C]19.5849167400756[/C][C]3.55038951989009[/C][C]0.355947231352772[/C][/ROW]
[ROW][C]8[/C][C]6881.37[/C][C]6897.61399590351[/C][C]-6.29327821748193[/C][C]-16.2439959035114[/C][C]-1.05000640530444[/C][/ROW]
[ROW][C]9[/C][C]6951.96[/C][C]6932.1197741144[/C][C]20.7760199717385[/C][C]19.8402258855989[/C][C]1.0982564854987[/C][/ROW]
[ROW][C]10[/C][C]6883.33[/C][C]6905.86243076184[/C][C]-10.4231252715883[/C][C]-22.5324307618421[/C][C]-1.26589752138648[/C][/ROW]
[ROW][C]11[/C][C]6904.9[/C][C]6898.29119550395[/C][C]-8.53175632379974[/C][C]6.60880449605284[/C][C]0.0767395853245228[/C][/ROW]
[ROW][C]12[/C][C]6834.31[/C][C]6849.69329844624[/C][C]-35.1016747441297[/C][C]-15.383298446239[/C][C]-1.07803374535761[/C][/ROW]
[ROW][C]13[/C][C]6847.06[/C][C]6834.54665030889[/C][C]-21.9141350798375[/C][C]12.5133496911067[/C][C]0.537090363451122[/C][/ROW]
[ROW][C]14[/C][C]6874.51[/C][C]6854.2462187422[/C][C]5.71029363191159[/C][C]20.2637812577963[/C][C]1.1391777409422[/C][/ROW]
[ROW][C]15[/C][C]6874.51[/C][C]6882.12710802593[/C][C]20.0234573140771[/C][C]-7.61710802592517[/C][C]0.575770245308412[/C][/ROW]
[ROW][C]16[/C][C]7031.37[/C][C]6994.95459033227[/C][C]79.1275097794605[/C][C]36.4154096677256[/C][C]2.43344830680419[/C][/ROW]
[ROW][C]17[/C][C]7031.37[/C][C]7046.39356677321[/C][C]61.2743376911307[/C][C]-15.0235667732138[/C][C]-0.728802132949225[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=300837&T=1

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=300837&T=1

As an alternative you can also use a QR Code:  

The GUIDs for individual cells are displayed in the table below:

Structural Time Series Model -- Interpolation
tObservedLevelSlopeSeasonalStand. Residuals
16932.356932.35000
26910.786918.8617998745-14.1561174300181-8.08179987450186-0.717303528520587
36869.616874.92906971925-33.3247783983701-5.31906971925129-0.796545121457138
46877.456864.30739008153-18.001539428931913.14260991846920.661597690460011
56887.256878.401851171273.548695787674978.848148828729270.865936981497776
66893.146892.9812856680910.82786038874260.1587143319063160.294859604340015
76920.596917.0396104801119.58491674007563.550389519890090.355947231352772
86881.376897.61399590351-6.29327821748193-16.2439959035114-1.05000640530444
96951.966932.119774114420.776019971738519.84022588559891.0982564854987
106883.336905.86243076184-10.4231252715883-22.5324307618421-1.26589752138648
116904.96898.29119550395-8.531756323799746.608804496052840.0767395853245228
126834.316849.69329844624-35.1016747441297-15.383298446239-1.07803374535761
136847.066834.54665030889-21.914135079837512.51334969110670.537090363451122
146874.516854.24621874225.7102936319115920.26378125779631.1391777409422
156874.516882.1271080259320.0234573140771-7.617108025925170.575770245308412
167031.376994.9545903322779.127509779460536.41540966772562.43344830680419
177031.377046.3935667732161.2743376911307-15.0235667732138-0.728802132949225







Structural Time Series Model -- Extrapolation
tObservedLevelSeasonal
17116.098104556967085.8839720132930.2141325436726
27183.315527195447120.5832852761262.7322419193261
37183.536520344467155.2825985389428.2539218055209
47288.288513981487189.9819118017798.3066021797103
57248.541313488117224.681225064623.8600884235105
67293.712810039057259.3805383274234.3322717116271
77241.440395755977294.07985159025-52.6394558342812
87267.220764668797328.77916485308-61.5584001842888
97302.411525625357363.4784781159-61.0669524905498
107300.673345542647398.17779137873-97.5044458360861
117447.761759153867432.8771046415614.8846545123009
127447.761759153927467.57641790438-19.8146587504625
137532.489863710887502.2757311672130.2141325436726
147599.707286349367536.9750444300462.7322419193261
157599.928279498387571.6743576928628.2539218055209
167704.68027313547606.3736709556998.3066021797103
177664.933072642037641.0729842185223.8600884235105
187710.104569192977675.7722974813434.332271711627

\begin{tabular}{lllllllll}
\hline
Structural Time Series Model -- Extrapolation \tabularnewline
t & Observed & Level & Seasonal \tabularnewline
1 & 7116.09810455696 & 7085.88397201329 & 30.2141325436726 \tabularnewline
2 & 7183.31552719544 & 7120.58328527612 & 62.7322419193261 \tabularnewline
3 & 7183.53652034446 & 7155.28259853894 & 28.2539218055209 \tabularnewline
4 & 7288.28851398148 & 7189.98191180177 & 98.3066021797103 \tabularnewline
5 & 7248.54131348811 & 7224.6812250646 & 23.8600884235105 \tabularnewline
6 & 7293.71281003905 & 7259.38053832742 & 34.3322717116271 \tabularnewline
7 & 7241.44039575597 & 7294.07985159025 & -52.6394558342812 \tabularnewline
8 & 7267.22076466879 & 7328.77916485308 & -61.5584001842888 \tabularnewline
9 & 7302.41152562535 & 7363.4784781159 & -61.0669524905498 \tabularnewline
10 & 7300.67334554264 & 7398.17779137873 & -97.5044458360861 \tabularnewline
11 & 7447.76175915386 & 7432.87710464156 & 14.8846545123009 \tabularnewline
12 & 7447.76175915392 & 7467.57641790438 & -19.8146587504625 \tabularnewline
13 & 7532.48986371088 & 7502.27573116721 & 30.2141325436726 \tabularnewline
14 & 7599.70728634936 & 7536.97504443004 & 62.7322419193261 \tabularnewline
15 & 7599.92827949838 & 7571.67435769286 & 28.2539218055209 \tabularnewline
16 & 7704.6802731354 & 7606.37367095569 & 98.3066021797103 \tabularnewline
17 & 7664.93307264203 & 7641.07298421852 & 23.8600884235105 \tabularnewline
18 & 7710.10456919297 & 7675.77229748134 & 34.332271711627 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=300837&T=2

[TABLE]
[ROW][C]Structural Time Series Model -- Extrapolation[/C][/ROW]
[ROW][C]t[/C][C]Observed[/C][C]Level[/C][C]Seasonal[/C][/ROW]
[ROW][C]1[/C][C]7116.09810455696[/C][C]7085.88397201329[/C][C]30.2141325436726[/C][/ROW]
[ROW][C]2[/C][C]7183.31552719544[/C][C]7120.58328527612[/C][C]62.7322419193261[/C][/ROW]
[ROW][C]3[/C][C]7183.53652034446[/C][C]7155.28259853894[/C][C]28.2539218055209[/C][/ROW]
[ROW][C]4[/C][C]7288.28851398148[/C][C]7189.98191180177[/C][C]98.3066021797103[/C][/ROW]
[ROW][C]5[/C][C]7248.54131348811[/C][C]7224.6812250646[/C][C]23.8600884235105[/C][/ROW]
[ROW][C]6[/C][C]7293.71281003905[/C][C]7259.38053832742[/C][C]34.3322717116271[/C][/ROW]
[ROW][C]7[/C][C]7241.44039575597[/C][C]7294.07985159025[/C][C]-52.6394558342812[/C][/ROW]
[ROW][C]8[/C][C]7267.22076466879[/C][C]7328.77916485308[/C][C]-61.5584001842888[/C][/ROW]
[ROW][C]9[/C][C]7302.41152562535[/C][C]7363.4784781159[/C][C]-61.0669524905498[/C][/ROW]
[ROW][C]10[/C][C]7300.67334554264[/C][C]7398.17779137873[/C][C]-97.5044458360861[/C][/ROW]
[ROW][C]11[/C][C]7447.76175915386[/C][C]7432.87710464156[/C][C]14.8846545123009[/C][/ROW]
[ROW][C]12[/C][C]7447.76175915392[/C][C]7467.57641790438[/C][C]-19.8146587504625[/C][/ROW]
[ROW][C]13[/C][C]7532.48986371088[/C][C]7502.27573116721[/C][C]30.2141325436726[/C][/ROW]
[ROW][C]14[/C][C]7599.70728634936[/C][C]7536.97504443004[/C][C]62.7322419193261[/C][/ROW]
[ROW][C]15[/C][C]7599.92827949838[/C][C]7571.67435769286[/C][C]28.2539218055209[/C][/ROW]
[ROW][C]16[/C][C]7704.6802731354[/C][C]7606.37367095569[/C][C]98.3066021797103[/C][/ROW]
[ROW][C]17[/C][C]7664.93307264203[/C][C]7641.07298421852[/C][C]23.8600884235105[/C][/ROW]
[ROW][C]18[/C][C]7710.10456919297[/C][C]7675.77229748134[/C][C]34.332271711627[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=300837&T=2

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=300837&T=2

As an alternative you can also use a QR Code:  

The GUIDs for individual cells are displayed in the table below:

Structural Time Series Model -- Extrapolation
tObservedLevelSeasonal
17116.098104556967085.8839720132930.2141325436726
27183.315527195447120.5832852761262.7322419193261
37183.536520344467155.2825985389428.2539218055209
47288.288513981487189.9819118017798.3066021797103
57248.541313488117224.681225064623.8600884235105
67293.712810039057259.3805383274234.3322717116271
77241.440395755977294.07985159025-52.6394558342812
87267.220764668797328.77916485308-61.5584001842888
97302.411525625357363.4784781159-61.0669524905498
107300.673345542647398.17779137873-97.5044458360861
117447.761759153867432.8771046415614.8846545123009
127447.761759153927467.57641790438-19.8146587504625
137532.489863710887502.2757311672130.2141325436726
147599.707286349367536.9750444300462.7322419193261
157599.928279498387571.6743576928628.2539218055209
167704.68027313547606.3736709556998.3066021797103
177664.933072642037641.0729842185223.8600884235105
187710.104569192977675.7722974813434.332271711627



Parameters (Session):
par1 = 12 ; par2 = 18 ; par3 = BFGS ;
Parameters (R input):
par1 = 12 ; par2 = 18 ; par3 = BFGS ;
R code (references can be found in the software module):
par3 <- 'BFGS'
par2 <- '12'
par1 <- '12'
require('stsm')
require('stsm.class')
require('KFKSDS')
par1 <- as.numeric(par1)
par2 <- as.numeric(par2)
nx <- length(x)
x <- ts(x,frequency=par1)
m <- StructTS(x,type='BSM')
print(m$coef)
print(m$fitted)
print(m$resid)
mylevel <- as.numeric(m$fitted[,'level'])
myslope <- as.numeric(m$fitted[,'slope'])
myseas <- as.numeric(m$fitted[,'sea'])
myresid <- as.numeric(m$resid)
myfit <- mylevel+myseas
mm <- stsm.model(model = 'BSM', y = x, transPars = 'StructTS')
fit2 <- stsmFit(mm, stsm.method = 'maxlik.td.optim', method = par3, KF.args = list(P0cov = TRUE))
(fit2.comps <- tsSmooth(fit2, P0cov = FALSE)$states)
m2 <- set.pars(mm, pmax(fit2$par, .Machine$double.eps))
(ss <- char2numeric(m2))
(pred <- predict(ss, x, n.ahead = par2))
mylagmax <- nx/2
bitmap(file='test2.png')
op <- par(mfrow = c(2,2))
acf(as.numeric(x),lag.max = mylagmax,main='Observed')
acf(mylevel,na.action=na.pass,lag.max = mylagmax,main='Level')
acf(myseas,na.action=na.pass,lag.max = mylagmax,main='Seasonal')
acf(myresid,na.action=na.pass,lag.max = mylagmax,main='Standardized Residals')
par(op)
dev.off()
bitmap(file='test3.png')
op <- par(mfrow = c(2,2))
spectrum(as.numeric(x),main='Observed')
spectrum(mylevel,main='Level')
spectrum(myseas,main='Seasonal')
spectrum(myresid,main='Standardized Residals')
par(op)
dev.off()
bitmap(file='test4.png')
op <- par(mfrow = c(2,2))
cpgram(as.numeric(x),main='Observed')
cpgram(mylevel,main='Level')
cpgram(myseas,main='Seasonal')
cpgram(myresid,main='Standardized Residals')
par(op)
dev.off()
bitmap(file='test1.png')
plot(as.numeric(m$resid),main='Standardized Residuals',ylab='Residuals',xlab='time',type='b')
grid()
dev.off()
bitmap(file='test5.png')
op <- par(mfrow = c(2,2))
hist(m$resid,main='Residual Histogram')
plot(density(m$resid),main='Residual Kernel Density')
qqnorm(m$resid,main='Residual Normal QQ Plot')
qqline(m$resid)
plot(m$resid^2, myfit^2,main='Sq.Resid vs. Sq.Fit',xlab='Squared residuals',ylab='Squared Fit')
par(op)
dev.off()
bitmap(file='test6.png')
par(mfrow = c(3,1), mar = c(3,3,3,3))
plot(cbind(x, pred$pred), type = 'n', plot.type = 'single', ylab = '')
lines(x)
polygon(c(time(pred$pred), rev(time(pred$pred))), c(pred$pred + 2 * pred$se, rev(pred$pred)), col = 'gray85', border = NA)
polygon(c(time(pred$pred), rev(time(pred$pred))), c(pred$pred - 2 * pred$se, rev(pred$pred)), col = ' gray85', border = NA)
lines(pred$pred, col = 'blue', lwd = 1.5)
mtext(text = 'forecasts of the observed series', side = 3, adj = 0)
plot(cbind(x, pred$a[,1]), type = 'n', plot.type = 'single', ylab = '')
lines(x)
polygon(c(time(pred$a[,1]), rev(time(pred$a[,1]))), c(pred$a[,1] + 2 * sqrt(pred$P[,1]), rev(pred$a[,1])), col = 'gray85', border = NA)
polygon(c(time(pred$a[,1]), rev(time(pred$a[,1]))), c(pred$a[,1] - 2 * sqrt(pred$P[,1]), rev(pred$a[,1])), col = ' gray85', border = NA)
lines(pred$a[,1], col = 'blue', lwd = 1.5)
mtext(text = 'forecasts of the level component', side = 3, adj = 0)
plot(cbind(fit2.comps[,3], pred$a[,3]), type = 'n', plot.type = 'single', ylab = '')
lines(fit2.comps[,3])
polygon(c(time(pred$a[,3]), rev(time(pred$a[,3]))), c(pred$a[,3] + 2 * sqrt(pred$P[,3]), rev(pred$a[,3])), col = 'gray85', border = NA)
polygon(c(time(pred$a[,3]), rev(time(pred$a[,3]))), c(pred$a[,3] - 2 * sqrt(pred$P[,3]), rev(pred$a[,3])), col = ' gray85', border = NA)
lines(pred$a[,3], col = 'blue', lwd = 1.5)
mtext(text = 'forecasts of the seasonal component', side = 3, adj = 0)
dev.off()
load(file='createtable')
a<-table.start()
a<-table.row.start(a)
a<-table.element(a,'Structural Time Series Model -- Interpolation',6,TRUE)
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,'t',header=TRUE)
a<-table.element(a,'Observed',header=TRUE)
a<-table.element(a,'Level',header=TRUE)
a<-table.element(a,'Slope',header=TRUE)
a<-table.element(a,'Seasonal',header=TRUE)
a<-table.element(a,'Stand. Residuals',header=TRUE)
a<-table.row.end(a)
for (i in 1:nx) {
a<-table.row.start(a)
a<-table.element(a,i,header=TRUE)
a<-table.element(a,x[i])
a<-table.element(a,mylevel[i])
a<-table.element(a,myslope[i])
a<-table.element(a,myseas[i])
a<-table.element(a,myresid[i])
a<-table.row.end(a)
}
a<-table.end(a)
table.save(a,file='mytable.tab')
a<-table.start()
a<-table.row.start(a)
a<-table.element(a,'Structural Time Series Model -- Extrapolation',4,TRUE)
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,'t',header=TRUE)
a<-table.element(a,'Observed',header=TRUE)
a<-table.element(a,'Level',header=TRUE)
a<-table.element(a,'Seasonal',header=TRUE)
a<-table.row.end(a)
for (i in 1:par2) {
a<-table.row.start(a)
a<-table.element(a,i,header=TRUE)
a<-table.element(a,pred$pred[i])
a<-table.element(a,pred$a[i,1])
a<-table.element(a,pred$a[i,3])
a<-table.row.end(a)
}
a<-table.end(a)
table.save(a,file='mytable1.tab')