| rvsummary {rv} | R Documentation |
rvsummary is a class of objects
that hold the summary information on each scalar component of a random variable
(quantiles, mean, sd, number of simulations etc.)
is.rvsummary(x) as.rvsummary(x, ...) ## S3 method for class 'rv': as.rvsummary(x, quantiles = (0:200/200), ...) ## S3 method for class 'rvsummary': as.rvsummary(x, ...) ## S3 method for class 'rvsummary_rvfactor': print(x, all.levels=FALSE, ...) ## S3 method for class 'rvsummary': dim(x) ## S3 method for class 'rvsummary': dim(x) <- value ## S3 method for class 'rvsummary': dimnames(x) ## S3 method for class 'rvsummary': dimnames(x) <- value ## S3 method for class 'rvsummary': names(x) ## S3 method for class 'rvsummary': names(x) <- value ## S3 method for class 'rvsummary': length(x) ## S3 method for class 'rvsummary': as.double(x, ...)
x |
object to be coerced or tested |
quantiles |
quantiles to calculate and store in the object |
all.levels |
logical; whether to print all levels or not (see below for details) |
value |
either NULL or a numeric vector whose product matches the length of the rvsummary object |
... |
further arguments passed to or from other methods. |
The rvsummary class provides a means to store a concise representation
of the marginal posterior distributions of the vector components.
By default, the 201 quantiles
0, 0.005, 0.01, 0.015, ..., 0.990, 0.995, 1
are saved for each vector component in an rvsummary object.
is.rvsummary tests whether the object is an rvsummary object;
as.rvsummary coerces a random vector object to a rvsummary object.
There following (generic) functions work with rvsummary objects:
rvmean,
rvsd,
rvvar,
rvquantile,
rnsims,
sims,
and consequently any `rv-only' function that depends only on these functions
will work; e.g. is.constant, which depends only on rvnsims.
The method is.double is provided for compatibility reasons;
this is needed in a function called by plot.rvsummary
The arithmetic operators and mathematical functions will not work with
rvsummary objects.
The sims method returns the quantiles.
An object of class rvsummary and of subclass
rvsummary_numeric,
rvsummary_integer,
rvsummary_logical,
or
rvsummary_rvfactor.
Jouni Kerman jouni@kerman.com
Kerman, J. and Gelman, A. (2007). Manipulating and Summarizing Posterior Simulations Using Random Variable Objects. Statistics and Computing 17:3, 235-244.
See also vignette("rv").
x <- rvnorm(mean=1:12) sx <- as.rvsummary(x) print(sx) # prints the summary of the rvsummary object length(sx) # 12 dim(sx) # NULL dim(sx) <- c(3,4) # dimnames(sx) <- list(1:3, 1:4) names(sx) <- 1:12 # print(sx) # prints the names and dimnames as well