print.qfrm {qfratio}R Documentation

Methods for qfrm and qfpm objects

Description

Straightforward print and plot methods are defined for qfrm and qfpm objects which result from the qfrm, qfmrm, and qfpm functions.

Usage

## S3 method for class 'qfrm'
print(
  x,
  digits = getOption("digits"),
  show_range = !is.null(x$error_bound),
  ...
)

## S3 method for class 'qfpm'
print(x, digits = getOption("digits"), ...)

## S3 method for class 'qfrm'
plot(
  x,
  add_error = length(x$seq_error) > 0,
  add_legend = add_error,
  ylim = x$statistic * ylim_f,
  ylim_f = c(0.9, 1.1),
  xlab = "Order of evaluation",
  ylab = "Moment of ratio",
  col_m = "royalblue4",
  col_e = "tomato",
  lwd_m = 1,
  lwd_e = 1,
  lty_m = 1,
  lty_e = 2,
  pos_leg = "topright",
  ...
)

Arguments

x

qfrm or qfpm object

digits

Number of significant digits to be printed.

show_range

Logical to specify whether the possible range for the moment is printed (when available). Default TRUE when available.

...

In the plot methods, passed to plot.default. In the print methods, ignored (retained for the compatibility with the generic method).

add_error

Logical to specify whether the sequence of error bounds is plotted (when available). Default TRUE when available.

add_legend

Logical to specify whether a legend is added. Turned on by default when add_error = TRUE.

ylim, ylim_f

ylim is passed to plot.default. By default, this is automatically set to ylim_f times the terminal value of the series expression (x$statistic). ylim_f is by default c(0.9, 1.1).

xlab, ylab

Passed to plot.default

col_m, col_e, lwd_m, lwd_e, lty_m, lty_e

col, lwd, and lty to plot the sequences of the moment (***_m) and its error bound (***_e)

pos_leg

Position of the legend, e.g., "topright", "bottomright", passed as the first argument for legend

Details

The print methods simply display the moment x$statistic (typically a partial sum), its error bound x$error_bound (when available), and the possible range of the moment (x$statistic to x$statistic + x$error_bound in case of one-sided error bound; x$statistic - x$error_bound to x$statistic + x$error_bound in case of two-sided).

The plot method is designed for quick inspection of the profile of the partial sum of the series along varying orders cumsum(x$terms). When the object has a sequence for error bounds x$seq_error, this is also shown with a broken line (by default). When the object has an exact moment (i.e., resulting from qfrm_ApIq_int() or the qfpm functions), a message is thrown to tell inspection of the plot will not be required in this case.

Value

The print method invisibly returns the input.

The plot method is used for the side effect (and invisibly returns NULL).

See Also

new_qfrm: descriptions of the classes and their “constructors”

Examples

nv <- 4
A <- diag(nv:1)
B <- diag(1:nv)
mu <- rep.int(1, nv)

res1 <- qfrm(A, B, p = 3, mu = mu)
print(res1)
print(res1, digits = 5)
print(res1, digits = 10)

## Default plot: ylim too narrow to see the error bound at this m
plot(res1)

## With extended ylim
plot(res1, ylim_f = c(0.8, 1.2), pos_leg = "topleft")

## In this case, it is easy to increase m
(res2 <- qfrm(A, B, p = 3, mu = mu, m = 200))
plot(res2)


[Package qfratio version 1.1.1 Index]