Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

solve using MATLAB. show code. INTRODUCTION Epidemics of infectious diseases hav

ID: 3756367 • Letter: S

Question

solve using MATLAB. show code.

INTRODUCTION Epidemics of infectious diseases have afflicted and perplexed humans throughout history. Infectious diseases, and the epidemics they cause, come and go, and humans cope with them in different ways, but the fear and confusion over new infectious diseases, such as AIDS, and even measles, is an ancient pattern we have seen many times before Centuries ago, human efforts to combat epidemics focused on avoidance (or elimination) of active cases. Next came treatment of active cases, and within the last two hundred years, scientific advances made possible prevention of certain diseases by means of vaccines. But it was not until this century that people started to study the epidemic process itself - understanding the pattern of how diseases spread through a population. This field of study is known as "epidemiology" and it is found mainly in medical schools and the Center for Disease Control in Atlanta. A measles epidemic in an elementary school offers a good example of questions epidemiology ties to answer Suppose a school has 500 students. Some of the students are immune to measles because they have already had measles or because they have been vaccinated. The remaining students are susceptible to measles and are referred to as "susceptibles." In this example, let's suppose there are 40 immunes and 400 susceptibles. If we introduce an active case of measles into this school, what patter, if any, will the epidemic follow? In other words, if the principal asks us how many students will be absent on the fourth day of the measles epidemic, what should we tell him/her? How many children will not contract measles during this epidemic To help answer such questions, two medical researchers at John's Hopkins University, Lowell Reed and Wade Hampton Frost, developed a mathematical model to describe accurately how diseases spread through populations Their model, developed in the 1920's, has come to be known as the "Reed-Frost Epidemic Model." Their purpose in developing this model was to sensitize medical students to the variability of the epidemic process. Neither Reed nor Frost through their model worthy of publication, so the model is described by another author (Abbey) as follows: The infection is spread directly from infected individuals to others by a certain kind of contact ("adequate" or "effective" contact) and in no other way Any susceptible individual in the group, after such contact with an infectious person in a given period will develop the infection and will be infectious to others only within the following time period, after which he (she) is wholly immune Each individual has a fixed probability of coming into adequate contact with any other specified individual in the group within one time interval, and this probability is the same for every member of the group The individuals are wholly segregated from others outside the group These conditions remain constant during the epidemic. In other words, each individual in the study population is in one of three possible states during any time period These are: 1. active case state 2. susceptible state 3. immune state Active cases always change to the immune state in subsequent time periods. Immune individuals remain immune and are sometimes omitted from consideration. Susceptible individuals change to active cases if and only if they come into "effective contact" with active cases

Explanation / Answer

% clear; close all

profile on

%Transmission network generation

k=5;

N=500;

g=1;

tic

% T=make_homogeneous_symmetric_network(N,k);%note that this does not always converge to a

solution

% T=make_random_network(N,k);%

% T=make_lattice_network(M,N);

% T=make_scale_free(N,k); %k is min number contacts per individual

% T=make_small_world;

% Predicted_R0=tau*k/g

No_sims=2000;

outMat=[];

tau=[.31];

no_trials=length(tau);

Frac_take=zeros(2,length(tau));

for i=1:no_trials

T=T~=0;

T=tau(i).*T;

FracTake=SIS_frac_sim(T,g,No_sims);

Frac_take(:,i)=[tau(i); FracTake];

end

Frac_take

toc

profile off

function FracTake=SIS_frac_sim(T,g,No_sims)

Fail_Vec=[]; I0=randsample(length(T(:,1)),1);

for i=1:No_sims

Fail=simulate(T,I0,g);

Fail_Vec=[Fail_Vec Fail];

FracTake=(length(Fail_Vec)-sum(Fail_Vec))/length(Fail_Vec);

end

function Fail=simulate(T,I0,g)

Fail=[]; No=length(T(:,1));

I_vec=zeros(1,No);I_vec(I0)=1;

S_vec=ones(1,No);S_vec(I0)=0;

S_tot=sum(S_vec);I_tot=sum(I_vec);

M=I_vec*T; P_vec=S_vec.*M; P=max(sum(P_vec),eps);

current_time=0; infection_time=current_time+exprnd(1/P);

R=max(g*sum(I_vec),eps); recovery_time=current_time+exprnd(1/R);

event=0; t_max=1000; I_max=20;

while I_tot<I_max

event=event+1;

if I_tot>0

%find next event

[time_to_next_event,event_type]=min([infection_time,recovery_time,t_max+1]);

current_time=time_to_next_event;

if event_type==1 %infection

A=P_vec/P;

edges=[0,cumsum(A)];

[F,farm_index]=histc(rand,edges);

S_vec(farm_index)=0; I_vec(farm_index)=1;

M=M+T(farm_index,:);

P_vec=max(S_vec.*M,0); P=max(sum(P_vec),eps);

infection_time=current_time+exprnd(1/P);

R=max(g*sum(I_vec),eps);

recovery_time=current_time+exprnd(1/R);

S_tot=S_tot-1; I_tot=I_tot+1;

elseif event_type==2 %recovery

A=I_vec/sum(I_vec);

edges=[0,cumsum(A)];

[F,farm_index]=histc(rand,edges);

I_vec(farm_index)=0; S_vec(farm_index)=1;

M=M-T(farm_index,:);

P_vec=max(S_vec.*M,0); P=max(sum(P_vec),eps);

infection_time=current_time+exprnd(1/P);

R=max(g*sum(I_vec),eps);

recovery_time=current_time+exprnd(1/R);

I_tot=I_tot-1; S_tot=S_tot+1;

end

else

Fail=1;

return

end

end

if I_tot==I_max; Fail=0; end

Reed-forst epidemic

n=66

p=.066

sick = 1;

SIR = zeros(1,n+1);

x = 0:n;

tau = 0;

healthy=n+1; %number of healthy people

while healthy > 1 && sick>0 %run while there are sick & healthy people

for Sz = 0:x(healthy); %potential number of people who don't get sick

SIR(1, Sz+1) = [nchoosek(x(healthy), Sz) * (1-p)^(sick*Sz) * (1-(1-p)^sick)^(x(healthy)-Sz)] ;

end

SIR(1, x(healthy)+2:end) = zeros(1,length(SIR(1, x(healthy)+2:end))); %delete old probabilities

cdf = cumsum(SIR(1,:));

u = rand;

healthy = 1;

while cdf(healthy) <= u %choose an new number of healthy people according to trans.prob

healthy = healthy+1;

end

x(healthy) %new number of healthy people in population +1

sick = size(find(SIR),2) - x(healthy) %new number of sick people

tau = tau + 1;

end