This base::plot() method is a utility to plot probabilities obtained with Pr(), as well as their variabilities. The probabilities are plotted either against Y, with one curve for each value of X, or vice versa.
Arguments
- x
Object of class "probability", obtained with
Pr().- variability
One of the values
'quantiles','samples','none'(equivalent toNAorFALSE), orNULL(default), in which case the variability available inpis used. This argument chooses how to represent the variability of the probability; seePr(). If the requested variability is not available in the objectp, then a warning is issued and no variability is plotted.- subset
Named list or named vector: which variate values to display. For the variates corresponding to the names in this list, only the vector of values corresponding to that variate is displayed.
- PvsY
Logical or
NULL: should probabilities be plotted against theirYargument? IfNULL, the argument betweenYandXhaving larger number of values is chosen. As many probability curves will be plotted as the number of values of the other argument.- legend
One of the values
'bottomright','bottom','bottomleft','left','topleft','top','topright','right','center'(seegraphics::legend()): plot a legend at that position. A valueFALSEor any other does not plot any legend. Default'top'.- lty, lwd, col, type, xlab, ylab, main, ylim, grid, add
see analogous arguments in
graphics::matplot()- alpha.f
Numeric, default 0.25: opacity of the colours,
0being completely invisible and1completely opaque.- var.alpha.f
Numeric: opacity of the quantile bands or of the samples,
0being completely invisible and1completely opaque.- ...
Other parameters to be passed to
flexiplot().
Value
NULL, invisibly; produces a plot, see graphics::matplot().
See also
Pr() to calculate posterior probabilities and quantiles.
hist.probability() to plot the variability of the probabilities as a distribution.
flexiplot() (on which plot.probability() is based) for more general plots.
plotquantiles() to plot quantile ranges.
Examples
## Load the example `learnt` object calculated from the "penguins" dataset;
## variates: 'species' and 'bill_len'
learnt <- learntExample
## create a grid of values for variate "bill length",
## based on the information in the dataset and metadata:
values <- vrtgrid(vrt = 'bill_len', learnt = learnt)
## calculate the probabilities and quantiles
probs <- Pr(Y = data.frame(bill_len = values), learnt = learnt, parallel = 1)
## plot the probabilities and quantiles
plot(probs)