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 computationTue, 12 Nov 2013 08:50:08 -0500
Cite this page as followsStatistical Computations at FreeStatistics.org, Office for Research Development and Education, URL https://freestatistics.org/blog/index.php?v=date/2013/Nov/12/t1384264231mn8rqzxs8jbwlen.htm/, Retrieved Fri, 03 May 2024 00:42:52 +0000
Statistical Computations at FreeStatistics.org, Office for Research Development and Education, URL https://freestatistics.org/blog/index.php?pk=224386, Retrieved Fri, 03 May 2024 00:42:52 +0000
QR Codes:

Original text written by user:
IsPrivate?No (this computation is public)
User-defined keywords
Estimated Impact51
Family? (F = Feedback message, R = changed R code, M = changed R Module, P = changed Parameters, D = changed Data)
-     [Multiple Regression] [HPC Retail Sales] [2008-03-08 13:40:54] [1c0f2c85e8a48e42648374b3bcceca26]
- RMPD    [Structural Time Series Models] [ws8] [2013-11-12 13:50:08] [e931f330ae8eb739e69629b6955c783c] [Current]
Feedback Forum

Post a new message
Dataseries X:
-6
-7
-12
-16
-18
-19
-20
-24
-17
-23
-25
-24
-17




Summary of computational transaction
Raw Inputview raw input (R code)
Raw Outputview raw output of R engine
Computing time5 seconds
R Server'Sir Ronald Aylmer Fisher' @ fisher.wessa.net

\begin{tabular}{lllllllll}
\hline
Summary of computational transaction \tabularnewline
Raw Input & view raw input (R code)  \tabularnewline
Raw Output & view raw output of R engine  \tabularnewline
Computing time & 5 seconds \tabularnewline
R Server & 'Sir Ronald Aylmer Fisher' @ fisher.wessa.net \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=224386&T=0

