SIMSYSTEM Procedure
Example 31.5 Interpreting Distribution Parameters
(View the complete code for this example.)
This example demonstrates how to use the table of parameters that PROC SIMSYSTEM displays to reconstruct in DATA step code random variates that have the specified moments for each distribution. Starting with the Pearson system, the moment combinations that are specified for PROC SIMSYSTEM in the following code are chosen to span the families of distributions in the Pearson family, plus the normal distribution, as the parameters table (Output 31.5.2) that PROC SIMSYSTEM produces for these moment combinations confirms:
%let Mean = -4.5 -3.5 -2.5 -1.5 -0.5 0.5 1.5 2.5 3.5 4.5;
%let Stddev = 1 2 3 4 5 6 7 8 9 10;
%let Skew = 0 -1.5 1.8 -1.3 0 -2.00831604 0.1 -1.04235831 1.7 0;
%let Kurt = 3 5.7 7.4 3 2.1 9.05 6 5.15 8.6 3.2;
proc simsystem system=pearson;
moments mean=&Mean StdDev=&Stddev skew=&Skew kurt=&Kurt;
ods output Parameters=Parm;
run;
Output 31.5.1: Selected Pearson Distributions

Output 31.5.2: Parameters for Selected Pearson Distributions
| Parameters for Pearson Distributions | ||||||
|---|---|---|---|---|---|---|
| Skewness | Kurtosis | Family | Distribution Notes | Shift | Scale | |
| 1 | 0 | 3 | Normal | -4.500 | 1 | |
| 2 | -1.500 | 5.700 | Type I | Beta(1.012,9.877) | -1.292 | -23.75 |
| 3 | 1.800 | 7.400 | Type I(J) | Beta(0.932,19.68) | -5.535 | 67.11 |
| 4 | -1.300 | 3 | Type I(U) | Beta(0.083,0.284) | 1.021 | -11.20 |
| 5 | 0 | 2.100 | Type II | Beta(1.833,1.833) | -11.30 | 21.60 |
| 6 | -2.008 | 9.050 | Type III | Gamma, shape parameter = 0.992 | 6.475 | -6.025 |
| 7 | 0.100 | 6 | Type IV | Alpha = -0.189, m = 3.5075 | 0.972 | 14.02 |
| 8 | -1.042 | 5.150 | Type V | Inverse gamma, shape parameter = 18.67 | 35.16 | -577.0 |
| 9 | 1.700 | 8.600 | Type VI | F(DF1=8.262,DF2=24.34) | -11.41 | 13.69 |
| 10 | 0 | 3.200 | Type VII | Students t, DF = 34 | 4.500 | 9.701 |
The ODS OUTPUT statement in the preceding PROC SIMSYSTEM code saves the parameters for this sequence of distributions in a data set named Parm. The following PROC PRINT code produces the selected contents of this data set shown in Output 31.5.3. As you can see, the exact numeric values of the parameters that describe each distribution in the Notes column are available in the Shap1Val and Shap2Val variables.
proc print data=Parm noobs;
var Family Notes Shap: Shift Scale;
run;
Output 31.5.3: Displayed and Hidden Pearson Distribution Parameters
| Family | Notes | Shap1Lab | Shap1Val | Shap2Lab | Shap2Val | Shift | Scale |
|---|---|---|---|---|---|---|---|
| Normal | . | . | -4.500 | 1 | |||
| Type I | Beta(1.012,9.877) | Alpha | 1.012230 | Beta | 9.876659 | -1.292 | -23.75 |
| Type I(J) | Beta(0.932,19.68) | Alpha | 0.931965 | Beta | 19.676731 | -5.535 | 67.11 |
| Type I(U) | Beta(0.083,0.284) | Alpha | 0.082609 | Beta | 0.284255 | 1.021 | -11.20 |
| Type II | Beta(1.833,1.833) | Alpha | 1.833333 | 1.833333 | -11.30 | 21.60 | |
| Type III | Gamma, shape parameter = 0.992 | Alpha | 0.991736 | . | 6.475 | -6.025 | |
| Type IV | Alpha = -0.189, m = 3.5075 | Alpha | -0.188789 | m | 3.507538 | 0.972 | 14.02 |
| Type V | Inverse gamma, shape parameter = 18.67 | Alpha | 18.666036 | . | 35.16 | -577.0 | |
| Type VI | F(DF1=8.262,DF2=24.34) | DF1 | 8.262265 | DF2 | 24.339921 | -11.41 | 13.69 |
| Type VII | Students t, DF = 34 | DF | 34.000000 | . | 4.500 | 9.701 |
As discussed in Parameter Values for Pearson Distributions, you can use the values of the Shap1Val and Shap2Val variables in DATA step code with the formulas given in Table 3 to compute random samples that have the specified moments, as shown in the following DATA step code:
%let N = 1000000;
data mylib.Parm; set Parm; run;
proc ds2 sessref=mysess;
data Sim / overwrite=yes;
dcl int i;
dcl double y;
method run();
set Parm;
streaminit(15531);
do i=1 to &N;
select (trim(left(Family)));
when ('Type I' )
when ('Type I(J)')
when ('Type I(U)') y = rand('beta' ,Shap1Val,Shap2Val);
when ('Type II' ) y = rand('beta' ,Shap1Val,Shap1Val);
when ('Type III' ) y = rand('gamma' ,Shap1Val);
when ('Type IV' ) y = .;
when ('Type V' ) y = 1/rand('gamma' ,Shap1Val);
when ('Type VI' ) y = rand('f' ,Shap1Val,Shap2Val);
when ('Type VII' ) y = rand('t' ,Shap1Val);
when ('Normal' ) y = rand('normal');
end;
y = Scale*y + Shift;
output;
end;
end;
enddata;
run;
quit;
The following code computes and displays (in Output 31.5.4) the first four moments for each distribution sampled by the preceding PROC DS2 code. These moments match the specified ones reasonably well.
proc mdsummary data=mylib.Sim;
var y;
groupby Family Notes Mean StdDev Skewness Kurtosis;
output out=mylib.Sim_summary;
run;
proc cas;
session mysess;
table.alterTable /
name="Sim_summary"
columns={
{name="_Mean_" rename="sMean"},
{name="_Std_" rename="sStdDev"},
{name="_Skewness_" rename="sSkewness"},
{name="_Kurtosis_" rename="sKurtosis"}
};
table.update /
table="Sim_summary"
set={{var="sKurtosis" value="sKurtosis + 3"}};
quit;
proc sort data=mylib.Sim_summary out=Sim_summary; by Family; run;
proc print data=Sim_summary noobs;
var Family Mean sMean StdDev sStdDev Skewness sSkewness Kurtosis sKurtosis;
format _NUMERIC_ 6.3;
run;
Output 31.5.4: Moments for PROC DS2 Samples
| Family | Mean | sMean | StdDev | sStdDev | Skewness | sSkewness | Kurtosis | sKurtosis |
|---|---|---|---|---|---|---|---|---|
| Normal | -4.500 | -4.501 | 1.000 | 1.000 | 0.000 | 0.002 | 3.000 | 2.997 |
| Type I | -3.500 | -3.498 | 2.000 | 2.000 | -1.500 | -1.503 | 5.700 | 5.709 |
| Type I(J) | -2.500 | -2.505 | 3.000 | 2.995 | 1.800 | 1.799 | 7.400 | 7.389 |
| Type I(U) | -1.500 | -1.504 | 4.000 | 4.003 | -1.300 | -1.297 | 3.000 | 2.990 |
| Type II | -0.500 | -0.503 | 5.000 | 5.000 | 0.000 | -0.001 | 2.100 | 2.098 |
| Type III | 0.500 | 0.502 | 6.000 | 5.998 | -2.008 | -2.004 | 9.050 | 8.997 |
| Type IV | 1.500 | . | 7.000 | . | 0.100 | . | 6.000 | . |
| Type V | 2.500 | 2.499 | 8.000 | 7.995 | -1.042 | -1.038 | 5.150 | 5.118 |
| Type VI | 3.500 | 3.489 | 9.000 | 8.989 | 1.700 | 1.690 | 8.600 | 8.535 |
| Type VII | 4.500 | 4.486 | 10.000 | 10.002 | 0.000 | 0.001 | 3.200 | 3.192 |
Finally, for the Johnson system, the following code performs steps precisely like those shown earlier for the Pearson system, except that the moment combinations are chosen to represent the families of the Johnson system, as shown in Output 31.5.5 and Output 31.5.6:
%let Mean = -2 -1 0 1 2 ;
%let Stddev = 1 2 3 4 5 ;
%let Skew = -1.6 2.5 -1.2922847983 0 -0.7;
%let Kurt = 7.5 8.4 6.1093660061 3 7 ;
proc simsystem system=johnson;
moments mean=&Mean StdDev=&Stddev skew=&Skew kurt=&Kurt;
ods output Parameters=Parm;
run;
Output 31.5.5: Selected Johnson Distributions

