weibull3P: Nonlinear fit of Weibull CDF

weibull3PR Documentation

Nonlinear fit of Weibull CDF

Description

This function performs the nonlinear fit of Weibull CDF of a variable x

Usage

weibull3P(
  X,
  sample.size = 20,
  model = c("all", "2P", "3P", "Weibull2P", "Weibull3P"),
  npoints = NULL,
  maxiter = 1024,
  tol = 1e-12,
  ftol = 1e-12,
  ptol = 1e-12,
  minFactor = 10^-6,
  nlms = FALSE,
  verbose = TRUE,
  ...
)

Arguments

X

numerical vector

sample.size

size of the sample

model

Distribution model to fit, two-parameters and three-parameters Weibull model ('Weibull2P' or simply '2P' and 'Weibull3P' or '3P). Default is 'all' and the model with the best AIC criterion is reported.

npoints

number of points used in the fit

maxiter

positive integer. Termination occurs when the number of iterations reaches maxiter. Default value: 1024

tol

A positive numeric value specifying the tolerance level for the relative offset convergence criterion. Default value: 1e-12,

ftol

non-negative numeric. Termination occurs when both the actual and predicted relative reductions in the sum of squares are at most ftol. Therefore, ftol measures the relative error desired in the sum of squares. Default value: 1e-12,

ptol

non-negative numeric. Termination occurs when the relative error between two consecutive iterates is at most ptol. Therefore, ptol measures the relative error desired in the approximate solution. Default value: 1e-12,

minFactor

A positive numeric value specifying the minimum step-size factor allowed on any step in the iteration. The increment is calculated with a Gauss-Newton algorithm and successively halved until the residual sum of squares has been decreased or until the step-size factor has been reduced below this limit. Default value: 10^-6

nlms

Logical. Whether to return the nonlinear model object nls.lm. Default is FALSE.

verbose

if TRUE, prints the function log to stdout

...

other parameters

Details

The script algorithm first try to fit the two-parameter Weibull CDF (Weibull2P). If Weibull2P did not fit, then the algorithm will try to fit Weibull3P. The Levenberg-Marquardt algorithm implemented in 'minpack.lm' R package is used to perform the nonlinear fit. Cross-validations for the nonlinear regressions (R.Cross.val) were performed in each methylome as described in reference (1). In addition, Stein's formula for adjusted R squared (rho) was used as an estimator of the average cross-validation predictive power (1).

Value

Model table with coefficients and goodness-of-fit results: Adj.R.Square, deviance, AIC, R.Cross.val, and rho, as well as, the coefficient covariance matrix.

Author(s)

Robersy Sanchez - 06/03/2016 https://github.com/genomaths

References

  1. Stevens JP. Applied Multivariate Statistics for the Social Sciences. Fifth Edit. Routledge Academic; 2009.

Examples

x <- rweibull(1000, shape=0.75, scale=1)
weibull3P(x, sample.size = 100)


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