SEVSELECT Procedure

Example 26.1 Defining a Model for the Gaussian Distribution with a Scale Parameter

If you want to estimate the influence of regression effects, then the model needs to be parameterized to have a scale parameter. Although this might not be always possible, it is possible for certain distributions. This example illustrates it for the Gaussian distribution. To obtain a parameterization with scale parameter, you replace the location parameter mu with another parameter, alpha equals mu slash sigma, and define the PDF (f) and the CDF (F) as follows:

StartLayout 1st Row 1st Column f left-parenthesis x semicolon sigma comma alpha right-parenthesis 2nd Column equals StartFraction 1 Over sigma StartRoot 2 pi EndRoot EndFraction exp left-parenthesis minus one-half left-parenthesis StartFraction x Over sigma EndFraction minus alpha right-parenthesis squared right-parenthesis 2nd Row 1st Column upper F left-parenthesis x semicolon sigma comma alpha right-parenthesis 2nd Column equals one-half left-parenthesis 1 plus normal e normal r normal f left-parenthesis StartFraction 1 Over StartRoot 2 EndRoot EndFraction left-parenthesis StartFraction x Over sigma EndFraction minus alpha right-parenthesis right-parenthesis right-parenthesis EndLayout

Then, you can verify that sigma is the scale parameter, because both of the following equalities are true:

StartLayout 1st Row 1st Column f left-parenthesis x semicolon sigma comma alpha right-parenthesis 2nd Column equals StartFraction 1 Over sigma EndFraction f left-parenthesis StartFraction x Over sigma EndFraction semicolon 1 comma alpha right-parenthesis 2nd Row 1st Column upper F left-parenthesis x semicolon sigma comma alpha right-parenthesis 2nd Column equals upper F left-parenthesis StartFraction x Over sigma EndFraction semicolon 1 comma alpha right-parenthesis EndLayout

Note: The Gaussian distribution is not a commonly used severity distribution. It is used in this example primarily to illustrate the concept of parameterizing a distribution such that it has a scale parameter. Although the distribution has a support over the entire real line, you can fit the distribution with PROC SEVSELECT only if the input sample contains nonnegative values.

The following statements use the alternate parameterization to define a new model named NORMAL_S. The definition is stored in the library Work.Sevexmpl.

/*-------- Define normal distribution with scale parameter  ----------*/
proc fcmp library=sashelp.svrtdist outlib=work.sevexmpl.models;
   function normal_s_pdf(x, Sigma, Alpha);
      /* Sigma : Scale & Standard Deviation */
      /* Alpha : Scaled mean */
      return ( exp(-(x/Sigma - Alpha)**2/2) /
             (Sigma * sqrt(2*constant('PI'))) );
   endsub;

   function normal_s_cdf(x, Sigma, Alpha);
      /* Sigma : Scale & Standard Deviation */
      /* Alpha : Scaled mean */
      z = x/Sigma - Alpha;
      return (0.5 + 0.5*erf(z/sqrt(2)));
   endsub;

   subroutine normal_s_parminit(dim, x[*], nx[*], F[*], Ftype, Sigma, Alpha);
      outargs Sigma, Alpha;
      array m[2] / nosymbols;
      /* Compute estimates by using method of moments */
      call svrtutil_rawmoments(dim, x, nx, 2, m);
      Sigma = sqrt(m[2] - m[1]**2);
      Alpha = m[1]/Sigma;
   endsub;

   subroutine normal_s_lowerbounds(Sigma, Alpha);
      outargs Sigma, Alpha;
      Alpha = .; /* Alpha has no lower bound */
      Sigma = 0; /* Sigma > 0 */
   endsub;
quit;

An important point to note is that the scale parameter Sigma is the first distribution parameter (after the 'x' argument) listed in the signatures of NORMAL_S_PDF and NORMAL_S_CDF functions. Sigma is also the first distribution parameter listed in the signatures of other subroutines. This is required by PROC SEVSELECT, so that it can identify which is the scale parameter. When you specify regression effects, PROC SEVSELECT checks whether the first parameter of each candidate distribution is a scale parameter (or a log-transformed scale parameter if dist_SCALETRANSFORM subroutine is defined for the distribution with LOG as the transform). If it is not, then an appropriate message is written the SAS log and that distribution is not fitted.

Let the following DATA step statements simulate a sample from the normal distribution where the parameter sigma is affected by the regressors as follows:

sigma equals exp left-parenthesis 1 plus 0.5 upper X 1 plus 0.75 upper X 3 negative 2 upper X 4 plus upper X 5 right-parenthesis

The sample is simulated such that the regressor X2 is linearly dependent on regressors X1 and X3.

/*--- Simulate a normal distribution's sample affected by regressors ---*/
data testnorm_reg(keep=y x1-x5 Sigma);
   array x{*} x1-x5;
   array b{6} _TEMPORARY_ (1 0.5 . 0.75 -2 1);
   call streaminit(34567);
   label y='Normal Response Influenced by Regressors';

   do n = 1 to 100;
      /* simulate regressors */
      do i = 1 to dim(x);
         x(i) = rand('UNIFORM');
      end;
      /* make x2 linearly dependent on x1 */
      x(2) = 5 * x(1);

      /* compute log of the scale parameter */
      logSigma = b(1);
      do i = 1 to dim(x);
         if (i ne 2) then
            logSigma = logSigma + b(i+1) * x(i);
      end;

      Sigma = exp(logSigma);
      y = rand('NORMAL', 25, Sigma);
      output;
   end;
