print-methods {distrMod} | R Documentation |
Common ‘print’ Methods for S4 classes in Package ‘distrMod’
Description
Methods for print
to the S4 classes in package distrMod;
Usage
## S4 method for signature 'ShowDetails'
print(x, digits = getOption("digits"),
show.details = c("maximal", "minimal", "medium"))
Arguments
x |
object of class |
digits |
unchanged w.r.t. default method of package |
show.details |
a character, controlling the degree of detailedness
of the output; currently the following values are permitted:
|
Details
This method provides sort of a ”show
with extra arguments”, in form of a common print
method
for the mentioned S4 classes. Essentially this print
method
just temporarily sets the global options according to the optional arguments
digits
and show.details
, calls show
and then re-sets
the options to their global settings.
Examples
## set options to maximal detailedness
show.old <- getdistrModOption("show.details")
distrModoptions("show.details" = "maximal")
## define a model
NS <- NormLocationScaleFamily(mean=2, sd=3)
## generate data out of this situation
x <- r(distribution(NS))(30)
## want to estimate mu/sigma, sigma^2
## -> new trafo slot:
trafo(NS) <- function(param){
mu <- param["mean"]
sd <- param["sd"]
fval <- c(mu/sd, sd^2)
nfval <- c("mu/sig", "sig^2")
names(fval) <- nfval
mat <- matrix(c(1/sd,0,-mu/sd^2,2*sd),2,2)
dimnames(mat) <- list(nfval,c("mean","sd"))
return(list(fval=fval, mat=mat))
}
print(param(NS))
print(param(NS), show.details = "minimal")
print(param(NS), show.details = "medium")
## Maximum likelihood estimator
res <- MLEstimator(x = x, ParamFamily = NS)
print(res) #equivalent to 'show(res)' or 'res'
print(res, digits = 4)
print(res, show.details = "minimal")
print(res, show.details = "medium")
distrModoptions("show.details" = show.old)