cdist | R Documentation |
This function determines the critical values for isolating a central portion of a distribution with a specified probability. This is designed to work especially well for symmetric distributions, but it can be used with any distribution.
cdist(
dist = "norm",
p,
plot = TRUE,
verbose = FALSE,
invisible = FALSE,
digits = 3L,
xlim = NULL,
ylim = NULL,
resolution = 500L,
return = c("values", "plot"),
pattern = c("rings", "stripes"),
...,
refinements = list()
)
xcgamma(
p,
shape,
rate = 1,
scale = 1/rate,
lower.tail = TRUE,
log.p = FALSE,
...
)
xct(p, df, ncp, lower.tail = TRUE, log.p = FALSE, ...)
xcchisq(p, df, ncp = 0, lower.tail = TRUE, log.p = FALSE, ...)
xcf(p, df1, df2, lower.tail = TRUE, log.p = FALSE, ...)
xcbinom(p, size, prob, lower.tail = TRUE, log.p = FALSE, ...)
xcpois(p, lambda, lower.tail = TRUE, log.p = FALSE, ...)
xcgeom(p, prob, lower.tail = TRUE, log.p = FALSE, ...)
xcnbinom(p, size, prob, mu, lower.tail = TRUE, log.p = FALSE, ...)
xcbeta(p, shape1, shape2, ncp = 0, lower.tail = TRUE, log.p = FALSE, ...)
dist |
a character string naming a distribution family (e.g., "norm"). This will work for any family for which the usual d/p/q functions exist. |
p |
the proportion to be in the central region, with equal proportions in either "tail". |
plot |
a logical indicating whether a plot should be created |
verbose |
a logical indicating whether a more verbose output value should be returned. |
invisible |
a logical |
digits |
the number of digits desired |
xlim |
x limits. By default, these are chosen to show the central 99.8\ of the distribution. |
ylim |
y limits |
resolution |
number of points used for detecting discreteness and generating plots. The default value of 5000 should work well except for discrete distributions that have many distinct values, especially if these values are not evenly spaced. |
return |
If |
pattern |
One of |
... |
additional arguments passed to the distribution functions. Typically these specify the parameters of the particular distribution desired. See the examples. |
refinements |
A list of refinements to the plot. See |
shape , scale |
shape and scale parameters. Must be positive,
|
rate |
an alternative way to specify the scale. |
lower.tail |
logical; if TRUE (default), probabilities are
|
log.p |
A logical indicating whether probabilities should be returned on the log scale. |
df |
degrees of freedom ( |
ncp |
non-centrality parameter |
df1 , df2 |
degrees of freedom. |
size |
number of trials (zero or more). |
prob |
probability of success on each trial. |
lambda |
vector of (non-negative) means. |
mu |
alternative parametrization via mean: see ‘Details’. |
shape1 , shape2 |
non-negative parameters of the Beta distribution. |
a pair of numbers indicating the upper and lower bounds, unless verbose
is
TRUE
, in which case a 1-row data frame is returned containing these bounds,
the central probability, the tail probabilities, and the name of the distribution.
This function is still experimental and changes the input or output formats are possible in future versions of the package.
cdist( "norm", .95)
cdist( "t", c(.90, .95, .99), df=5)
cdist( "t", c(.90, .95, .99), df=50)
# plotting doesn't work well when the parameters are not constant
cdist( "t", .95, df=c(3,5,10,20), plot = FALSE)
cdist( "norm", .95, mean=500, sd=100 )
cdist( "chisq", c(.90, .95), df=3 )
# CI
x <- rnorm(23, mean = 10, sd = 2)
cdist("t", p = 0.95, df=22)
mean(x) + cdist("t", p = 0.95, df=22) * sd(x) / sqrt(23)
confint(t.test(x))
cdist("t", p = 0.95, df=22, verbose = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.