SEVSELECT Procedure

An Example with Left-Truncation and Right-Censoring

PROC SEVSELECT enables you to specify that the response variable values are left-truncated or right-censored. The following DATA step expands the data table of the previous example to simulate a scenario that is typically encountered by an automobile insurance company. The values of the variable Y represent the loss values on claims that are reported to an auto insurance company. The variable THRESHOLD records the deductible on the insurance policy. If the actual value of Y is less than or equal to the deductible, then it is unobservable and does not get recorded. In other words, THRESHOLD specifies the left-truncation of Y. LIMIT records the policy limit. If the value of Y is equal to or greater than the recorded value, then the observation is right-censored.

/*----- Lognormal Model with left-truncation and censoring -----*/
data test_sev2(keep=y threshold limit
        label='A Lognormal Sample With Censoring and Truncation');
   set test_sev1;
   label y='Censored & Truncated Response';
   if _n_ = 1 then call streaminit(45679);

   /* make about 20% of the observations left-truncated */
   if (rand('UNIFORM') < 0.2) then
      threshold = y * (1 - rand('UNIFORM'));
   else
      threshold = .;
   /* make about 15% of the observations right-censored */
   iscens = (rand('UNIFORM') < 0.15);
   if (iscens) then
      limit = y;
   else
      limit = .;
run;

You can use a DATA step as follows to load the data set Work.Test_sev2 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.test_sev2;
   set test_sev2;
run;

The following statements fit four predefined distributions (lognormal, Burr, gamma, and Weibull) and use the AICC to identify the distribution that best fits the data:

proc sevselect data=mylib.test_sev2 crit=aicc
               print=all plots=all;
   loss y / lt=threshold rc=limit;

   dist logn burr gamma weibull;
run;

The LOSS statement specifies the left-truncation and right-censoring variables. The DIST statement specifies the candidate distributions. The PRINT= option in the PROC SEVSELECT statement requests that all the displayed output be prepared. The PLOTS= option in the PROC SEVSELECT statement requests that all available plots be prepared.

Some of the key results that PROC SEVSELECT prepares are shown in Figure 6 through Figure 13. In addition to the estimates of the range, mean, and standard deviation of Y, the "Descriptive Statistics for y" table shown in Figure 6 also indicates the number of observations that are left-truncated or right-censored. The "Model Selection" table in Figure 6 shows that models with all the candidate distributions have converged and that the Logn (lognormal) model has the best fit for the data according to the AICC criterion.

Figure 6: Summary Results for the Truncated and Censored Data

Descriptive Statistics for y
Observations100
Observations Used for Estimation100
Minimum2.30264
Maximum8.34116
Mean4.62007
Standard Deviation1.23627
Left Truncated Observations23
Right Censored Observations14

Model Selection
DistributionConvergedAICCSelected
LognYes298.92672Yes
BurrYes302.66229No
GammaYes299.45293No
WeibullYes309.26779No


PROC SEVSELECT also prepares a table that shows all the fit statistics for all the candidate models. It is useful to see which model would be the best fit according to each of the criteria. The "All Fit Statistics" table prepared for this example is shown in Figure 7. It indicates that the lognormal model is chosen by all the criteria.

Figure 7: Comparing All Statistics of Fit for the Truncated and Censored Data

All Fit Statistics
Distribution-2 Log
Likelihood
AICAICCSBCKSADCvM
Logn294.80301*298.80301*298.92672*304.01335*0.51824*0.34736*0.05159*
Burr296.41229302.41229302.66229310.227800.669840.367120.05726
Gamma295.32921299.32921299.45293304.539550.625110.429210.05526
Weibull305.14408309.14408309.26779314.354420.933071.406990.17465
Asterisk (*) denotes the best model in the column.


The plot that compares EDF and CDF estimates is shown in Figure 8. When you specify left-truncation, both the EDF and CDF estimates are conditional on the response variable being greater than the smallest left-truncation threshold in the sample.

Figure 8: EDF and CDF Estimates for the Truncated and Censored Data

EDF and CDF Estimates for the Truncated and Censored Data


