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
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;
Thanks for your help Dave,
After i fit the poisson density how can i find the chi sqaure goodness of fit on that?
See also this post: https://communities.sas.com/message/121955#121955
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.