If PROC FCMP is used to define a custom distribution under these conditions:
then PROC SEVERITY returns:
To circumvent the problem, you need to ensure that the first parameter is not a constant parameter. You can do this by redefining the distribution in PROC FCMP with a different order of parameters in the dist_PDF, dist_CDF, and related distribution functions.
The following PROC FCMP and PROC SEVERITY steps illustrate the problem and the circumvention. This example uses a Pareto Type I distribution, where the scale parameter is constant.
Code to illustrate circumvention:
proc fcmp outlib=work.mydist.par1s;
function PAR1B_DESCRIPTION() $;
length model $64;
model = "Pareto (Type I) Distribution (Scale is not first and constant)";
return(model);
endsub;
subroutine PAR1B_CONSTANTPARM(Scale); /* constant scale parameter */
endsub;
function PAR1B_LOGPDF(x, Shape, Scale); /* non-constant shape parameter is listed first */
if (x < Scale) then
return (.);
else do;
return (log(Shape) + Shape*log(Scale) - (Shape+1)*log(x));
end;
endsub;
function PAR1B_CDF(x, Shape, Scale); /* non-constant shape parameter is listed first */
if (x < Scale) then
return (0);
else
return (1 - (Scale/x)**Shape);
endsub;
subroutine PAR1B_PARMINIT(dim, x[*], nx[*], F[*], Ftype, Shape, Scale); /* non-constant shape parameter is listed first */
outargs Shape, Scale;
Scale = x{1};
mean = x{1};
do i=2 to dim;
Scale = min(Scale,x{i});
mean = mean + x{i};
end;
Shape=mean/(mean-Scale); /* Method of moments estimator */
if (Shape < 1+2.220446E-16) then
Shape=.; /* infeasible; let optimizer conclude that */
endsub;
quit;
options cmplib=(sashelp.svrtdist work.mydist);
/* There are no problems if a constant parameter is not first. */
proc severity data=Pareto;
loss x;
dist par1b;
run;