When you specify the PLOTS=CDFPERDIST option, PROC SEVSELECT prepares a plot that compares the nonparametric EDF estimates with the parametric CDF estimates for each distribution. These plots for lognormal and Weibull distributions are shown in Figure 9. These plots also contain the lower and upper confidence limits of EDF for the specified confidence level. Because no confidence level is specified in the EDFALPHA= option in the PROC SEVSELECT statement, a default confidence level of 95% is used; this is equivalent to specifying EDFALPHA=0.05. If the CDF estimates lie entirely within the EDF confidence interval, then you can be 95% confident that the parametric and nonparametric estimates are in agreement.

Figure 9: Comparing EDF and CDF Estimates for Lognormal and Weibull Models Fitted to Truncated and Censored Data

sevgs02o30g sevgs02o30g1


There are two additional ways to compare nonparametric (empirical) and parametric estimates for each model that has not failed to converge:

  • A P-P plot is a scatter plot of the EDF and CDF estimates. The model for which the points are scattered closer to the unit-slope reference line is a better fit. The P-P plot for the lognormal distribution is shown in Figure 10. It indicates that the EDF matches the CDF very closely. In contrast, the P-P plot for the Weibull distribution, also shown in Figure 10, indicates a poor fit.

    Figure 10: P-P Plots for Lognormal and Weibull Models Fitted to Truncated and Censored Data

    sevgs02o31g sevgs02o31g1


  • A Q-Q plot is a scatter plot of empirical quantiles and the quantiles of a parametric distribution. As in the P-P plot, points that are scattered closer to the unit-slope reference line indicate a better fit. The Q-Q plots of lognormal and Weibull distributions are shown in Figure 11; these plots confirm the conclusions that are arrived at by comparing the P-P plots.

    Figure 11: Q-Q Plots for Lognormal and Weibull Models Fitted to Truncated and Censored Data

    sevgs02o32g sevgs02o32g1


Specifying Initial Values for Parameters

All the predefined distributions have parameter initialization functions built into them. For the current example, Figure 12 shows the initial values that are obtained by the predefined method for the Burr distribution. It also shows the summary of the optimization process and the final parameter estimates.

Figure 12: Burr Model Summary for the Truncated and Censored Data

Initial Parameter Values and Bounds
ParameterInitial
Value
Lower
Bound
Upper
Bound
Theta4.781021.05367E-8Infty
Alpha2.000001.05367E-8Infty
Gamma2.000001.05367E-8Infty

Optimization Summary
Optimization TechniqueTrust Region
Iterations8
Function Calls23
Log Likelihood-148.2061441

Parameter Estimates
ParameterDFEstimateStandard
Error
t ValueApprox
Pr > |t|
Theta14.769800.624927.63<.0001
Alpha11.163630.588591.980.0509
Gamma15.940811.050045.66<.0001


You can specify a different set of initial values if estimates are available from fitting the distribution to similar data. For this example, the parameters of the Burr distribution can be initialized with the final parameter estimates of the Burr distribution that were obtained in the first example (shown in Figure 5). One of the ways in which you can specify the initial values is as follows:

/*------ Specifying initial values using INIT= option -------*/
proc sevselect data=mylib.test_sev2 crit=aicc print=all;
   loss y / lt=threshold rc=limit;

   dist burr(init=(theta=4.62348 alpha=1.15706 gamma=6.41227));
run;

The names of the parameters that are specified in the INIT option must match the parameter names in the definition of the distribution. The results obtained with these initial values are shown in Figure 13. These results indicate that new set of initial values causes the optimizer to reach the same solution with fewer iterations and function evaluations as compared to the default initialization.

Figure 13: Burr Model Optimization Summary for the Truncated and Censored Data

The SEVSELECT Procedure
 
Burr Distribution

Optimization Summary
Optimization TechniqueTrust Region
Iterations5
Function Calls16
Log Likelihood-148.2061441

Parameter Estimates
ParameterDFEstimateStandard
Error
t ValueApprox
Pr > |t|
Theta14.769800.624927.63<.0001
Alpha11.163630.588591.980.0509
Gamma15.940811.050045.66<.0001


Last updated: November 24, 2025