You are on page 1of 2

/*----------------------------------------SIMULATE AN INFECTIOUS PROCESS, KIND OF N Yiannakoulias ------------------------------------------*/ %let growth=0.

25;/*THE GROWTH RATE (0 to 1)*/ %let tmax=25;/*TIME THE ALGORITHM IS TO RUN*/ %let deviation=0.25;/*DETERMINES DISTANCE BETWEEN CHILD & PARENT POINTS (LARGER VALUE = GREATER DISTANCE)*/ %let seeds=3;/*NUMBER OF POINTS STARTING THE PROCESS*/ %let Nbias=0;/*BIAS THE SPREAD OF INFECTION IN A 'NORTH'(+) OR 'SOUTH'(-) DIRECTION*/ %let Ebias=0;/*BIAS THE SPREAD OF INFECTION IN A 'EAST'(+) OR 'WEST'(-) DIRECTION*/ data input; do id=1 to &seeds; v=1; /*SPREAD THE INITIAL POINTS AROUND A LITTLE!*/ x=ranuni(0)*4 + ranuni(0)*-4; y=ranuni(0)*4 + ranuni(0)*-4; output; end; run; goptions reset=global hsize=4in vsize=4in ftext=swissb; symbol1 value=dot height=.25 c=black; axis1 order=(-5 to 5 by 1) label=none; axis2 order=(-5 to 5 by 1) label=none; proc gplot; title height=1 "Time=0"; plot y*x=v/vaxis=axis1 haxis=axis2 nolegend; run; %macro repeat; %do i=1 %to &tmax; /*FOR EACH EXISTING POINT*/ data new; set input; if ranuni(0) <= &growth then do; v=2; x=x+(rannor(0)+&Ebias)*&deviation; y=y+(rannor(0)+&Nbias)*&deviation; output; end; run; data input; set input new; run; symbol1 value=dot height=.25 c=black; symbol2 value=dot height=.25 c=red; proc gplot; title height=1 "Time=&i."; plot y*x=v/vaxis=axis1 haxis=axis2 nolegend; run; quit; data input; set input; v=1; run;

%end; %mend; %repeat; run;

You might also like