文档库 最新最全的文档下载
当前位置:文档库 › x12 R语言 季节调整

x12 R语言 季节调整

x12 R语言 季节调整
x12 R语言 季节调整

Package‘x12’

February15,2013

Version1.0-3

Date2012-06-26

Title X12-wrapper function and structure for batch processing

Author Alexander Kowarik,Angelika Meraner Maintainer Alexander Kowarik

Depends R(>=2.14.0),methods,stats,utils,grDevices,stringr

Description A wrapper function and GUI for the X12binaries

License GPL(>=2)

URL https://www.wendangku.net/doc/428649897.html,

Repository CRAN

Date/Publication2012-06-2609:30:52

NeedsCompilation no

R topics documented:

AirPassengersX12 (2)

AirPassengersX12Batch (2)

crossVal (3)

crossValidation-class (5)

diagnostics-class (5)

fbcast-class (6)

getP-methods (7)

loadP (8)

plot-methods (10)

plot.x12 (13)

plotRsdAcf (14)

plotSeasFac (16)

plotSpec (18)

1

2AirPassengersX12Batch prev-methods (20)

print.x12 (21)

read.spc (22)

spectrum-class (23)

summary-methods (23)

summary.x12 (25)

times (27)

X12 (28)

x12 (29)

x12BaseInfo-class (34)

x12Batch-class (35)

x12List-class (36)

x12Output-class (37)

x12Parameter-class (39)

x12Single-class (42)

Index44 AirPassengersX12x12Single object

Description

x12Single object with the AirPassengers time series

Usage

data(AirPassengersX12)

Examples

data(AirPassengersX12)

summary(AirPassengersX12)

summary(AirPassengersX12,oldOutput=10)

AirPassengersX12Batch x12Batch object

Description

x12Batch object of four AirPassengers series with paramters and output objects

Usage

data(AirPassengersX12Batch)

crossVal3

Examples

data(AirPassengersX12Batch)

summary(AirPassengersX12Batch)

crossVal~~Methods for Function crossVal in Package x12~~

Description

Cross Validation with function crossVal in package x12.

Usage

##S4method for signature’ts’

crossVal(object,x12Parameter,x12BaseInfo,

showCI=FALSE,main="Cross Validation",

col_original="black",col_fc="#2020ff",col_bc="#2020ff",

col_ci="#d1d1ff",col_cishade="#d1d1ff",

lty_original=1,lty_fc=1,lty_bc=1,lty_ci=1,

lwd_original=1,lwd_fc=1,lwd_bc=1,lwd_ci=1,ytop=1,

points_bc=FALSE,points_fc=FALSE,points_original=FALSE,

showLine=TRUE,col_line="grey",lty_line=3,

ylab="Value",xlab="Date")

##S4method for signature’x12Single’

crossVal(object,x12BaseInfo=new("x12BaseInfo"),

showCI=FALSE,main="Cross Validation",

col_original="black",col_fc="#2020ff",col_bc="#2020ff",

col_ci="#d1d1ff",col_cishade="#d1d1ff",

lty_original=1,lty_fc=1,lty_bc=1,lty_ci=1,

lwd_original=1,lwd_fc=1,lwd_bc=1,lwd_ci=1,ytop=1,

points_bc=FALSE,points_fc=FALSE,points_original=FALSE,

showLine=TRUE,col_line="grey",lty_line=3,

ylab="Value",xlab="Date")

Arguments

object object of class ts or x12Single-class.

x12Parameter object of class x12Parameter.

x12BaseInfo object of class x12BaseInfo.

showCI logical specifying if the prediction interval should be plotted.

main plot title.

col_original color of the original time series.

col_fc color of the forecasts.

col_bc color of the backcasts.

4crossVal

col_ci color of the prediction interval.

col_cishade color of the shading of the prediction interval.

lty_original line type of the original time series.

lty_fc line type of the forecasts.

lty_bc line type of the backcasts.

lty_ci line type of the prediction interval.

lwd_original line width of the original time series.

lwd_fc line width of the forecasts.

lwd_bc line width of the backcasts.

lwd_ci line width of the prediction interval.

