08-14-2012 03:28 PM
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.
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
08-30-2012 12:53 PM
You can use PROC GENMOD to estimate the poisson mean (lambda). For example, using the portion of data you provided:
input LOS Code;
model los = / dist=poisson;
estimate 'lambda' intercept 1;
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;
08-30-2012 01:17 PM
Thanks for your help Dave,
After i fit the poisson density how can i find the chi sqaure goodness of fit on that?