Skip to content

Buynak-Yingying Submission#7

Open
mbuynak wants to merge 10 commits into
lyy005:masterfrom
mbuynak:master
Open

Buynak-Yingying Submission#7
mbuynak wants to merge 10 commits into
lyy005:masterfrom
mbuynak:master

Conversation

@mbuynak

@mbuynak mbuynak commented Nov 10, 2017

Copy link
Copy Markdown

No description provided.

Comment thread Tutorial Q1 Part B
params=(0.3,10)
N0=[1]
times=range(0,100)
ks=["0,10","0,50","0,100"]

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ks=[10,50,100]

Comment thread Tutorial Q1 Part B
N0=[1]
times=range(0,100)
ks=["0,10","0,50","0,100"]
r=[0.2]

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r=0.2

Comment thread Question 2
beta=0.0005
gamma=0.05
#time (days)
t = np.linspace(0, 500, 500)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Set t = 0 to 500?
t = np.linspace(0, 500, 501)

Comment thread Question 2
print('iList', iList)
print('rList', rList)
print('newIList', newIList)

@lyy005 lyy005 Nov 28, 2017

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Define the function:
def simSIR(y,t,beta,gamma):
S=y[0]
I=y[1]
R=y[2]
dSdt=-betaIS
dIdt=betaIS-gammaI
dRdt=gamma
I
return [dSdt,dIdt,dRdt]

Define the parameters:
y0=[999,1,0]
times=range(0,500)

betas=numpy.array([0.0005,0.005,0.0001,0.00005,0.0001,0.0002,0.0001])
gammas=numpy.array([0.05,0.5,0.1,0.1,0.05,0.05,0.06])

Make a new dataframe to store the parameters:
storeSIR=pandas.DataFrame({"beta":betas,"gamma":gammas,"R0":betas*sum(y0)/gammas,"maxIncidence":0,"maxPrevalence":0,"percentAffected":0})

Using the for loop to simulate:
for i in range(0,len(betas)):
pars=(betas[i],gammas[i])
sim=si.odeint(func=simSIR,y0=y0,t=times,args=pars)
storeSIR.iloc[i,4]=numpy.max(sim[:,1]/numpy.sum(sim,axis=1))
storeSIR.iloc[i,3]=numpy.max(sim[1:len(sim),1]-sim[0:(len(sim)-1),1])
storeSIR.iloc[i,5]=numpy.sum(sim[len(sim)-1,1:3])/numpy.sum(sim[len(sim)-1,:])*100

-0.5 pts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants