plot.mmkin: Plot model fits (observed and fitted) and the residuals for a...

View source: R/plot.mmkin.R

plot.mmkinR Documentation

Plot model fits (observed and fitted) and the residuals for a row or column of an mmkin object

Description

When x is a row selected from an mmkin object ([.mmkin), the same model fitted for at least one dataset is shown. When it is a column, the fit of at least one model to the same dataset is shown.

Usage

## S3 method for class 'mmkin'
plot(
  x,
  main = "auto",
  legends = 1,
  resplot = c("time", "errmod"),
  ylab = "Residue",
  standardized = FALSE,
  show_errmin = TRUE,
  errmin_var = "All data",
  errmin_digits = 3,
  cex = 0.7,
  rel.height.middle = 0.9,
  ymax = "auto",
  ...
)

Arguments

x

An object of class mmkin, with either one row or one column.

main

The main title placed on the outer margin of the plot.

legends

An index for the fits for which legends should be shown.

resplot

Should the residuals plotted against time, using mkinresplot, or as squared residuals against predicted values, with the error model, using mkinerrplot.

ylab

Label for the y axis.

standardized

Should the residuals be standardized? This option is passed to mkinresplot, it only takes effect if resplot = "time".

show_errmin

Should the chi2 error level be shown on top of the plots to the left?

errmin_var

The variable for which the FOCUS chi2 error value should be shown.

errmin_digits

The number of significant digits for rounding the FOCUS chi2 error percentage.

cex

Passed to the plot functions and mtext.

rel.height.middle

The relative height of the middle plot, if more than two rows of plots are shown.

ymax

Maximum y axis value for plot.mkinfit.

...

Further arguments passed to plot.mkinfit and mkinresplot.

Details

If the current plot device is a tikz device, then latex is being used for the formatting of the chi2 error level.

Value

The function is called for its side effect.

Author(s)

Johannes Ranke

Examples


  ## Not run: 
  # Only use one core not to offend CRAN checks
  fits <- mmkin(c("FOMC", "HS"),
                list("FOCUS B" = FOCUS_2006_B, "FOCUS C" = FOCUS_2006_C), # named list for titles
                cores = 1, quiet = TRUE, error_model = "tc")
  plot(fits[, "FOCUS C"])
  plot(fits["FOMC", ])
  plot(fits["FOMC", ], show_errmin = FALSE)

  # We can also plot a single fit, if we like the way plot.mmkin works, but then the plot
  # height should be smaller than the plot width (this is not possible for the html pages
  # generated by pkgdown, as far as I know).
  plot(fits["FOMC", "FOCUS C"]) # same as plot(fits[1, 2])

  # Show the error models
  plot(fits["FOMC", ], resplot = "errmod")
  
## End(Not run)


jranke/mkin documentation built on Jan. 13, 2024, 4:59 a.m.