Output 31.5.6: Parameters for Selected Johnson Distributions
| Parameters for Johnson Distributions | |||||||
|---|---|---|---|---|---|---|---|
| Skewness | Kurtosis | Family | Delta | Gamma | Shift | Scale | |
| 1 | -1.600 | 7.500 | SB(1) | 1.852 | 6.017 | -0.151 | -43.59 |
| 2 | 2.500 | 8.400 | SB(2) | 0.282 | 1.375 | -1.975 | 8.885 |
| 3 | -1.292 | 6.109 | SL | 2.548 | 7.351 | -6.806 | |
| 4 | 0 | 3 | SN | 1 | 4 | ||
| 5 | -0.700 | 7 | SU | 1.571 | -0.390 | 3.876 | -6.099 |
Turning to the Johnson system, as discussed in Parameter Values for Johnson Distributions, you can use the values of the Gamma and Delta columns of the "Parameters for Johnson Distributions" table in DATA step code with the formulas given in Table 5 to compute random samples that have the specified moments, as shown in the following code:
%let N = 1000000;
data mylib.Parm; set Parm; run;
proc ds2 sessref=mysess;
data Sim / overwrite=yes;
dcl int i;
dcl double y z;
method run();
set Parm;
streaminit(15531);
do i = 1 to &N;
z = rand('normal');
select (trim(left(Family)));
when ('SB(1)')
when ('SB(2)') y = 1/(1 + exp(-(z - Gamma)/Delta));
when ('SL' ) y = exp( z /Delta) ;
when ('SU' ) y = sinh( (z - Gamma)/Delta) ;
when ('SN' ) y = z ;
end;
y = Scale*y + Shift;
output;
end;
end;
enddata;
run;
quit;
proc mdsummary data=mylib.Sim;
var y;
groupby Family Mean StdDev Skewness Kurtosis;
output out=mylib.Sim_summary;
run;
proc cas;
session mysess;
table.alterTable /
name="Sim_summary"
columns={
{name="_Mean_" rename="sMean"},
{name="_Std_" rename="sStdDev"},
{name="_Skewness_" rename="sSkewness"},
{name="_Kurtosis_" rename="sKurtosis"}
};
table.update /
table="Sim_summary"
set={{var="sKurtosis" value="sKurtosis + 3"}};
quit;
proc sort data=mylib.Sim_summary out=Sim_summary; by Family; run;
proc print data=Sim_summary noobs;
var Family Mean sMean StdDev sStdDev Skewness sSkewness Kurtosis sKurtosis;
format _NUMERIC_ 6.3;
run;
As was the case with the Pearson system shown earlier, the moments for the samples that the PROC DS2 code computes, shown in Output 31.5.7, match the specified moments reasonably well.
Output 31.5.7: Moments for PROC DS2 Samples
| Family | Mean | sMean | StdDev | sStdDev | Skewness | sSkewness | Kurtosis | sKurtosis |
|---|---|---|---|---|---|---|---|---|
| SB(1) | -2.000 | -1.999 | 1.000 | 0.999 | -1.600 | -1.603 | 7.500 | 7.530 |
| SB(2) | -1.000 | -1.003 | 2.000 | 1.996 | 2.500 | 2.504 | 8.400 | 8.423 |
| SL | 0.000 | -0.000 | 3.000 | 3.000 | -1.292 | -1.294 | 6.109 | 6.142 |
| SN | 1.000 | 1.001 | 4.000 | 4.000 | 0.000 | -0.004 | 3.000 | 3.004 |
| SU | 2.000 | 2.000 | 5.000 | 4.998 | -0.700 | -0.709 | 7.000 | 6.978 |