View source: R/predictProbDistr.R View source: R/predictProbDistr.R
predict.ProbDistr  R Documentation 
This is an utility function to get predictions from the probability distributions models used in MethylIT: Weibull, Gamma, and generalized Gamma. Some times, after the nonlinear fit of any of the mentioned modelsm we would like to evaluate the model output.
predict.ProbDistr(nlm, pred = "quant", q = 0.95, dist.name)
predict.ProbDistrList(
nlm,
pred = "quant",
q = 0.95,
dist.name,
num.cores = 1L,
tasks = 0L
)
nlm 
An object carrying the best nonlinear fit for a distribution model
obtained with function 
pred 
Type of prediction resquested: *density* ('dens'),*quantiles* ('quant'), *random number* ('rnum') or *probabilities* ('prob'). 
q 
numeric vector of quantiles, probabilities or an interger if pred = 'rnum'. 
dist.name 
name of the distribution to fit: Weibull2P (default: 'Weibull2P'), Weibull threeparameters (Weibull3P), gamma with threeparameter (Gamma3P), gamma with twoparameter (Gamma2P), generalized gamma with threeparameter ('GGamma3P') or fourparameter ('GGamma4P'). 
num.cores, tasks 
Paramaters for parallele computation using package

Predictions are based on the best model fit returned by function
nonlinearFitDist
. The possible prediction are: *density*,
*quantiles*, *random number* or *probabilities*.
set.seed(1)
num.points < 1000
HD < makeGRangesFromDataFrame(
data.frame(chr = 'chr1', start = 1:num.points, end = 1:num.points,
strand = '*',
hdiv = rweibull(1:num.points, shape = 0.75, scale = 1)),
keep.extra.columns = TRUE)
nlms < nonlinearFitDist(list(HD), column = 1, verbose = FALSE)
x=seq(0.1, 10, 0.05)
y < predict(nlms[[1]], pred='dens', q = x,
dist.name='Weibull2P')
y1 < dweibull(x, shape = 0.75, scale = 1)
# The maximum difference between the 'theoretical' and estimated densities
max(abs(round(y, 2)  round(y1, 2)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.