Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
The MODEL Procedure

Example 4.1: Cauchy Distribution Estimation

In this example a nonlinear model is estimated using the Cauchy distribution. Then a simulation is done for one observation in the data.

The following DATA step creates the data for the model.

       /* Generate a Cauchy distributed Y */
data c;
 format date monyy.;
 call streaminit(156789);
 do t=0 to 20 by 0.1;
    date=intnx('month','01jun90'd,(t*10)-1);
    x=rand('normal');
    e=rand('cauchy') + 10 ;
    y=exp(4*x)+e;
    output;
    end;
run;

The model to be estimated is

y &=& e^{-ax} + \epsilon \ \epsilon &\sim& {\rm Cauchy} ( nc )
That is, the residuals of the model are distributed as a Cauchy distribution with noncentrality parameter nc.

The log likelihood for the Cauchy distribution is

like=-\log(1+(x-nc)^2 * \pi)

The following SAS statements specify the model and the log-likelihood function.

title2 'Cauchy Distribution';

proc model data=c ;
 dependent y;

 parm a -2 nc 4;

 y=exp(-a*x);
 
       /* Likelihood function for the residuals */
 obj = log(1+(-resid.y-nc)**2 * 3.1415926);

 errormodel y ~ general(obj) cdf=cauchy(nc); 

 fit y / outsn=s1 method=marquardt;
 solve y / sdata=s1 data=c(obs=1) random=1000 
          seed=256789 out=out1;
run;

The FIT statement uses the OUTSN= option to put out the \Sigma matrix for residuals from the normal distribution. The \Sigma matrix is 1×1 and has value 4.65824. The OUTS= matrix is the scalar 2989.0. Because the distribution is univariate (no covariances), the OUTS= would produce the same simulation results. The simulation is performed using the SOLVE statement.

The distribution of y is shown in Output 4.1.1.

Output 4.1.1: Distribution of Y
cauchy.gif (3236 bytes)

Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
Top
Top

Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.