BookmarkSubscribeRSS Feed
robertrao
Quartz | Level 8


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

3 REPLIES 3
StatDave
SAS Super FREQ

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;

robertrao
Quartz | Level 8

Thanks for your help Dave,

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

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 2250 views
  • 0 likes
  • 3 in conversation