chambers-yamasaki submission#6
Conversation
…bably figure out how to plot with multiple colors and a legend
… previous point about aesthetics of graph
… part as it says it is 2D and the graph needs to be 1D
| rates=rates+geom_line(store_rs,aes(y="r4")) | ||
| rates=rates+geom_line(store_rs,aes(y="r5")) | ||
|
|
||
| rates #Display the graph |
There was a problem hiding this comment.
Good job! If you want to color code each line, you can use:
ggplot(store_rs,aes(x="time",y="r1",color="10"))+geom_line(store_rs,aes(y="r2",color="50"))+geom_line(store_rs,aes(y="r3",color="100"))
|
|
||
| plt.figure(figsize=[6,4]) | ||
| plt.plot(t, solution[:, 0], label="S(t)") | ||
| plt.plot(t, solution[:, 1], label="I(t)") |
There was a problem hiding this comment.
What is the use of variable "solution" here?
| print("BasicReproductionNumber") | ||
| print(basicReproductionNumber) | ||
|
|
||
| print("!!! please see file named README for analysis completing question 2 !!!") |
There was a problem hiding this comment.
storeSIR=pandas.DataFrame({"beta":beta,"gamma":gamma,"R0":beta*sum(y0)/gamma,"maxIncidence":0,"maxPrevalence":0,"percentAffected":0}) . # make the data frame to store the three calculations
for i in range(0,len(betas)):
pars=(beta[i],gamma[i]) # loop through betas and gammas
sim=si.odeint(func=simSIR,y0=y0,t=times,args=pars) . # simulates SIRs
storeSIR.iloc[i,4]=numpy.max(sim[:,1]/numpy.sum(sim,axis=1)) # calculates the max prevalence
storeSIR.iloc[i,3]=numpy.max(sim[1:len(sim),1]-sim[0:(len(sim)-1),1]) # calculates the max incidence
storeSIR.iloc[i,5]=numpy.sum(sim[len(sim)-1,1:3])/numpy.sum(sim[len(sim)-1,:])*100 # calculates the max percentat affected
-0.25 pts
No description provided.