seasonal (version 1.2.1)

inspect: Interactively Inspect a Seasonal Adjustment Model

Description

Interactively inspect a "seas" object. The goal of inspect is to summarize all relevant options, plots and statistics that should be usually considered.

Usage

inspect(x, fun = NULL, check.version = TRUE, quiet = TRUE, ...)

Arguments

x
an object of class "seas".
fun
a function or a list of functions (see details)
check.version
logical, should the version of shiny be checked
quiet
logical, if TRUE (default), error messages from calls in inspect are not shown in the console
...
further arguments, passed on to runApp. (The launch.browser argument of version 0.8 can be still used that way)

Value

  • an object of class "seas", the modified model.

Details

Frequently used options can be modified using the drop down selectors in the upper left window. Each change will result in a re-estimation of the seasonal adjustment model. The R-call, the output and the summary are updated accordingly.

Alternatively, the R-Call can be modified manually in the lower left window. Press 'Run Call' to re-estimate the model and to adjust the option selectors, the output, and the summary. With the 'Close and Import' button, inspect is closed and the call is imported to R. The 'static' button substitutes automatic procedures by the automatically chosen spec-argument options, in the same way as static.

The views in the upper right window can be selected from the drop down menu.

The lower right panel shows the summary, as descibed in the help page of summary.seas. The 'Full X-13 output' button opens the complete output of X-13 in a separate tab or window.

The views in inspect can be customized via the fun argument. One or several plot functions may be supplied. The plot functions should have a "seas" object as their only argument. Several functions must be wrapped in a list (see examples).

See Also

seas for the main function of seasonal.

Examples

Run this code
m <- seas(AirPassengers)

inspect(m)

m2 <- inspect(m)  # save the model after closing the GUI

### customizing inspect

# a single function
# a new item 'User Plot' can be chosen in the 'View' menu
inspect(m, fun = function(x) hist(resid(x)))  

# more than one function collected in a list
myfun <- list()
myfun[['Spectum X-13']] <- function(m){
  plot(series(m, "spectrum.specorig", verbose = FALSE)[,-1], t = "l")
}
myfun[['Spectum R']] <- function(m){
  spectrum(diff(log(AirPassengers)), method = "ar", main = "")
}
inspect(m, myfun)

# and a bonus example
spaghetti <- function(m, back = 10){
ser <- original(m)
tx <- time(ser)[(length(ser) - back):length(ser)]
z <- NULL
for (txi in tx){
  assign(as.character(m$call$x), window(ser, end = txi))
  z <- cbind(z, final(eval(m$call)))
}
ts.plot(window(z, start = time(ser)[(length(ser) - back- 15)]), 
        col = rainbow(back + 1))
}
inspect(m, spaghetti)

Run the code above in your browser using DataCamp Workspace