PMF.get_quantile | R Documentation |
Returns the p
quantile from the PMF specified by pmf
.
PMF.get_quantile(pmf, p)
pmf |
the PMF object. |
p |
the probability of the required quantile. |
A numeric value for the quantile.
PMF.get_mean()
, PMF.get_var()
, PMF.sample()
, PMF.summary()
library(bayesRecon)
# Let's build the pmf of a Binomial distribution with parameters n and p
n <- 10
p <- 0.6
pmf_binomial <- apply(matrix(seq(0,10)),MARGIN=1,FUN=function(x) dbinom(x,size=n,prob=p))
# The true median is ceiling(n*p)
quant_50 <- PMF.get_quantile(pmf=pmf_binomial,p=0.5)
cat("True median:", ceiling(n*p), "\nMedian from PMF:", quant_50)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.