cdf_crossval: Cross validation of Cumulative Distribution Function model

cdf_crossvalR Documentation

Cross validation of Cumulative Distribution Function model

Description

This function returns A goodness-of-fit criteria for nonlinear model selection, specifically, the cross-validation correlation coefficient R (R.Cross.val).

Usage

cdf_crossval(model, ...)

## S4 method for signature 'missingORNULL'
cdf_crossval(
  model,
  formula,
  pars,
  q,
  logx = FALSE,
  min.val = NULL,
  loss.fun = c("linear", "huber", "smooth", "cauchy", "arctg"),
  maxiter = 1024,
  maxfev = 1e+05,
  ptol = 1e-12,
  minFactor = 1e-06
)

## S4 method for signature 'nls'
cdf_crossval(
  model,
  q,
  logx = FALSE,
  min.val = NULL,
  maxiter = 1024,
  ptol = 1e-12,
  minFactor = 1e-06
)

## S4 method for signature 'CDFmodel'
cdf_crossval(
  model,
  q,
  logx = FALSE,
  min.val = NULL,
  maxiter = 1024,
  ptol = 1e-12,
  minFactor = 1e-06
)

## S4 method for signature 'nls.lm'
cdf_crossval(
  model,
  formula,
  q,
  logx = FALSE,
  min.val = NULL,
  maxiter = 1024,
  ptol = 1e-12,
  minFactor = 1e-06
)

Arguments

formula

No required for when a model from class CDFmodel or nls is provided. Otherwise, it will be nonlinear model formula including variables and parameters, which will be coerced to a formula if necessary. For example, for a Gamma model the formula will be: "Y ~ pgamma(q, shape, scale)", where pgamma function is available in 'stats' R package. However, the nls.lm class model created by function fitCDF has incorporated the formula information.

pars

Estimated model parameters.

q

Objective variable used to build the model, typically called a vector of quantiles. The model's formula must be expressed in terms of variable 'q'.

logx

logical(1). If TRUE, then a logarithm transformation will be applied: q = log1p(q).

min.val

A number denoting the lower bound of the domain where CDF is defined. For example, for Weibull and GGamma min.val = 0.

loss.fun

Described in fitCDF.

maxiter, ptol, maxfev

Arguments for function nlsLM and/or nls.lm.

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.

Details

The cross-validation correlation coefficient R (R.Cross.val) is an estimator of the average cross-validation predictive power (1).

References

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

See Also

mcgoftest for Bootstrap test for Goodness of fit.

Examples

## Let's simulate a sample from normal distribution
x1 = rnorm(10000, mean = 1.5, sd = 2) + runif(10^4)

## Let's build a model
cdfp <- fitCDF(x1, distNames = "Normal", plot = F)

## Next, we get an estimation of the cross-validation correlation
## coefficient R (R.Cross.val)
cdf_crossval(model = cdfp$bestfit, q = x1)

genomaths/usefr documentation built on April 18, 2023, 3:35 a.m.