Hi everybody,
I am trying to simulate Poisson data but not sure if I am doing it correctly.
I know that in a given population, an event occurs at a rate of 1.2 per year.
If I would like to simulate 1000 set of data each containing 50 patients, is this how the code should be written?
Thanks!
data Poisson;
call streaminit(4321);
lambda = 0.8;
do SimID = 1 to 1000;
do i = 1 to 50;
x = rand("Poisson", lambda);
output;
end;
end;
run;
I think you want to set lambda to 1.2 in your case:
data test;
do i=1 to 10000;
x=rand('poisson',1.2);
output;
end;
run;
proc univariate data=test noprint;
histogram x / midpoints=0 to 7 by 1;
inset mean median max / position=NE;
run;
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.