| distdata | R Documentation |
distdata() is the command-line probability-distribution calculator for
R4VN. It combines distribution properties, point probabilities/densities,
tail probabilities, interval probabilities, quantiles, simulation, and a
Viewer-ready plot. distlearn() provides the interactive Shiny companion.
distdata(
distribution,
...,
x = NULL,
lower = NULL,
upper = NULL,
probs = NULL,
nsim = 0L,
seed = NULL,
plot = TRUE,
digits = 6L,
show = TRUE,
console = FALSE
)
distribution |
Distribution name. Common abbreviations are accepted,
for example |
... |
Named parameters of the selected distribution. For example,
|
x |
Optional value(s). For discrete distributions R4VN reports
|
lower, upper |
Optional interval bounds for an interval probability. |
probs |
Optional cumulative probabilities for which quantiles are
requested, for example |
nsim |
Optional number of random observations to simulate. |
seed |
Optional user-supplied random seed for simulation. The default
|
plot |
Logical; retain plot data and display the probability function in the R4VN Viewer. |
digits |
Number of significant digits in numerical probability output. |
show |
Logical; open the R4VN Viewer result. |
console |
Logical; also print the tabular result to the console. |
A particularly useful teaching call is
distdata("binomial", n = 10, x = 3, p = .2). With only these inputs R4VN
reports P(X=3), P(X<3), P(X<=3), P(X>3), and P(X>=3), together
with the distribution's mean, variance, standard deviation, parameters,
support, and plot. Supplying lower and upper adds the probability inside
and outside an interval; supplying probs adds quantiles.
The beta-binomial accepts either shape1/shape2 or the more interpretable
pair p/rho. The negative binomial accepts size with either p or
mu. Gamma accepts rate or scale.
Invisibly returns an object of classes r4vn_distdata and
r4vn_stat. Its raw component contains the distribution specification,
parameters, point/range probabilities, quantiles, simulation, and plot
grid.
distdata("binomial", n = 10, x = 3, p = .2, show = FALSE)
distdata("binomial", n = 20, p = .35, lower = 5, upper = 10, show = FALSE)
distdata("normal", mean = 100, sd = 15, x = 130, show = FALSE)
distdata("normal", mean = 100, sd = 15, probs = c(.025, .5, .975), show = FALSE)
distdata("poisson", lambda = 2.5, x = 0:4, show = FALSE)
distdata("nbinom", size = 2, mu = 5, x = 0:4, show = FALSE)
distdata("betabinom", n = 20, p = .3, rho = .1, x = 0:5, show = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.