ytop multiplication factor for ylim.

points_bc logical specifying if backcasts should additionally be indicated with points.

points_fc logical specifying if forecasts should additionally be indicated with points.

points_original

logical specifying if the original time series should additionally be indicated

with points.

showLine logical indicating if a boundary line should be drawn before/after fore-/backcasts.

col_line color of showLine.

lty_line line type of showLine.

ylab label of y-axis.

xlab label of x-axis.

Value

An S4object of class crossValidation-class.

Methods

signature(object="ts")

signature(object="x12Single")

Author(s)

Alexander Kowarik,Angelika Meraner

See Also

X12,plot,plotSpec,plotSeasFac,plotRsdAcf

crossValidation-class5

Examples

##Not run:

s<-new("x12Single",ts=AirPassengers,tsName="air")

s<-setP(s,list(estimate=TRUE,regvariables="AO1950.1",outlier="all",critical=list(LS=3.5,TC=2.5), backcast_years=1/2,forecast_years=1))

cv<-crossVal(s,showLine=TRUE)

cv

##End(Not run)

crossValidation-class Class"crossValidation"

Description

Standardized object for saving the output of crossVal in R.

Objects from the Class

Objects can be created by calls of the form new("crossValidation",...).

Slots

backcast:Object of class"dfOrNULL"~~

forecast:Object of class"dfOrNULL"~~

Author(s)

Alexander Kowarik,Angelika Meraner

Examples

showClass("crossValidation")

diagnostics-class Class"diagnostics"

Description

The x12binaries produce a?le with the suf?x.udg.This class is a list of a selection of its content.

Objects from the Class

Objects can be created by calls of the form new("diagnostics",...).It is used internally by the

methods for x12Batch and x12Single objects.

6fbcast-class Slots

.Data:Object of class"list"~~

Extends

Class"list",from data part.

Author(s)

Alexander Kowarik

Examples

showClass("diagnostics")

fbcast-class Class"fbcast"

Description

Objects to save estimate,lowerci and upperci of fore-and/or backcasts in one standardized list.

Used by the functions in this package.

Objects from the Class

Objects can be created by calls of the form new("fbcast",...).

Slots

estimate:Object of class"ts"~~

lowerci:Object of class"ts"~~

upperci:Object of class"ts"~~

Author(s)

Alexander Kowarik

Examples

showClass("fbcast")

getP-methods7 getP-methods getP and setP for setting and loading parameters

Description

getP and setP for setting and loading parameters from a x12Single-class,x12Batch-class or x12Parameter-class object.

Usage

##S4method for signature’x12Single’

getP(object,whichP)

##S4method for signature’x12Batch’

getP(object,whichP,index=NULL)

##S4method for signature’x12Parameter’

getP(object,whichP)

##S4method for signature’x12Single’

setP(object,listP)

##S4method for signature’x12Batch’

setP(object,listP,index=NULL)

##S4method for signature’x12Parameter’

setP(object,listP)

Arguments

object object of class x12Single-class,x12Batch-class or x12Parameter-class.

whichP character vector with the names of the parameters to extract

listP named list of parameters to change

index index of the series in x12Batch-class to change or extract(NULL=all)

Methods

signature(object="x12Batch")

signature(object="x12Parameter")

signature(object="x12Single")

See Also

X12,x12Batch

Examples

##Not run:

#Create new batch object with4time series

xb<-new("x12Batch",list(AirPassengers,AirPassengers,AirPassengers,AirPassengers)) #change the automdl to FALSE in all4elements

8loadP xb<-setP(xb,list(automdl=FALSE))

#change the arima and sarima setting for the first ts object

xb<-setP(xb,list(arima=c(1,1,0),sarima=c(1,1,0)),1)

#change the arima and sarima setting for the second ts object

xb<-setP(xb,list(arima=c(0,1,1),sarima=c(0,1,1)),2)

#change the arima and sarima setting for the third ts object

xb<-setP(xb,list(arima=c(0,1,1),sarima=c(1,1,1)),3)

#change the arima and sarima setting for the fourth ts object

xb<-setP(xb,list(arima=c(1,1,1),sarima=c(1,1,1)),4)

