R语言#SI和SIS模型

#SI和SIS模型

install.packages("EpiModel",dependencies = TRUE)

library(EpiModel)

#SI

param <- param.dcm(inf.prob = 0.2,act.rate = 0.25)#疫情参数通过PARAM传递到模型中,并根据需要添加其他参数。

#inf.prob:易感人群和在感染者之间的每次传播行为的感染概率。act.rate:每个人在单位时间内的平均传播行为数。

init <- init.dcm(s.num = 500, i.num = 1)

#s.num 初始易感染数。i.num 初始感染数。

control <- control.dcm(type ="SI", nsteps = 500)#通过控件传递到模型中的控件设置,并根据需要添加其他控件。

#nsteps模拟模型的时间步数。这必须是等于模拟的最后一步的正整数。

mod <- dcm(param, init, control)

plot(mod)

#SIS

param <- param.dcm(inf.prob = 0.2,act.rate = seq(0.25, 0.5, 0.05), rec.rate = 0.02)

#rec.rate免疫的平均恢复率(在SIR模型中)或再易感性(在SIS模型中)。

init <- init.dcm(s.num = 500, i.num = 1)

control <- control.dcm(type ="SIS", nsteps = 500)

mod <- dcm(param, init, control)

plot(mod, col = rainbow(3), lty = rep(1:2,each = 3), legend = "full")

#运行Shiny web应用程序

if (interactive()) {

  epiweb("dcm")

  epiweb("icm")

  epiweb("net")

}

  • 7
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值