SMC Procedure

Distribution Argument Restriction

In the AUXMODEL, MODEL, INITSTATE, and STATE statements, the distribution-arguments are specified by expressions that must follow any SAS programming statements. In practice, the evaluation of the distribution-arguments can have computation errors even though they are specified correctly. The reason why the computation errors exist is that the SMC methods are based on simulations and the state variables can have extreme values. In most cases, the errors result from two circumstances: the support restriction of a specific function and the parameter restriction of a specific distribution. For example, the following statements contain the expressions that can cause computation errors of the function support restriction:

state x1 ~ normal(x1.l1, 1);
state x2 ~ normal(x2.l1, 1);
state x3 ~ normal(log(x1), sqrt(x2));

where x1, x2, and x3 are state variables. The LOG and SQRT functions both require a positive argument. However, x1 or x2 is drawn from a normal distribution, so there is likely to be a negative x1 or x2 value in the simulation within the SMC method. To avoid the computation error, you can add the IFN function to the third statement as follows:

state x3 ~ normal(log(ifn(x1>0.01,x1,0.01)), sqrt(ifn(x2>0.01,x2,0.01)));

All the arguments to the IFN function are evaluated before the function is called, and the results of the evaluation are then passed to the function. The following statement can still have computation errors even though it appears to have the same logic as the previous statement:

state x3 ~ normal(ifn(x1>0.01,log(x1),log(0.01)), sqrt(ifn(x2>0.01,x2,0.01)));

The following statements contain the expressions that can cause computation errors of the parameter restriction:

state x1 ~ normal(x1.l1, 1);
state x2 ~ lognormal(x1, 1);
state x3 ~ poisson(x1);

where x1, x2, and x3 are state variables. The Poisson distribution asks for a nonnegative parameter, but a negative x1 value can be drawn from a specific distribution. Moreover, an overflow error can occur when you draw a new sample from the lognormal distribution if the x1 value is quite large. To avoid the computation error, you can add the IFN function as follows:

state x2 ~ lognormal(ifn(x1<500,x1,500), 1);
state x3 ~ poisson(ifn(x1<0,0,x1));

Whether the adjustment is necessary or what the format of the adjustment is must depend on the distribution-arguments of a specific distribution.

Last updated: July 09, 2026