Learn R Programming

FlexReg (version 1.1)

curve.density: Draw density plots

Description

The function draws a curve corresponding to the probability density/mass function of the specified distribution (beta, flexible beta, variance-inflated beta, binomial, beta-binomial, or flexible beta-binomial).

Usage

curve.density(
  type = NULL,
  size = NULL,
  mu = NULL,
  theta = NULL,
  phi = NULL,
  p = NULL,
  w = NULL,
  k = NULL,
  ...
)

Arguments

type

a character specifying the distribution type to be plotted ("Beta", "FB", "VIB", "Bin", "BetaBin", or "FBB").

size

the total number of trials (to be specified if type is "Bin", "BetaBin", or "FBB").

mu

the mean parameter of the distribution. It must lie in (0, 1).

theta

the overdispersion parameter (to be specified if type is "BetaBin" or "FBB"). It must lie in (0, 1).

phi

the precision parameter (an alternative way to specify the theta parameter if type is "BetaBin" or "FBB"). It must be a positive real value.

p

the mixing weight (to be specified if type is "FB" or "VIB"). It must lie in (0, 1).

w

the normalized distance among clusters of the FB distribution (to be specified if type = "FB"). It must lie in (0, 1).

k

the extent of the variance inflation (to be specified if type = "VIB"). It must lie in (0, 1).

...

additional arguments of stat_function().

References

Migliorati, S., Di Brisco, A. M., Ongaro, A. (2018) A New Regression Model for Bounded Responses. Bayesian Analysis, 13(3), 845--872. doi:10.1214/17-BA1079

Ascari, R., and Migliorati, S. (2021). A new regression model for overdispersed binomial data accounting for outliers and an excess of zeros. Statistics in Medicine, 40(17), 3895--3914. doi:10.1002/sim.9005

Di Brisco, A. M., Migliorati, S., Ongaro, A. (2020) Robustness against outliers: A new variance inflated regression model for proportions. Statistical Modelling, 20(3), 274--309. doi:10.1177/1471082X18821213

Ferrari, S.L.P., and Cribari-Neto, F. (2004). Beta Regression for Modeling Rates and Proportions. Journal of Applied Statistics, 31(7), 799--815. doi:10.1080/0266476042000214501

Examples

Run this code
curve.density("Beta", mu=0.5, phi=20)
curve.density("FB", mu=0.5, phi=20, p=0.4, w=.8)
curve.density("VIB", mu=0.5, phi=20, p=0.9, k=.8, col=3)

curve.density("Bin", size=10, mu=.7)
curve.density("BetaBin", size=10, mu=.7, phi=10)
curve.density("FBB", size=10, mu=.7, phi=10, p=.2,w=.7)


Run the code above in your browser using DataLab