run;

You can use a DATA step as follows to load the data set Work.Test_reg into a data table in your session that is associated with the mylib libref. The DATA step assumes that your libref is named mylib, but you can substitute any appropriately defined libref.

data mylib.testnorm_reg;
   set testnorm_reg;
run;

The following statements use PROC SEVSELECT to fit the NORMAL_S distribution model along with some of the predefined distributions to the simulated sample:

/*--- Set the search path for functions defined with PROC FCMP ---*/
options cmplib=(work.sevexmpl);

/*-------- Fit models with PROC SEVSELECT --------*/
proc sevselect data=mylib.testnorm_reg print=all;
   loss y;
   scalemodel x1-x5;
   dist Normal_s burr logn pareto weibull;
run;

The "Model Selection" table in Output 26.1.1 indicates that all the models, except the Burr distribution model, have converged. Also, only three models, Normal_s, Burr, and Weibull, seem to have a good fit for the data. The table that compares all the fit statistics indicates that Normal_s model is the best according to the likelihood-based statistics; however, the Burr model is the best according to the EDF-based statistics.

Output 26.1.1: Summary of Results for Fitting the Normal Distribution with Regressors

The SEVSELECT Procedure

Model Selection
DistributionConverged-2 Log
Likelihood
Selected
Normal_sYes603.95786Yes
BurrMaybe612.81685No
LognYes749.20125No
ParetoYes841.07022No
WeibullYes612.77496No

All Fit Statistics
Distribution-2 Log
Likelihood
AICAICCSBCKSADCvM
Normal_s603.95786*615.95786*616.86108*631.58888*1.523884.001520.70769
Burr612.81685626.81685628.03424645.053041.50448*3.90072*0.63399*
Logn749.20125761.20125762.10448776.832272.8811016.205583.04825
Pareto841.07022853.07022853.97345868.701244.8381031.605686.84046
Weibull612.77496624.77496625.67819640.405981.504903.905590.63458
Asterisk (*) denotes the best model in the column.


This prompts you to further evaluate why the model with Burr distribution has not converged. The initial values, convergence status, and the optimization summary for the Burr distribution are shown in Output 26.1.2. The initial values table indicates that the regressor X2 is redundant, which is expected. More importantly, the convergence status indicates that it requires more than 50 iterations. PROC SEVSELECT enables you to change several settings of the optimizer by using the NLOPTIONS statement. In this case, you can increase the limit of 50 on the iterations, change the convergence criterion, or change the technique to something other than the default trust-region technique.

Output 26.1.2: Details of the Fitted Burr Distribution Model

The SEVSELECT Procedure
 
Burr Distribution

Model Information
DistributionBurr
DescriptionBurr Distribution (Type XII Family)
Distribution Parameters3
Regression Parameters4

Initial Parameter Values and Bounds
ParameterInitial
Value
Lower
Bound
Upper
Bound
Theta25.751981.05367E-8Infty
Alpha2.000001.05367E-8Infty
Gamma2.000001.05367E-8Infty
x10.07345-709.78271709.78271
x2Redundant-709.78271709.78271
x3-0.14056-709.78271709.78271
x40.27064-709.78271709.78271
x5-0.23230-709.78271709.78271

Convergence Status
Needs more than 50 iterations.

Optimization Summary
Optimization TechniqueTrust Region
Iterations50
Function Calls137
Log Likelihood-306.4084238


The following PROC SEVSELECT step uses the NLOPTIONS statement to change the convergence criterion and the limits on the iterations and function evaluations, exclude the lognormal and Pareto distributions that have been confirmed previously to fit the data poorly, and exclude the redundant regressor X2 from the model:

/*--- Refit and compare models with higher limit on iterations ---*/
proc sevselect data=mylib.testnorm_reg print=all;
   loss y;
   scalemodel x1 x3-x5;
   dist Normal_s burr weibull;
   nloptions absfconv=2.0e-5 maxiter=100 maxfunc=500;
run;

The results shown in Output 26.1.3 indicate that the Burr distribution has now converged. The NORMAL_S distribution is still the best distribution according to the likelihood-based criteria.

Output 26.1.3: Summary of Results after Changing Maximum Number of Iterations

The SEVSELECT Procedure

Model Selection
DistributionConverged-2 Log
Likelihood
Selected
Normal_sYes603.95786Yes
BurrYes612.79276No
WeibullYes612.77496No

All Fit Statistics
Distribution-2 Log
Likelihood
AICAICCSBCKSADCvM
Normal_s603.95786*615.95786*616.86108*631.58888*1.523884.001520.70769
Burr612.79276626.79276628.01015645.028951.50472*3.90351*0.63433*
Weibull612.77496624.77496625.67819640.405981.504903.905590.63458
Asterisk (*) denotes the best model in the column.


Last updated: July 09, 2026