Description Super class Methods
General distribution fitting algorithms
General distribution fitting algorithms
ukcovidtools::PassthroughFilesystemCache
-> DistributionFit
new()
New distribution fitter
DistributionFit$new( distributions = c("weibull", "gamma", "lnorm", "exp", "norm", "tnorm"), shifted = 0, ... )
distributions
- the distributions to fit
shifted
- a shift to apply to all data
...
for compatibility
setModels()
DistributionFit$setModels( distributions = c("weibull", "gamma", "lnorm", "exp", "norm", "tnorm"), shifted = 0 )
fromUncensoredData()
DistributionFit$fromUncensoredData( groupedDf, valueExpr = value, truncate = TRUE, bootstraps = 100, seed = 101, ... )
fromCensoredData()
DistributionFit$fromCensoredData( groupedDf, lowerValueExpr, upperValueExpr, truncate = TRUE, bootstraps = 100, seed = 101, ... )
withSingleDistribution()
DistributionFit$withSingleDistribution( dist, paramDf, bootstraps = 1000, epiestimMode = FALSE, ... )
fromBootstrappedDistributions()
DistributionFit$fromBootstrappedDistributions( fittedDistributions, confint = c(0.025, 0.975), ... )
fromBootstrappedData()
DistributionFit$fromBootstrappedData( bootstrappedDf, valueExpr = value, truncate = TRUE, ... )
plot()
DistributionFit$plot( xlim, binwidth = 1, summary = FALSE, pts = 8, facet2d = TRUE )
extractFitted()
DistributionFit$extractFitted( distFit, isCensored, bootstraps = 100, seed = 101 )
filterModels()
DistributionFit$filterModels(...)
generateSamples()
DistributionFit$generateSamples(sampleExpr = 1000, seed = 101)
calculateDensities()
calculates a set of pdfs from bootstrapped distributions
DistributionFit$calculateDensities(x, summarise = TRUE)
support
- the range of values of X for which to calculate the density.
a list of randomly selected bootstraps from the fitted models.
calculateCumulativeDistributions()
calculates a set of pdfs from bootstrapped distributions
DistributionFit$calculateCumulativeDistributions(q, summarise = TRUE)
support
- the range of values of X for which to calculate the density.
a list of randomly selected bootstraps from the fitted models.
calculateQuantiles()
calculates a set of quantiles from bootstrapped distributions
DistributionFit$calculateQuantiles(p, summarise = TRUE)
support
- the range of values of X for which to calculate the density.
a list of randomly selected bootstraps from the fitted models.
discreteProbabilities()
DistributionFit$discreteProbabilities(q, summarise = TRUE)
discreteSurvival()
DistributionFit$discreteSurvival(q, summarise = TRUE)
sampledProbabilities()
DistributionFit$sampledProbabilities(q, summarise = TRUE)
sevenNumbers()
DistributionFit$sevenNumbers(groupedDf, colVar)
printDistributionSummary()
DistributionFit$printDistributionSummary(confint = c(0.025, 0.975))
printDistributionDetail()
DistributionFit$printDistributionDetail(confint = c(0.025, 0.975))
tsParameterizedConvolution()
applies a set of parameterised convolution functions groupwise to input data
DistributionFit$tsParameterizedConvolution( groupedDf, distributionsDf, outputVar = "output", valueVar = "value", dateVar = "date", distributionVar = "dist", paramNameVar = "param", paramValueVar = "paramValue", days = 30, timepoints = 0:days, padLeft = NA_real_, padRight = NA_real_ )
groupedDf
- an optionally grouped dataframe, containing at dateVar, and a valueVar to be colvolved
distributionsDf
- a dataframe containing the same grouping columns as groupedDf plus "distribution", and relevant distribution parameter columns
dateVar
-
days
-
timepoints
- the times to
padLeft
- what can we assume about the run in to the current values? default NA.
a list of matrices
tsDiscreteConvolution()
applies a set of parameterised convolution functions groupwise to input data
DistributionFit$tsDiscreteConvolution( groupedDf, discreteDistDf, outputVar = "output", valueVar = "value", dateVar = "date", pExpr = "prob", padLeft = NA_real_, padRight = NA_real_ )
groupedDf
- an optionally grouped dataframe, containing at dateVar, and a valueVar to be colvolved
discreteDistDf
- a dataframe containing the same grouping columns as groupedDf plus "start", "end" and "prob" columns
dateVar
-
padLeft
- what can we assume about the run in to the current values? default NA.
padRight
- what can we assume about the run in to the current values? default NA.
a list of matrices
tsBootstrapConvolution()
executes a convolution using bootstrapped parameterized distributions
DistributionFit$tsBootstrapConvolution( groupedDf, distributionDistDf, bootstraps = 100, outputVar = "output", valueVar = "value", dateVar = "date", days = 30, timepoints = 0:days, padLeft = NA_real_, padRight = NA_real_ )
distributionDistDf
- a grouped data frame containing the same columns as those grouped in groupedDf, plus "distribution" and columns for "<parameter>_mean","<parameter>_sd","<parameter>_min","<parameter>_max" e.g. shape_mean, shape_sd, shape_min, shape_max, rate_mean, rate_sd, rate_min, rate_max
bootstraps
- number of bootstrap iterations
the full bootstrap result (i.e. not summarized) which can be futher convoluted (asd long as the number of bootstrap iterations are kept the same).
summariseBootstrap()
summarise the result of a bootstrapped convolution using parameterized distributions
DistributionFit$summariseBootstrap( groupedDf, outputVars = vars(output), dateVar = "date" )
distributionDistDf
- a grouped data frame containing the same columns as those grouped in groupedDf, plus "distribution" and columns for "<parameter>_mean","<parameter>_sd","<parameter>_min","<parameter>_max" e.g. shape_mean, shape_sd, shape_min, shape_max, rate_mean, rate_sd, rate_min, rate_max
bootstraps
- number of bootstrap iterations
the full bootstrap result (i.e. not summarized) which can be futher convoluted (asd long as the number of bootstrap iterations are kept the same).
clone()
The objects of this class are cloneable with this method.
DistributionFit$clone(deep = FALSE)
deep
Whether to make a deep clone.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.