predict.cdfMODEL: Predict function for probability distributions in Methyl-IT

predict.cdfMODELR Documentation

Predict function for probability distributions in Methyl-IT

Description

This is an utility function to get predictions from the probability distributions models used in Methyl-IT: 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.

Usage

predict.cdfMODEL(
  object,
  pred = "quant",
  q = 0.95,
  dist.name,
  lower.tail = TRUE
)

predict.cdfMODELlist(
  object,
  pred = "quant",
  q = 0.95,
  dist.name,
  num.cores = 1L,
  tasks = 0L
)

Arguments

object

An object carrying the best nonlinear fit for a distribution model obtained with function nonlinearFitDist.

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 three-parameters (Weibull3P), gamma with three-parameter (Gamma3P), gamma with two-parameter (Gamma2P), generalized gamma with three-parameter ('GGamma3P') or four-parameter ('GGamma4P').

lower.tail

logical; if TRUE (default), probabilities are P(X \leq x), otherwise, P(X > x) )(p-value).

num.cores, tasks

Paramaters for parallele computation using package BiocParallel-package: the number of cores to use, i.e. at most how many child processes will be run simultaneously (see bplapply and the number of tasks per job (only for Linux OS).

Details

Predictions are based on the best model fit returned by function nonlinearFitDist. The possible prediction are: density, quantiles, random number or probabilities.

Examples

data(HD)
set.seed(13)
num.points <- 8286
HD <- HD[4]
HD$T1$hdiv <- rweibull(1:num.points, shape = 0.75, scale = 1)

nlms <- nonlinearFitDist(HD, column = 9L, verbose = FALSE)

x=seq(0.1, 10, 0.05)

## Predicted values
y <- predict(nlms[[1]], pred='prob', q = x, dist.name='Weibull2P')

## Theoretical values
y1 <- pweibull(x, shape = 0.75, scale = 1)

# The maximum difference between the 'theoretical' and estimated densities
max(abs(round(y, 2) - round(y1, 2)))


genomaths/MethylIT documentation built on Feb. 3, 2024, 1:24 a.m.