#run X12on all series

xb<-X12(xb)

summary(xb)

#Set automdl=TRUE for the first ts

xb<-setP(xb,list(automdl=TRUE),1)

#rerun X12on all series(the binaries will only run on the first one)

xb<-X12(xb)

#summary with oldOutput

summary(xb,oldOutput=10)

#Change the parameter and output of the first series back to the first run

xb<-prev(xb,index=1,n=1)

#summary with oldOutput(---No valid previous runs.---)

summary(xb,oldOutput=10)

##End(Not run)

loadP loadP and saveP

Description

Functions loadP and saveP load and save parameter settings.

Usage

##S4method for signature’x12Single’

loadP(object,file)

##S4method for signature’x12Batch’

loadP(object,file)

##S4method for signature’x12Parameter’

loadP(object,file)

##S4method for signature’x12Single’

saveP(object,file)

##S4method for signature’x12Batch’

saveP(object,file)

##S4method for signature’x12Parameter’

saveP(object,file)

loadP9 Arguments

object object of class x12Single-class,x12Batch-class or x12Parameter-class.

file?lepath

Methods

signature(object="x12Batch")

signature(object="x12Parameter")

signature(object="x12Single")

See Also

X12,x12Batch

Examples

##Not run:

#Create new batch object with4time series and change some parameters

xb<-new("x12Batch",list(AirPassengers,AirPassengers,AirPassengers,AirPassengers)) xb<-setP(xb,list(automdl=FALSE))

xb<-setP(xb,list(arima=c(1,1,0),sarima=c(1,1,0)),1)

xb<-setP(xb,list(arima=c(0,1,1),sarima=c(0,1,1)),2)

xb<-setP(xb,list(arima=c(0,1,1),sarima=c(1,1,1)),3)

xb<-setP(xb,list(arima=c(1,1,1),sarima=c(1,1,1)),4)

#save all parameters

saveP(xb,file="xyz.RData")

xb1<-new("x12Batch",list(AirPassengers,AirPassengers,AirPassengers,AirPassengers)) #load all parameters and save it to the corresponding series inside a x12Batch-object xb1<-loadP(xb1,file="xyz.RData")

xs<-new("x12Single",ts=AirPassengers)

xs<-setP(xs,list(arima=c(2,1,1),sarima=c(2,1,1)))

#Save the parameters

saveP(xs,file="xyz1.RData")

#Load a saved parameter set to a x12Single object

xs<-new("x12Single",ts=AirPassengers)

xs<-loadP(xs,file="xyz1.RData")

#Replace all parameters in a x12Batch object with one parameter set

xb<-new("x12Batch",list(AirPassengers,AirPassengers,AirPassengers,AirPassengers)) xb<-loadP(xb,file="xyz1.RData")

##End(Not run)

10plot-methods plot-methods~~Methods for Function plot in Package x12~~

Description

Plot function for X12output in package x12.

Usage

##S4method for signature’x12Single’

plot(x,y=NULL,original=TRUE,sa=FALSE,trend=FALSE,log_transform=FALSE,

ylab="Value",xlab="Date",main="TS",

col_original="black",col_sa="blue",col_trend="green",

lwd_original=1,lwd_sa=1,lwd_trend=1,lty_sa=1,lty_trend=1,ytop=1,

showAllout=FALSE,showAlloutLines=FALSE,showOut=NULL,annComp=TRUE,annCompTrend=TRUE, col_ao="red",col_ls="red",col_tc="red",col_annComp="grey",lwd_out=1,cex_out=1.5, pch_ao=4,pch_ls=2,pch_tc=23,plot_legend=TRUE,

forecast=FALSE,backcast=FALSE,showCI=TRUE,

col_fc="#2020ff",col_bc="#2020ff",col_ci="#d1d1ff",col_cishade="#d1d1ff",

lty_original=1,lty_fc=2,lty_bc=2,lty_ci=1,lwd_fc=1,lwd_bc=1,lwd_ci=1,

points_bc=FALSE,points_fc=FALSE,points_original=FALSE,

showLine=FALSE,col_line="grey",lty_line=3,ylim=NULL,span=NULL)

