-
dist_CDF
-
defines a function that returns the value of the cumulative distribution function (CDF) of the distribution at the specified values of the random variable and distribution parameters.
Type: Function
Required: YES
Number of arguments:
, where m is the number of distribution parameters
-
Sequence and type of arguments:
- x
Numeric value of the random variable at which the CDF value should be evaluated
- p1
Numeric value of the first parameter
- p2
Numeric value of the second parameter …
- pm
Numeric value of the mth parameter
Return value: Numeric value that contains the CDF value
If you want to consider this distribution as a candidate distribution when you estimate a response variable model with regression effects, then the first parameter of this distribution must be a scale parameter or log-transformed scale parameter. In other words, if the distribution has a scale parameter, then the following equation must be satisfied:
If the distribution has a log-transformed scale parameter, then the following equation must be satisfied:
Here is a sample structure of the function for a distribution named 'FOO':
function FOO_CDF(x, P1, P2);
/* Code to compute CDF by using x, P1, and P2 */
F = <computed CDF>;
return (F);
endsub;
-
dist_CONSTANTPARM
-
defines a subroutine that specifies constant parameters. A parameter is constant if it is required for defining a distribution but is not subject to optimization in PROC SEVERITY. Constant parameters are required to be part of the model in order to compute the PDF or the CDF of the distribution. Typically, values of these parameters are known a priori or estimated using some means other than the maximum likelihood method used by PROC SEVERITY. You can estimate them inside the dist_PARMINIT subroutine. Once initialized, the parameters remain constant in the context of PROC SEVERITY; that is, they retain their initial value. PROC SEVERITY estimates only the nonconstant parameters.
Here is a sample structure of the subroutine for a distribution named 'FOO' that has P3 and P5 as its constant parameters, assuming that distribution has at least three parameters:
subroutine FOO_CONSTANTPARM(p5, p3);
endsub;
Note the following points when you specify the constant parameters:
At least one distribution parameter must be free to be optimized; that is, if a distribution has total m parameters, then k must be strictly less than m.
If you want to use this distribution for modeling regression effects, then the first parameter must not be a constant parameter.
The order of arguments in the signature of this subroutine does not matter as long as each argument’s name matches the name of one of the parameters that are defined in the signature of the dist_PDF function.
The constant parameters must be specified in signatures of all the functions and subroutines that accept distribution parameters as their arguments.
You must provide a nonmissing initial value for each constant parameter by using one of the supported parameter initialization methods.
-
dist_DESCRIPTION
-
defines a function that returns a description of the distribution.
Type: Function
Required: NO
Number of arguments: None
Sequence and type of arguments: Not applicable
Return value: Character value containing a description of the distribution
Here is a sample structure of the function for a distribution named 'FOO':
function FOO_DESCRIPTION() $48;
length desc $48;
desc = "A model for a continuous distribution named foo";
return (desc);
endsub;
There is no restriction on the length of the description (the length of 48 used in the previous example is for illustration purposes only). However, if the length is greater than 256, then only the first 256 characters appear in the displayed output and in the _DESCRIPTION_ variable of the OUTMODELINFO= data set. Hence, the recommended length of the description is less than or equal to 256.
-
dist_LOGcore
-
defines a function that returns the natural logarithm of the specified core function of the distribution at the specified values of the random variable and distribution parameters. The core keyword can be PDF, CDF, or SDF.
Type: Function
Required: YES only if core is PDF or CDF and you have not defined that core function; otherwise, NO
Number of arguments:
, where m is the number of distribution parameters
-
Sequence and type of arguments:
- x
Numeric value of the random variable at which the natural logarithm of the core function should be evaluated
- p1
Numeric value of the first parameter
- p2
Numeric value of the second parameter …
- pm
Numeric value of the mth parameter
Return value: Numeric value that contains the natural logarithm of the core function
Here is a sample structure of the function for the core function PDF of a distribution named 'FOO':
function FOO_LOGPDF(x, P1, P2);
/* Code to compute LOGPDF by using x, P1, and P2 */
l = <computed LOGPDF>;
return (l);
endsub;
-
dist_LOWERBOUNDS
-
defines a subroutine that returns lower bounds for the parameters of the distribution. If this subroutine is not defined for a given distribution, then the SEVERITY procedure assumes a lower bound of 0 for each parameter. If a lower bound of
is returned for a parameter
, then the SEVERITY procedure assumes that
(strict inequality). If a missing value is returned for some parameter, then the SEVERITY procedure assumes that there is no lower bound for that parameter (equivalent to a lower bound of
).
Type: Subroutine
Required: NO
Number of arguments: m, where m is the number of distribution parameters
-
Sequence and type of arguments:
- p1
Output argument that returns the lower bound on the first parameter. You must specify this in the OUTARGS statement inside the subroutine’s definition.
- p2
Output argument that returns the lower bound on the second parameter. You must specify this in the OUTARGS statement inside the subroutine’s definition. …
- pm
Output argument that returns the lower bound on the mth parameter. You must specify this in the OUTARGS statement inside the subroutine’s definition.
Return value: The results, lower bounds on parameter values, should be returned in the parameter arguments of the subroutine.
Here is a sample structure of the subroutine for a distribution named 'FOO':
subroutine FOO_LOWERBOUNDS(p1, p2);
outargs p1, p2;
p1 = <lower bound for P1>;
p2 = <lower bound for P2>;
endsub;
-
dist_PARMINIT
-
defines a subroutine that returns the initial values for the distribution’s parameters given an empirical distribution function (EDF) estimate.
Type: Subroutine
Required: NO
Number of arguments:
, where m is the number of distribution parameters
-
Sequence and type of arguments:
- dim
Input numeric value that contains the dimension of the x, nx, and F array arguments.
- x{*}
Input numeric array of dimension dim that contains values of the random variables at which the EDF estimate is available. It can be assumed that x contains values in an increasing order. In other words, if
, then x[i]
x[j].
- nx{*}
Input numeric array of dimension dim. Each nx[i] contains the number of observations in the original data that have the value x[i].
- F{*}
Input numeric array of dimension dim. Each F[i] contains the EDF estimate for x[i]. This estimate is computed by the SEVERITY procedure based on the options that you specify in the LOSS statement and the EMPIRICALCDF= option.
- Ftype
Input numeric value that contains the type of the EDF estimate that is stored in x and F. For definitions of types, see the section Supplying EDF Estimates to Functions and Subroutines.
- p1
Output argument that returns the initial value of the first parameter. You must specify this in the OUTARGS statement inside the subroutine’s definition.
- p2
Output argument that returns the initial value of the second parameter. You must specify this in the OUTARGS statement inside the subroutine’s definition. …
- pm
Output argument that returns the initial value of the mth parameter. You must specify this in the OUTARGS statement inside the subroutine’s definition.
Return value: The results, initial values of the parameters, should be returned in the parameter arguments of the subroutine.
Here is a sample structure of the subroutine for a distribution named 'FOO':
subroutine FOO_PARMINIT(dim, x{*}, nx{*}, F{*}, Ftype, p1, p2);
outargs p1, p2;
/* Code to initialize values of P1 and P2 by using
dim, x, nx, and F */
p1 = <initial value for p1>;
p2 = <initial value for p2>;
endsub;
-
dist_PDF
-
defines a function that returns the value of the probability density function (PDF) of the distribution at the specified values of the random variable and distribution parameters.
Type: Function
Required: YES
Number of arguments:
, where m is the number of distribution parameters
-
Sequence and type of arguments:
- x
Numeric value of the random variable at which the PDF value should be evaluated
- p1
Numeric value of the first parameter
- p2
Numeric value of the second parameter …
- pm
Numeric value of the mth parameter
Return value: Numeric value that contains the PDF value
If you want to consider this distribution as a candidate distribution when you estimate a response variable model with regression effects, then the first parameter of this distribution must be a scale parameter or log-transformed scale parameter. In other words, if the distribution has a scale parameter, then the following equation must be satisfied:
If the distribution has a log-transformed scale parameter, then the following equation must be satisfied:
Here is a sample structure of the function for a distribution named 'FOO':
function FOO_PDF(x, P1, P2);
/* Code to compute PDF by using x, P1, and P2 */
f = <computed PDF>;
return (f);
endsub;
-
dist_QUANTILE
-
defines a function that returns the quantile of the distribution at the specified value of the CDF for the specified values of distribution parameters.
Type: Function
Required: NO
Number of arguments:
, where m is the number of distribution parameters
-
Sequence and type of arguments:
- cdf
Numeric value of the cumulative distribution function (CDF) for which the quantile should be evaluated
- p1
Numeric value of the first parameter
- p2
Numeric value of the second parameter …
- pm
Numeric value of the mth parameter
Return value: Numeric value that contains the quantile
Here is a sample structure of the function for a distribution named 'FOO':
function FOO_QUANTILE(c, P1, P2);
/* Code to compute quantile by using c, P1, and P2 */
Q = <computed quantile>;
return (Q);
endsub;
-
dist_SCALETRANSFORM
-
defines a function that returns a keyword to identify the transform that needs to be applied to the scale parameter to convert it to the first parameter of the distribution.
If you want to use this distribution for modeling regression effects, then the first parameter of this distribution must be a scale parameter. However, for some distributions, a typical or convenient parameterization might not have a scale parameter, but one of the parameters can be a simple transform of the scale parameter. As an example, consider a typical parameterization of the lognormal distribution with two parameters, location
and shape
, for which the PDF is defined as follows:
You can reparameterize this distribution to contain a parameter
instead of the parameter
such that
. The parameter
would then be a scale parameter. However, if you want to specify the distribution in terms of
and
(which is a more recognized form of the lognormal distribution) and still allow it as a candidate distribution for estimating regression effects, then instead of writing another distribution with parameters
and
, you can simply define the distribution with
as the first parameter and specify that it is the logarithm of the scale parameter.
Type: Function
Required: NO
Number of arguments: None
Sequence and type of arguments: Not applicable
-
Return value: Character value that contains one of the following keywords:
- LOG
specifies that the first parameter is the logarithm of the scale parameter.
- IDENTITY
specifies that the first parameter is a scale parameter without any transformation.
If you do not specify this function, then the IDENTITY transform is assumed.
Here is a sample structure of the function for a distribution named 'FOO':
function FOO_SCALETRANSFORM() $8;
length xform $8;
xform = "IDENTITY";
return (xform);
endsub;
-
dist_SDF
-
defines a function that returns the value of the survival distribution function (SDF) of the distribution at the specified values of the random variable and distribution parameters.
Type: Function
Required: NO
Number of arguments:
, where m is the number of distribution parameters
-
Sequence and type of arguments:
- x
Numeric value of the random variable at which the SDF value should be evaluated
- p1
Numeric value of the first parameter
- p2
Numeric value of the second parameter …
- pm
Numeric value of the mth parameter
Return value: Numeric value that contains the SDF value
If you want to consider this distribution as a candidate distribution when estimating a response variable model with regression effects, then the first parameter of this distribution must be a scale parameter or log-transformed scale parameter. In other words, if the distribution has a scale parameter, then the following equation must be satisfied:
If the distribution has a log-transformed scale parameter, then the following equation must be satisfied:
Here is a sample structure of the function for a distribution named 'FOO':
function FOO_SDF(x, P1, P2);
/* Code to compute SDF by using x, P1, and P2 */
S = <computed SDF>;
return (S);
endsub;
-
dist_UPPERBOUNDS
-
defines a subroutine that returns upper bounds for the parameters of the distribution. If this subroutine is not defined for a given distribution, then the SEVERITY procedure assumes that there is no upper bound for any of the parameters. If an upper bound of
is returned for a parameter
, then the SEVERITY procedure assumes that
(strict inequality). If a missing value is returned for some parameter, then the SEVERITY procedure assumes that there is no upper bound for that parameter (equivalent to an upper bound of
).
Type: Subroutine
Required: NO
Number of arguments: m, where m is the number of distribution parameters
-
Sequence and type of arguments:
- p1
Output argument that returns the upper bound on the first parameter. You must specify this in the OUTARGS statement inside the subroutine’s definition.
- p2
Output argument that returns the upper bound on the second parameter. You must specify this in the OUTARGS statement inside the subroutine’s definition. …
- pm
Output argument that returns the upper bound on the mth parameter. You must specify this in the OUTARGS statement inside the subroutine’s definition.
Return value: The results, upper bounds on parameter values, should be returned in the parameter arguments of the subroutine.
Here is a sample structure of the subroutine for a distribution named 'FOO':
subroutine FOO_UPPERBOUNDS(p1, p2);
outargs p1, p2;
p1 = <upper bound for P1>;
p2 = <upper bound for P2>;
endsub;
-
dist_coreGRADIENT
-
defines a subroutine that returns the gradient vector of the specified core function of the distribution at the specified values of the random variable and distribution parameters. The core keyword can be PDF, CDF, SDF, LOGPDF, LOGCDF, or LOGSDF.
Type: Subroutine
Required: NO
Number of arguments:
, where m is the number of distribution parameters
-
Sequence and type of arguments:
- x
Numeric value of the random variable at which the gradient should be evaluated
- p1
Numeric value of the first parameter
- p2
Numeric value of the second parameter …
- pm
Numeric value of the mth parameter
- grad{*}
Output numeric array of size m that contains the gradient vector evaluated at the specified values. If h denotes the value of the core function, then the expected order of the values in the array is as follows:
Return value: Numeric array that contains the gradient evaluated at x for the parameter values
Here is a sample structure of the function for the core function CDF of a distribution named 'FOO':
subroutine FOO_CDFGRADIENT(x, P1, P2, grad{*});
outargs grad;
/* Code to compute gradient by using x, P1, and P2 */
grad[1] = <partial derivative of CDF w.r.t. P1
evaluated at x, P1, P2>;
grad[2] = <partial derivative of CDF w.r.t. P2
evaluated at x, P1, P2>;
endsub;
-
dist_coreHESSIAN
-
defines a subroutine that returns the Hessian matrix of the specified core function of the distribution at the specified values of the random variable and distribution parameters. The core keyword can be PDF, CDF, SDF, LOGPDF, LOGCDF, or LOGSDF.
Type: Subroutine
Required: NO
Number of arguments:
, where m is the number of distribution parameters
-
Sequence and type of arguments:
- x
Numeric value of the random variable at which the Hessian matrix should be evaluated
- p1
Numeric value of the first parameter
- p2
Numeric value of the second parameter …
- pm
Numeric value of the mth parameter
- hess{*}
Output numeric array of size
that contains the lower triangular portion of the Hessian matrix in a packed vector form, evaluated at the specified values. If h denotes the value of the core function, then the expected order of the values in the array is as follows:
Return value: Numeric array that contains the lower triangular portion of the Hessian matrix evaluated at x for the parameter values
Here is a sample structure of the subroutine for the core function LOGSDF of a distribution named 'FOO':
subroutine FOO_LOGSDFHESSIAN(x, P1, P2, hess{*});
outargs hess;
/* Code to compute Hessian by using x, P1, and P2 */
hess[1] = <second order partial derivative of LOGSDF
w.r.t. P1 evaluated at x, P1, P2>;
hess[2] = <second order partial derivative of LOGSDF
w.r.t. P1 and P2 evaluated at x, P1, P2>;
hess[3] = <second order partial derivative of LOGSDF
w.r.t. P2 evaluated at x, P1, P2>;
endsub;