Chapter Contents Previous Next
 The MODEL Procedure

## General Likelihood Estimation and Simulation

The GENERAL option on the ERRORMODEL statement can be used to estimate distributions other than normal and t. The GENERAL option on the ERRORMODEL statement expects as its first argument a log-likelihood function.

When a general log-likelihood function is specified, a quasi-Newton method is used to find the minimum of the function. The standard errors are computed using the Hessian of the log-likelihood function at the solution. It is important to include all scale terms in the likelihood if correct standard errors are desired. The OUTS= data set is created from the cross of the residuals normalized according to the VARDEF= option. This S matrix is not normalized by any implied variance terms in the specified likelihood. This is important to consider if the S matrix is used in a Monte Carlo simulation.

For simulation and forecasting, the likelihood function is ignored. If Monte Carlo is requested, a CDF function can be specified using the CDF= option. If no CDF is specified, an empirical distribution with normal tails is used.

### Empirical Distribution Estimation and Simulation

For simulation, if the CDF for the model is not built in to the procedure, you can use the CDF=EMPIRICAL() option. This uses the sorted residual data to create an empirical CDF. For computing the inverse CDF the program needs to know how to handle the tails. For continuous data, the tail distribution is generally poorly determined. To counter this, the PERCENT= option specifies the percent of the observations to use in constructing each tail. The default for the PERCENT= option is 10.

A normal distribution or a t-distribution is used to extrapolate the tails to infinity. The standard errors for this extrapolation are obtained from the data so that the empirical CDF is continuous.

The following SAS statements fit a model using least squares as the likelihood function, but represent the distribution of the residuals with an empirical CDF. The plot of the empirical probability distribution is shown in Figure 4.2.

```data t;  /* Sum of two normals  */
format date monyy.;
do t=0 to 3 by 0.1;
date = intnx( 'month', '1jun90'd,(t*10)-1);
y =  (0.1 * rannor(123)-10) +
( .5 * rannor(456)+10);
output;
end;
run;

proc model data=t time=t itprint;
dependent y;
parm a 5 ;
y = a;
obj = resid.y * resid.y;
errormodel y ~ general( obj )
cdf=(empirical=( tails=( t(15) percent= 5)));

fit y / outns=s out=r;
id  date;
solve y / data=t(where=(date='1jun95'd ))
residdata=r sdata=s random=200 seed=6789 out=monte;
run;

/* Generate the pdf --------------------------*/
proc kde data =monte out=density;
var y;
run;

symbol1 value=none interpol=join;
proc gplot data=density;
plot density*y ;
run;
```

Figure 4.2: Empirical PDF Plot

 Chapter Contents Previous Next Top