##S4method for signature’x12Output’

plot(x,y=NULL,original=TRUE,sa=FALSE,trend=FALSE,log_transform=FALSE,

ylab="Value",xlab="Date",main="TS",

col_original="black",col_sa="blue",col_trend="green",

lwd_original=1,lwd_sa=1,lwd_trend=1,lty_sa=1,lty_trend=1,ytop=1,

showAllout=FALSE,showAlloutLines=FALSE,showOut=NULL,annComp=TRUE,annCompTrend=TRUE, col_ao="red",col_ls="red",col_tc="red",col_annComp="grey",lwd_out=1,cex_out=1.5, pch_ao=4,pch_ls=2,pch_tc=23,plot_legend=TRUE,

forecast=FALSE,backcast=FALSE,showCI=TRUE,

col_fc="#2020ff",col_bc="#2020ff",col_ci="#d1d1ff",col_cishade="#d1d1ff",

lty_original=1,lty_fc=2,lty_bc=2,lty_ci=1,lwd_fc=1,lwd_bc=1,lwd_ci=1,

points_bc=FALSE,points_fc=FALSE,points_original=FALSE,

showLine=FALSE,col_line="grey",lty_line=3,ylim=NULL,span=NULL)

Arguments

x object of class x12Output-class or x12Single-class.

y ignored.

original logical de?ning whether the original time series should be plotted.

sa logical de?ning whether the seasonally adjusted time series should be plotted.

trend logical de?ning whether the trend should be plotted.

log_transform logical de?ning whether the log transform should be plotted.

plot-methods11

showAllout logical de?ning whether all outliers should be plotted.

showOut character in the format"TypeYear.Seasonalperiod"de?ning a speci?c outlier to be plotted.

annComp logical de?ning whether an annual comparison should be performed for the out-lier de?ned in showOut.

forecast logical de?ning whether the forecasts should be plotted.

backcast logical de?ning whether the backcasts should be plotted.

showCI logical de?ning whether the prediction intervals should be plotted.

ylab label of y-axis.

xlab label of x-axis.

main plot title.

col_original color of the original time series.

col_sa color of the seasonally adjusted time series.

col_trend color of the trend.

lwd_original line width of the original time series.

lwd_sa line width of the seasonally adjusted time series.

lwd_trend line width of the trend.

lty_original line type of the original time series.

lty_sa line type of the seasonally adjusted time series.

lty_trend line type of the trend.

ytop multiplication factor for ylim.

showAlloutLines

logical specifying if vertical lines should be plotted with the outliers.

annCompTrend logical specifying if the trend of the annual comparison should be plotted.

col_ao color of additive outliers.

col_ls color of level shifts.

col_tc color of transitory changes.

col_annComp color of annual comparison.

lwd_out line width of outliers.

cex_out magni?cation factor for size of symbols used for plotting outliers.

pch_ao symbols used for additive outliers.

pch_ls symbols used for level shifts.

pch_tc symbols used for transitory changes.

plot_legend logical specifying if a legend should be plotted.

col_fc color of forecasts.

col_bc color of backcasts.

col_ci color of prediction interval.

col_cishade color of prediction interval shading.

12plot-methods

lty_fc line type of forecasts.

lty_bc line type of backcasts.

lty_ci line type of prediction interval.

lwd_fc line width of forecasts.

lwd_bc line width of backcasts.

lwd_ci line width of prediction interval.

points_bc logical specifying if backcasts should additionally be indicated with points.

points_fc logical specifying if forecasts should additionally be indicated with points.

points_original

logical specifying if the original time series should additionally be indicated

with points.

showLine logical indicating if a boundary line should be drawn before/after fore-/backcasts.

col_line color of showLine.

lty_line line type of showLine.

ylim range of the y-axis.

span vector of length4,limiting the data used for the plot.

Start and end date of said time interval can be speci?ed by4integers in the for-

mat c(start year,start seasonal period,end year,end seasonal period)

Methods

signature(x="x12Output")

signature(x="x12Single")

Author(s)

Alexander Kowarik,Angelika Meraner

See Also

plotSpec,plotSeasFac,plotRsdAcf

