Programming the statistical procedures from SAS

Fitting Poisson density function to a HISTOGRAM(SAS-9.2)

Reply
Super Contributor
Posts: 1,040

Fitting Poisson density function to a HISTOGRAM(SAS-9.2)


Hi everyone,

I am new to this forum. I have been learning SAS for 6 months now. I work in  a university. My Question is:

I have two variables:

1)Length of stay

2)specific codes(example : 500, 501 etc)

and for each code there are many patients whose length of stay varies like shown below.

example:

LOS(days)  Code

4                  500

3                  500

7                  501`

2                  200

8                  501

10                501

12                501

etc

etc..........

The question is to make a histogram for LOS(on X-axis) and fit the distribution into a poisson density function and determine Lambda.

I tried to google some information and could not find a solution to this on SAS 9.2 version....

Could you help me in building the code please

SAS Employee
Posts: 240

Re: Fitting Poisson density function to a HISTOGRAM(SAS-9.2)

You can use PROC GENMOD to estimate the poisson mean (lambda).  For example, using the portion of data you provided:

data a;

input LOS  Code;

datalines;

4                 500

3                 500

7                 501

2                 200

8                 501

10                501

12                501

;

proc genmod;

   model los = / dist=poisson;

   estimate 'lambda' intercept 1;

   run;

The intercept reported (1.8827) is the estimated log mean.  So, exp(1.8827)=6.57 is the estimated poisson mean.  Assuming you'll want a confidence interval, the ESTIMATE statement merely repeats the estimate of the intercept which provides the mean estimate and confidence limits (4.92, 8.77).

A histogram of the observed data can be done using the HISTOGRAM statement in PROC UNIVARIATE:

proc univariate noprint;

var los;

hist los;

run;

Super Contributor
Posts: 1,040

Re: Fitting Poisson density function to a HISTOGRAM(SAS-9.2)

Thanks for your help Dave,

After i fit the poisson density how can i find the chi sqaure goodness of fit on that?

SAS Super FREQ
Posts: 3,540

Re: Fitting Poisson density function to a HISTOGRAM(SAS-9.2)

Ask a Question
Discussion stats
  • 3 replies
  • 634 views
  • 0 likes
  • 3 in conversation