View source: R/helper_functions.R
g_cdf | R Documentation |
Compute a CDF-based transformation using the observed count data.
The CDF can be estimated nonparametrically or parametrically based on the
Poisson or Negative-Binimial distributions. In the parametric case,
the parameters are determined based on the moments of y
.
Note that this is a fixed quantity and does not come with uncertainty quantification.
g_cdf(y, distribution = "np")
y |
|
distribution |
the distribution used for the CDF; must be one of
|
A smooth monotone function which can be used for evaluations of the transformation.
# Sample some data:
y = rpois(n = 500, lambda = 5)
# Empirical CDF version:
g_np = g_cdf(y, distribution = 'np')
# Poisson version:
g_pois = g_cdf(y, distribution = 'pois')
# Negative binomial version:
g_negbin = g_cdf(y, distribution = 'neg-bin')
# Plot together:
t = 1:max(y) # grid
plot(t, g_np(t), type='l')
lines(t, g_pois(t), lty = 2)
lines(t, g_negbin(t), lty = 3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.