Examples

##Not run:

s<-new("x12Single",ts=AirPassengers,tsName="air")

s<-setP(s,list(estimate=TRUE,regvariables="AO1950.1",outlier="all",critical=list(LS=3.5,TC=2.5),backcast_yea s<-X12(s)

#w/o outliers

plot(s@x12Output,sa=TRUE,trend=TRUE,original=FALSE)

plot(s)

#with(all)outliers

plot(s,showAllout=TRUE,sa=TRUE,trend=TRUE,log_transform=TRUE,lwd_out=1,pch_ao=4)

plot(s,showAllout=TRUE,sa=TRUE,trend=TRUE,original=FALSE,showAlloutLines=TRUE,col_tc="purple")#,log_transform=T plot(s,showAllout=TRUE,span=c(1951,1,1953,12),points_original=TRUE,cex_out=2)

#with showOut

plot.x1213 plot(s,showOut="AO1960.Jun",sa=FALSE,trend=FALSE,annComp=TRUE,log_transform=TRUE)

plot(s,showOut="AO1958.Mar",sa=TRUE,trend=TRUE,annComp=TRUE,annCompTrend=FALSE)

plot(s,showOut="AO1950.Jun",annComp=FALSE,cex_out=3,pch_ao=19,col_ao="orange")

plot(s,showOut="TC1954.Mar",span=c(1954,1,1955,12))

plot(s,showOut="TC1954.Feb",col_tc="green3")

#w/o legend

plot(s,showAllout=TRUE,plot_legend=FALSE)

plot(s,plot_legend=FALSE)

plot(s,showOut="AO1950.1",plot_legend=FALSE,lwd_out=2,col_ao="purple")

plot(s,showOut="TC1954.Feb",col_tc="orange",col_ao="magenta",plot_legend=FALSE)

plot(s,showOut="AO1950.1",col_tc="orange",col_ao="magenta",plot_legend=FALSE)

#Forecasts&Backcasts

plot(s,forecast=TRUE)

plot(s,backcast=TRUE,showLine=TRUE)

plot(s,backcast=TRUE,forecast=TRUE,showCI=FALSE)

plot(s,forecast=TRUE,points_fc=TRUE,col_fc="purple",lty_fc=2,lty_original=3,lwd_fc=0.9,lwd_ci=2) plot(s,sa=TRUE,plot_legend=FALSE)

#Seasonal Factors and SI Ratios

plotSeasFac(s)

#Spectra

plotSpec(s)

plotSpec(s,highlight=FALSE)

#Autocorrelations of the Residuals

plotRsdAcf(s)

plotRsdAcf(s,col_acf="black",lwd_acf=1)

##End(Not run)

plot.x12Plot method for objects of class x12

Description

Plot method for objects of class"x12".

Usage

##S3method for class’x12’

plot(x,plots=c(1:9),...)

Arguments

x an object of class"x12".

plots a vector containing numbers between1and9.

...further arguments(currently ignored).

14plotRsdAcf

Details

Plots:

1:Original

2:Original Trend Adjusted

3:Log Original

4:Seasonal Factors

5:Seasonal Factors with SI Ratios

6:Spectrum Adjusted Original

7:Spectrum Seasonal Adjusted

8:Spectrum Irregular

9:Spectrum Residulas

Author(s)

Alexander Kowarik

See Also

x12

Examples

data(AirPassengersX12)

#plot(AirPassengersX12)

plotRsdAcf~~Methods for Function plotRsdAcf in Package x12~~

Description

Plot of the(partial)autocorrelations of the(squared)residuals with function plotRsdAcf in package x12.

Usage

##S4method for signature’x12Output’

plotRsdAcf(x,which="acf",

xlab="Lag",ylab="ACF",

main="default",col_acf="darkgrey",lwd_acf=4,

col_ci="blue",lt_ci=2,ylim="default",...)

##S4method for signature’x12Single’

plotRsdAcf(x,which="acf",

xlab="Lag",ylab="ACF",

main="default",col_acf="darkgrey",lwd_acf=4,

col_ci="blue",lt_ci=2,ylim="default",...)

plotRsdAcf15

Arguments

x object of class x12Output-class or x12Single-class.

which character specifying the type of autocorrelation of the residuals that should be

plotted,i.e.the autocorrelations or partial autocorrelations of the residuals or

the autocorrelations of the squared residuals("acf","pacf","acf2").

xlab label of the x-axis.

ylab label of the y-axis.

main plot title.

col_acf color of the autocorrelations.

lwd_acf line width of the autocorrelations.

col_ci color of the+-2standard error limits.

lt_ci line type of the+-2standard error limits.

ylim range of the y-axis.

...ignored.

Methods

signature(x="x12Output")

signature(x="x12Single")

Author(s)

Alexander Kowarik,Angelika Meraner

See Also

X12,plot,plotSpec,plotSeasFac

Examples

##Not run:

s<-new("x12Single",ts=AirPassengers,tsName="air")

s<-setP(s,list(estimate=TRUE,regvariables="AO1950.1",outlier="all",critical=list(LS=3.5,TC=2.5),backcast_yea s<-X12(s)

#w/o outliers

plot(s@x12Output,sa=TRUE,trend=TRUE,original=FALSE)

plot(s)

#with(all)outliers

plot(s,showAllout=TRUE,sa=TRUE,trend=TRUE,log_transform=TRUE,lwd_out=1,pch_ao=4)

plot(s,showAllout=TRUE,sa=TRUE,trend=TRUE,original=FALSE,showAlloutLines=TRUE,col_tc="purple")#,log_transform=T #with showOut

plot(s,showOut="AO1960.Jun",sa=FALSE,trend=FALSE,annComp=TRUE,log_transform=TRUE)

plot(s,showOut="AO1958.Mar",sa=TRUE,trend=TRUE,annComp=TRUE,annCompTrend=FALSE)

plot(s,showOut="AO1950.Jun",annComp=FALSE,cex_out=3,pch_ao=19,col_ao="orange")

plot(s,showOut="TC1954.Feb")

plot(s,showOut="TC1954.Feb",col_tc="green3")

16plotSeasFac #w/o legend

plot(s,showAllout=TRUE,plot_legend=FALSE)

plot(s,plot_legend=FALSE)

plot(s,showOut="AO1950.1",plot_legend=FALSE,lwd_out=2,col_ao="purple")

plot(s,showOut="TC1954.Feb",col_tc="orange",col_ao="magenta",plot_legend=FALSE)

plot(s,showOut="AO1950.1",col_tc="orange",col_ao="magenta",plot_legend=FALSE)

#Forecasts&Backcasts

plot(s,forecast=TRUE)

plot(s,backcast=TRUE,showLine=TRUE)

plot(s,backcast=TRUE,forecast=TRUE,showCI=FALSE)

plot(s,forecast=TRUE,points_fc=TRUE,col_fc="purple",lty_fc=2,lty_original=3,lwd_fc=0.9,lwd_ci=2)

plot(s,sa=TRUE,plot_legend=FALSE)

#Seasonal Factors and SI Ratios

plotSeasFac(s)

#Spectra

plotSpec(s)

plotSpec(s,highlight=FALSE)

#Autocorrelations of the Residuals

plotRsdAcf(s)

plotRsdAcf(s,col_acf="black",lwd_acf=1)

##End(Not run)

plotSeasFac~~Methods for Function plotSeasFac in Package x12~~

Description

Seasonal factor plots with function plotSeasFac in package x12.

Usage

##S4method for signature’x12Output’

plotSeasFac(x,SI_Ratios=TRUE,ylab="Value",xlab="",

lwd_seasonal=1,col_seasonal="black",lwd_mean=1,col_mean="blue",col_siratio="darkgreen",

col_replaced="red",cex_siratio=.9,cex_replaced=.9,SI_Ratios_replaced=TRUE,plot_legend=TRUE,...

##S4method for signature’x12Single’

plotSeasFac(x,SI_Ratios=TRUE,ylab="Value",xlab="",

lwd_seasonal=1,col_seasonal="black",lwd_mean=1,col_mean="blue",col_siratio="darkgreen",

col_replaced="red",cex_siratio=.9,cex_replaced=.9,SI_Ratios_replaced=TRUE,plot_legend=TRUE,...

Arguments

x object of class x12Output-class or x12Single-class.

SI_Ratios logical specifying if the SI ratios should be plotted.

plotSeasFac17

ylab label of the y-axis.

xlab label of the x-axis.

lwd_seasonal line width of the seasonal factors.

col_seasonal color of the seasonal factors.

lwd_mean line width of the mean.

col_mean color of the mean.

col_siratio color of the SI ratios.

col_replaced color of the replaced SI ratios.

cex_siratio magni?cation factor for the size of the symbols used for plotting the SI ratios.

cex_replaced magni?cation factor for the size of the symbols used for plotting the replaced SI

ratios.

SI_Ratios_replaced

logical specifying if the replaced SI ratios should be plotted.

plot_legend logical specifying if a legend should be plotted.

...ignored.

Methods

signature(x="x12Output")

signature(x="x12Single")

Author(s)

Alexander Kowarik,Angelika Meraner

See Also

X12,plot,plotSpec,plotRsdAcf

Examples

##Not run:

s<-new("x12Single",ts=AirPassengers,tsName="air")

s<-setP(s,list(estimate=TRUE,regvariables="AO1950.1",outlier="all",critical=list(LS=3.5,TC=2.5),backcast_yea s<-X12(s)

#w/o outliers

plot(s@x12Output,sa=TRUE,trend=TRUE,original=FALSE)

plot(s)

#with(all)outliers

plot(s,showAllout=TRUE,sa=TRUE,trend=TRUE,log_transform=TRUE,lwd_out=1,pch_ao=4)

plot(s,showAllout=TRUE,sa=TRUE,trend=TRUE,original=FALSE,showAlloutLines=TRUE,col_tc="purple")#,log_transform=T #with showOut

plot(s,showOut="AO1960.Jun",sa=FALSE,trend=FALSE,annComp=TRUE,log_transform=TRUE)

plot(s,showOut="AO1958.Mar",sa=TRUE,trend=TRUE,annComp=TRUE,annCompTrend=FALSE)

plot(s,showOut="AO1950.Jun",annComp=FALSE,cex_out=3,pch_ao=19,col_ao="orange")

plot(s,showOut="TC1954.Feb")

18plotSpec plot(s,showOut="TC1954.Feb",col_tc="green3")

#w/o legend

plot(s,showAllout=TRUE,plot_legend=FALSE)

plot(s,plot_legend=FALSE)

plot(s,showOut="AO1950.1",plot_legend=FALSE,lwd_out=2,col_ao="purple")

plot(s,showOut="TC1954.Feb",col_tc="orange",col_ao="magenta",plot_legend=FALSE)

plot(s,showOut="AO1950.1",col_tc="orange",col_ao="magenta",plot_legend=FALSE)

#Forecasts&Backcasts

plot(s,forecast=TRUE)

plot(s,backcast=TRUE,showLine=TRUE)

plot(s,backcast=TRUE,forecast=TRUE,showCI=FALSE)

plot(s,forecast=TRUE,points_fc=TRUE,col_fc="purple",lty_fc=2,lty_original=3,lwd_fc=0.9,lwd_ci=2) plot(s,sa=TRUE,plot_legend=FALSE)

#Seasonal Factors and SI Ratios

plotSeasFac(s)

#Spectra

plotSpec(s)

plotSpec(s,highlight=FALSE)

#Autocorrelations of the Residuals

plotRsdAcf(s)

plotRsdAcf(s,col_acf="black",lwd_acf=1)

##End(Not run)

plotSpec~~Methods for Function plotSpec in Package x12~~

Description

Spectral plots with function plotSpec in package x12.

Arguments

x an object of class x12Output-class,x12Single-class or spectrum-class.

which a string de?ning the executable of the editor to use("sa"for the Spectrum of

the Seasonally Adjusted Series,"original"for the Spectrum of the Original

Series,"irregular"for the Spectrum of the Irregular Series and"residuals"

for the Spectrum of the RegARIMA Residuals).

frequency frequency of the time series(has to be speci?ed for objects of class"spectrum"

only).

xlab label of the x-axis.

ylab label of the y-axis.

main plot title.

col_bar color of bars.

plotSpec19

col_seasonal color of seasonal frequencies.

col_td color of trading day frequencies.

lwd_bar line width of bars.

lwd_seasonal line width of seasonal frequencies.

lwd_td line width of trading day frequencies.

plot_legend logical specifying if a legend should be plotted.

Methods

signature(x="x12Output",which="sa",xlab="Frequency",ylab="Decibels",main="Spectrum",col_bar="da signature(x="x12Single",which="sa",xlab="Frequency",ylab="Decibels",main="Spectrum",col_bar="da signature(x="spectrum",frequency,xlab="Frequency",ylab="Decibels",main="Spectrum",col_bar="dar

Author(s)

Alexander Kowarik,Angelika Meraner

See Also

X12,plot,plotSeasFac,plotRsdAcf

Examples

##Not run:

s<-new("x12Single",ts=AirPassengers,tsName="air")

s<-setP(s,list(estimate=TRUE,regvariables="AO1950.1",outlier="all",critical=list(LS=3.5,TC=2.5),backcast_yea s<-X12(s)

#w/o outliers

plot(s@x12Output,sa=TRUE,trend=TRUE,original=FALSE)

plot(s)

#with(all)outliers

plot(s,showAllout=TRUE,sa=TRUE,trend=TRUE,log_transform=TRUE,lwd_out=1,pch_ao=4)

plot(s,showAllout=TRUE,sa=TRUE,trend=TRUE,original=FALSE,showAlloutLines=TRUE,col_tc="purple")#,log_transform=T #with showOut

plot(s,showOut="AO1960.Jun",sa=FALSE,trend=FALSE,annComp=TRUE,log_transform=TRUE)

plot(s,showOut="AO1958.Mar",sa=TRUE,trend=TRUE,annComp=TRUE,annCompTrend=FALSE)

plot(s,showOut="AO1950.Jun",annComp=FALSE,cex_out=3,pch_ao=19,col_ao="orange")

plot(s,showOut="TC1954.Feb")

plot(s,showOut="TC1954.Feb",col_tc="green3")

#w/o legend

plot(s,showAllout=TRUE,plot_legend=FALSE)

plot(s,plot_legend=FALSE)

plot(s,showOut="AO1950.1",plot_legend=FALSE,lwd_out=2,col_ao="purple")

plot(s,showOut="TC1954.Feb",col_tc="orange",col_ao="magenta",plot_legend=FALSE)

20prev-methods plot(s,showOut="AO1950.1",col_tc="orange",col_ao="magenta",plot_legend=FALSE)

#Forecasts&Backcasts

plot(s,forecast=TRUE)

plot(s,backcast=TRUE,showLine=TRUE)

plot(s,backcast=TRUE,forecast=TRUE,showCI=FALSE)

plot(s,forecast=TRUE,points_fc=TRUE,col_fc="purple",lty_fc=2,lty_original=3,lwd_fc=0.9,lwd_ci=2) plot(s,sa=TRUE,plot_legend=FALSE)

#Seasonal Factors and SI Ratios

plotSeasFac(s)

#Spectra

plotSpec(s)

plotSpec(s,highlight=FALSE)

#Autocorrelations of the Residuals

plotRsdAcf(s)

plotRsdAcf(s,col_acf="black",lwd_acf=1)

##End(Not run)

prev-methods~~Methods for Function prev and cleanHistory in Package x12~~

Description

Function prev in package x12reverts to previous parameter settings and output.

Function cleanHistory resets x12OldParameter and x12OldOutput.

Usage

##S4method for signature’x12Single’

prev(object,n=NULL)

##S4method for signature’x12Batch’

prev(object,index=NULL,n=NULL)

##S4method for signature’x12Single’

cleanHistory(object)

##S4method for signature’x12Batch’

cleanHistory(object,index=NULL)

Arguments

object object of class x12Single-class or x12Batch-class.

n index corresponding to a previous run.

index index corresponding to(an)object(s)of class"x12Single".

Methods

signature(object="x12Single")

signature(object="x12Batch")

相关文档