[TABLE]
[ROW][C]Summary of computational transaction[/C][/ROW]
[ROW][C]Raw Input[/C][C]view raw input (R code) [/C][/ROW]
[ROW][C]Raw Output[/C][C]view raw output of R engine [/C][/ROW]
[ROW][C]Computing time[/C][C]5 seconds[/C][/ROW]
[ROW][C]R Server[/C][C]'Sir Ronald Aylmer Fisher' @ fisher.wessa.net[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=224386&T=0

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=224386&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 Inputview raw input (R code)
Raw Outputview raw output of R engine
Computing time5 seconds
R Server'Sir Ronald Aylmer Fisher' @ fisher.wessa.net







Structural Time Series Model
tObservedLevelSlopeSeasonalStand. Residuals
1-6-6000
2-7-6.72712676993537-0.0491160092148678-0.0491160090712355-0.214659011915856
3-12-10.0843595311879-0.161003634290493-0.161003634290493-1.36739610572552
4-16-13.7547612446368-0.231279395919708-0.231279395919708-1.52311585710764
5-18-16.3520400807266-0.266367915297377-0.266367915297377-1.03740969235259
6-19-17.9406875889735-0.283341617850172-0.283341617850172-0.58138185809199
7-20-19.1570103015591-0.294555486132884-0.294555486132883-0.410580981703586
8-24-22.1105018403239-0.325494197884382-0.325494197884382-1.17050176473885
9-17-18.8345807066714-0.284390207263554-0.2843902072635541.58558857921119
10-23-21.3672749849371-0.309687873974587-0.309687873974586-0.989908450138089
11-25-23.5607364490716-0.330625443314562-0.330625443314562-0.829430943669288
12-24-23.7525813505282-0.329100508534856-0.3291005085348560.0611065130953825
13-17-22.6627956655218-0.4350028161588464.785030975572770.79101842884408

\begin{tabular}{lllllllll}
\hline
Structural Time Series Model \tabularnewline
t & Observed & Level & Slope & Seasonal & Stand. Residuals \tabularnewline
1 & -6 & -6 & 0 & 0 & 0 \tabularnewline
2 & -7 & -6.72712676993537 & -0.0491160092148678 & -0.0491160090712355 & -0.214659011915856 \tabularnewline
3 & -12 & -10.0843595311879 & -0.161003634290493 & -0.161003634290493 & -1.36739610572552 \tabularnewline
4 & -16 & -13.7547612446368 & -0.231279395919708 & -0.231279395919708 & -1.52311585710764 \tabularnewline
5 & -18 & -16.3520400807266 & -0.266367915297377 & -0.266367915297377 & -1.03740969235259 \tabularnewline
6 & -19 & -17.9406875889735 & -0.283341617850172 & -0.283341617850172 & -0.58138185809199 \tabularnewline
7 & -20 & -19.1570103015591 & -0.294555486132884 & -0.294555486132883 & -0.410580981703586 \tabularnewline
8 & -24 & -22.1105018403239 & -0.325494197884382 & -0.325494197884382 & -1.17050176473885 \tabularnewline
9 & -17 & -18.8345807066714 & -0.284390207263554 & -0.284390207263554 & 1.58558857921119 \tabularnewline
10 & -23 & -21.3672749849371 & -0.309687873974587 & -0.309687873974586 & -0.989908450138089 \tabularnewline
11 & -25 & -23.5607364490716 & -0.330625443314562 & -0.330625443314562 & -0.829430943669288 \tabularnewline
12 & -24 & -23.7525813505282 & -0.329100508534856 & -0.329100508534856 & 0.0611065130953825 \tabularnewline
13 & -17 & -22.6627956655218 & -0.435002816158846 & 4.78503097557277 & 0.79101842884408 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=224386&T=1

[TABLE]
[ROW][C]Structural Time Series Model[/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]-6[/C][C]-6[/C][C]0[/C][C]0[/C][C]0[/C][/ROW]
[ROW][C]2[/C][C]-7[/C][C]-6.72712676993537[/C][C]-0.0491160092148678[/C][C]-0.0491160090712355[/C][C]-0.214659011915856[/C][/ROW]
[ROW][C]3[/C][C]-12[/C][C]-10.0843595311879[/C][C]-0.161003634290493[/C][C]-0.161003634290493[/C][C]-1.36739610572552[/C][/ROW]
[ROW][C]4[/C][C]-16[/C][C]-13.7547612446368[/C][C]-0.231279395919708[/C][C]-0.231279395919708[/C][C]-1.52311585710764[/C][/ROW]
[ROW][C]5[/C][C]-18[/C][C]-16.3520400807266[/C][C]-0.266367915297377[/C][C]-0.266367915297377[/C][C]-1.03740969235259[/C][/ROW]
[ROW][C]6[/C][C]-19[/C][C]-17.9406875889735[/C][C]-0.283341617850172[/C][C]-0.283341617850172[/C][C]-0.58138185809199[/C][/ROW]
[ROW][C]7[/C][C]-20[/C][C]-19.1570103015591[/C][C]-0.294555486132884[/C][C]-0.294555486132883[/C][C]-0.410580981703586[/C][/ROW]
[ROW][C]8[/C][C]-24[/C][C]-22.1105018403239[/C][C]-0.325494197884382[/C][C]-0.325494197884382[/C][C]-1.17050176473885[/C][/ROW]
[ROW][C]9[/C][C]-17[/C][C]-18.8345807066714[/C][C]-0.284390207263554[/C][C]-0.284390207263554[/C][C]1.58558857921119[/C][/ROW]
[ROW][C]10[/C][C]-23[/C][C]-21.3672749849371[/C][C]-0.309687873974587[/C][C]-0.309687873974586[/C][C]-0.989908450138089[/C][/ROW]
[ROW][C]11[/C][C]-25[/C][C]-23.5607364490716[/C][C]-0.330625443314562[/C][C]-0.330625443314562[/C][C]-0.829430943669288[/C][/ROW]
[ROW][C]12[/C][C]-24[/C][C]-23.7525813505282[/C][C]-0.329100508534856[/C][C]-0.329100508534856[/C][C]0.0611065130953825[/C][/ROW]
[ROW][C]13[/C][C]-17[/C][C]-22.6627956655218[/C][C]-0.435002816158846[/C][C]4.78503097557277[/C][C]0.79101842884408[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=224386&T=1

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=224386&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
tObservedLevelSlopeSeasonalStand. Residuals
1-6-6000
2-7-6.72712676993537-0.0491160092148678-0.0491160090712355-0.214659011915856
3-12-10.0843595311879-0.161003634290493-0.161003634290493-1.36739610572552
4-16-13.7547612446368-0.231279395919708-0.231279395919708-1.52311585710764
5-18-16.3520400807266-0.266367915297377-0.266367915297377-1.03740969235259
6-19-17.9406875889735-0.283341617850172-0.283341617850172-0.58138185809199
7-20-19.1570103015591-0.294555486132884-0.294555486132883-0.410580981703586
8-24-22.1105018403239-0.325494197884382-0.325494197884382-1.17050176473885
9-17-18.8345807066714-0.284390207263554-0.2843902072635541.58558857921119
10-23-21.3672749849371-0.309687873974587-0.309687873974586-0.989908450138089
11-25-23.5607364490716-0.330625443314562-0.330625443314562-0.829430943669288
12-24-23.7525813505282-0.329100508534856-0.3291005085348560.0611065130953825
13-17-22.6627956655218-0.4350028161588464.785030975572770.79101842884408



Parameters (Session):
par1 = 12 ;
Parameters (R input):
par1 = 12 ;
R code (references can be found in the software module):
par1 <- as.numeric(par1)
nx <- length(x)
x <- ts(x,frequency=par1)
m <- StructTS(x,type='BSM')
m$coef
m$fitted
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
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()
load(file='createtable')
a<-table.start()
a<-table.row.start(a)
a<-table.element(a,'Structural Time Series Model',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')