0% found this document useful (0 votes)
43 views2 pages

Simulation

This document simulates an infectious process over time. It sets parameters like the growth rate, maximum time, and deviation. It initializes seeds or starting points. At each time step, it checks if existing points will infect new points based on the growth rate. New points are placed near parents with some random noise. The process plots the points at each time step to visualize the spread of infection over the area.

Uploaded by

Vijaya Bhatt
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views2 pages

Simulation

This document simulates an infectious process over time. It sets parameters like the growth rate, maximum time, and deviation. It initializes seeds or starting points. At each time step, it checks if existing points will infect new points based on the growth rate. New points are placed near parents with some random noise. The process plots the points at each time step to visualize the spread of infection over the area.

Uploaded by

Vijaya Bhatt
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
You are on page 1/ 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