View source: R/customProbFunctions.R
autoSolution | R Documentation |
Given the name of a shape function and the specific calculation requested, calculate either the PDF, CCDF, integration of the PDF or CCDF, or the integration of tau*PDF or tau*CCDF.
autoSolution( suffix, shape, tau_0, tau_n, tau, tau_b = NULL, ..., MoreArgs = list(), integrateArgs1 = list(), integrateArgs2 = list(), forceNumeric = F ) fullSolution( suffix, shape, tau_0, tau_n, tau, tau_b = NULL, ..., MoreArgs = list() ) numericalSolution( suffix, shape, tau_0, tau_n, tau, tau_b = NULL, ..., MoreArgs = list(), integrateArgs1 = list(), integrateArgs2 = list(), forceNumeric = T )
suffix |
A character vector indicating the value to be returned; either "PDF", "CCDF", "IntPDF", "IntCCDF", "IntTau.PDF", or "IntTau.CCDF." |
shape |
A character vector of |
tau_0, tau_n |
Minimum and maximum residence times of the definite integration. |
tau |
A vector of residence times for which PDF or CCDF values are requested, or the lower values of definate intergrals of the finite integral of the PDF, CCDF, tau*PDF, or tau*CCDF. |
tau_b |
The upper values of definite integrals of the PDF, CCDF, tau*PDF, or tau*CCDF. Ignored for calculating PDF or CCDF values. |
... |
Additional values required by the shape function. |
integrateArgs1, integrateArgs2 |
When numerical integration is used, a
named list of optional values for |
forceNumeric |
When set to T, numerical integration will be used by
|
The function numericalSolution
uses numerical integration of basic
shape function (e.g., powerLaw
, exponent
) to return
values of the probability density function (PDF) of the shape function,
complementary cumulative distribution funtion (CCDF) of the shape function,
finite integrals of the PDF or CCDF, or finite integrals of tau*PDF
or
tau*CCDF
. Numerical integration to calculate the normalizing constant
for the PDF and CCDF, and for integrating these functions.
The function fullSolution
looks for a function with a name specified
by the concatination of shape
and suffix
and checks to be sure
any such function has the signature function(tau,
tau_0,
tau_n, ...)
if suffix is "PDF" or "CCDF", or function(tau_a,
tau_b,
tau_0,
tau_n,
...)
for other values of suffix. Solutions for the "powerLaw" and "exponent"
shapes are provided as part of this package as follows: PDF (e.g.
powerLawPDF
, exponentPDF
), CCDF (e.g.
powerLawCCDF
, exponentCCDF
), integral of the PFD (e.g.
powerLawIntPDF
, exponentIntPDF
), integral of the CCDF
(e.g. powerLawIntCCDF
, exponentIntCCDF
), integral of
tau*PDF (e.g. powerLawIntTau.PDF
, exponentIntTau.PDF
) or
integral of tau*CCDF (e.g. powerLawIntTau.CCDF
,
exponentIntTau.CCDF
). These solution functions can also be called
directly, but fullSolution
is provided as a convenience wrapper that
calls the functions using the convention shape
and suffix
.
The user can provide custom shape functions or solutions for other shapes,
however the names of the custom solution functions must follow the convention
of concatinating the shape name with the suffix as the name of the solution
function (e.g., the solution function for the integral of tau*PDF of a shape
called "foo" must be fooIntTau.PDF
). For more information, see the
documentation of powerLaw
and powerLawPDF
The function autoSolution
looks first for a solution function that
matches the concatination of shape
and suffix
and, if found,
calls fullSolution
. If the solution functions are not found,
autoSolution
calls numericSolution
.
A vector of values representing either the PDF, CCDF, integration of
the PDF, integration of the CCDF, integration of tau
* PDF or the
integration of tau
* CCDF.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.