Learn R Programming

x12 (version 1.10.3)

getP-methods: getP and setP for retrieving and setting parameters

Description

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

Usage

# S4 method for x12Single
getP(object, whichP)
# S4 method for x12Batch
getP(object, whichP,index=NULL)
# S4 method for x12Parameter
getP(object, whichP)
# S4 method for x12Single
setP(object, listP)
# S4 method for x12Batch
setP(object, listP,index=NULL)
# S4 method for x12Parameter
setP(object, listP)

Arguments

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, x12Single, x12Batch

Examples

Run this code
# NOT RUN {
#Create new batch object with 4 time series
xb <- new("x12Batch",list(AirPassengers,AirPassengers,AirPassengers,AirPassengers))
# change the automdl to FALSE in all 4 elements
xb <- setP(xb,list(automdl=FALSE))
#change the arima.model and arima.smodel settings for the first ts object
xb <- setP(xb,list(arima.model=c(1,1,0),arima.smodel=c(1,1,0)),1)
#change the arima.model and arima.smodel settings for the second ts object
xb <- setP(xb,list(arima.model=c(0,1,1),arima.smodel=c(0,1,1)),2)
#change the arima.model and arima.smodel settingsfor the third ts object
xb <- setP(xb,list(arima.model=c(0,1,1),arima.smodel=c(1,1,1)),3)
#change the arima.model and arima.smodel settings for the fourth ts object
xb <- setP(xb,list(arima.model=c(1,1,1),arima.smodel=c(1,1,1)),4)
#run x12 on all series
xb <- x12(xb)
summary(xb)
#Set automdl=TRUE for the first ts
xb <- setP(xb,list(automdl=TRUE),1)
getP(xb,"automdl")
#rerun x12 on 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)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab