{"id":32206567,"url":"https://github.com/waleedalmutiry/epiilmct","last_synced_at":"2026-02-21T18:04:42.477Z","repository":{"id":56934812,"uuid":"113414904","full_name":"waleedalmutiry/EpiILMCT","owner":"waleedalmutiry","description":"Continuous Time Distance-Based and Network-Based Individual Level Models for Epidemics","archived":false,"fork":false,"pushed_at":"2020-01-21T21:51:21.000Z","size":474,"stargazers_count":6,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-08T21:45:10.566Z","etag":null,"topics":["bayesian-inference","cran","distance","epidemic-data","epidemics","infectious-disease-models","kerneltype","network","package","plots","r"],"latest_commit_sha":null,"homepage":"https://CRAN.R-project.org/package=EpiILMCT","language":"Fortran","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/waleedalmutiry.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-12-07T07:00:14.000Z","updated_at":"2022-03-03T15:02:56.000Z","dependencies_parsed_at":"2022-08-21T01:10:11.782Z","dependency_job_id":null,"html_url":"https://github.com/waleedalmutiry/EpiILMCT","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/waleedalmutiry/EpiILMCT","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waleedalmutiry%2FEpiILMCT","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waleedalmutiry%2FEpiILMCT/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waleedalmutiry%2FEpiILMCT/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waleedalmutiry%2FEpiILMCT/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/waleedalmutiry","download_url":"https://codeload.github.com/waleedalmutiry/EpiILMCT/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waleedalmutiry%2FEpiILMCT/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29689644,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-21T15:51:39.154Z","status":"ssl_error","status_checked_at":"2026-02-21T15:49:03.425Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bayesian-inference","cran","distance","epidemic-data","epidemics","infectious-disease-models","kerneltype","network","package","plots","r"],"created_at":"2025-10-22T05:31:21.430Z","updated_at":"2026-02-21T18:04:42.471Z","avatar_url":"https://github.com/waleedalmutiry.png","language":"Fortran","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://user-images.githubusercontent.com/18523406/64814142-92c4b680-d5ab-11e9-8c82-c15090a9d358.jpg\" width=\"35%\"\u003e\n\u003c/p\u003e\n\n# EpiILMCT: Continuous Time Distance-Based and Network-Based Individual Level Models for Epidemics\n\n[![CRAN_Status_Badge](https://www.r-pkg.org/badges/version/EpiILMCT)](https://cran.r-project.org/package=EpiILMCT)\n[![Downloads](https://cranlogs.r-pkg.org/badges/EpiILMCT)](https://cran.r-project.org/package=EpiILMCT)\n[![Licence](https://img.shields.io/badge/licence-GPL--3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0.en.html)\n[![Rdoc](http://www.rdocumentation.org/badges/version/EpiILMCT)](https://www.rdocumentation.org/packages/EpiILMCT/versions/1.1.6.html)\n\nThe **R** package **EpiILMCT** provides tools for simulating from continuous-time individual level models of disease transmission, and carrying out infectious disease data analyses with the same models. The epidemic models considered are distance-based and contact network-based models within Susceptible-Infectious-Removed (SIR) or Susceptible-Infectious-Notified-Removed (SINR) compartmental frameworks.\n\n## Installing\nYou can install the **EpiILMCT** version from\n[CRAN](https://cran.r-project.org/package=EpiILMCT).\n\n```s\ninstall.packages('EpiILMCT', dependencies = TRUE)\n```\n\nYou can install the **development** version from\n[Github](https://github.com/waleedalmutiry/EpiILMCT-package)\n\n```s\n# install.packages(\"devtools\")\ndevtools::install_github(\"waleedalmutiry/EpiILMCT-package\")\n```\n\n\n## Features\n### Simulation\n#### Contact network\nDifferent types of undirected unweighted contact networks can be generated through the function **_contactnet_**. This function function has a 'type' option to specify the type of network to be used. It has three available options (\"powerlaw\", \"Cauchy\", and \"random\") for the network model, where the first two options simulate spatial contact networks in which the probability of connections between individuals are based on required XY coordinate input. The output of this function is stored as an object of class 'contactnet'. Also, an S3 method plot function is introduced which uses this object as its input to provide a fancy plot of the contact network.  \n\n```s\nlibrary(EpiILMCT)\nset.seed(22)\n\n# to generate the XY coordinates of 50 individuals:\n\nloc\u003c- matrix(cbind(runif(50, 0, 10),runif(50, 0, 10)), ncol = 2, nrow = 50)\n```\n##### power-law spatial contact network\n```s\nnet1\u003c- contactnet(type = \"powerlaw\", location = loc, beta = 1.5, \n\tnu = 0.5)\nplot(net1)\n```\n##### Cauchy spatial contact network\n```s\nnet2\u003c- contactnet(type = \"Cauchy\", location = loc, beta = 0.5)\nplot(net2)\n```\n##### random contact network\n```s\nnet3\u003c- contactnet(type = \"random\", num.id = 50, beta = 0.08)\nplot(net3)  # the default options in igraph package.\nplot(net3, vertex.color = \"red\", vertex.size = 15, edge.color = \"black\",\nvertex.label.cex = 1, vertex.label.color = \"black\") \n```\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://user-images.githubusercontent.com/18523406/64754143-ae3dac00-d52e-11e9-81e6-5735046fd877.jpg\"\u003e \n\u003c/p\u003e\n\n#### Epidemic data:\n\nThe function **_datagen_** allows the user to generate epidemics from the continuous time ILMs under the SIR or SINR compartmental frameworks. This function can generate epidemics based on different kernels through the _kerneltype_ argument which takes one of three options: _\"distance\"_ for **distance-based**, _\"network\"_ for **network-based**, or _\"both\"_ for **distance and network-based**. The appropriate kernel matrix must also be provided via the **_kernelmatrix_** argument. If _\"distance\"_ is chosen as the **_kerneltype_**, the user must choose a spatial kernel (_\"powerlaw\"_ or _\"Cauchy\"_) through\nthe **_distancekernel_** argument. Here is an example of generating an epidemic from the SIR continuous time network-based ILM.\n\n```s\nlibrary(\"EpiILMCT\")\nset.seed(91938)\n\n# To simulate the XY coordinate of 50 individuals and their corresponding binary covariate values:\nloc \u003c- matrix(cbind(runif(50, 0, 10), runif(50, 0, 10)), ncol = 2, nrow = 50)\ncov \u003c- cbind(rep(1, 50), rbinom(50, 1, 0.5))\n\n# To simulate the contact network:\nnet \u003c- contactnet(type = \"powerlaw\", location = loc, beta = 1.8, nu = 1)\n\n# To simulate the epidemic:\nepi \u003c- datagen(type = \"SIR\", kerneltype = \"network\", kernelmatrix = net, suspar = c(0.08, 0.5), delta = c(4, 2), \n   suscov = cov)\n```\nThe output of the **_datagen_** function is stored as an _datagen_ object which takes a list of:\n1. type\n2. kerneltype\n3. epidat (event times)\n4. location (XY coordinates of individuals)\n5. network (contact network matrix), in the case of setting the **_kerneltype_** to _distance_, a zero contact network matrix will be created for the network option. \n\nThe package also contains an S3 method **_plot.datagen_** function, which illustrates disease spread through the epidemic timeline. This function can be used for either **_distance-based_** or **_network-based_** ILMs. The object of this function has to be of class _datagen_. The plot S3 function has a **_plottype_** argument that can be set to _\"history\"_, to produce epidemic curves of infection and removal times, or set to _\"propagation\"_ to produce plots of the epidemic propagation over time. The following commands are to produce the below two graphs for the generated epidemic above.\n\n```s\nplot(epi, plottype = \"propagation\", time.index = seq_len(6))\nplot(epi, plottype = \"history\")\n```\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://user-images.githubusercontent.com/18523406/72845059-df817200-3cae-11ea-99f6-bbd7e7082c6d.jpeg\"\u003e \n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://user-images.githubusercontent.com/18523406/72845058-df817200-3cae-11ea-8d49-6b40b312ab82.jpeg\"\u003e \n\u003c/p\u003e\n\n### Analyzing\n\nMetropolis-Hastings MCMC is performed to estimate the joint posterior of the model parameters and latent variables (the latter if various event times are assumed unknown). This is achieved using the function **_epictmcmc_**. The below figure illustrates the structure of most arguments of this function. \n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://user-images.githubusercontent.com/18523406/64754037-1a6be000-d52e-11e9-80c0-1864b828591f.jpg\"\u003e \n\u003c/p\u003e\n\n\nThe output of this function is an object of class _epictmcmc_. There are S3 methods: **_print.epictmcmc_**, **_summary.epictmcmc_** and **_plot.epictmcmc_** that depend on the **coda** package. The latter function produced the trace plots of the posterior distributions of the model parameters with the same options of the **_plot.mcmc_** function in the **coda** package, such as, _start_, _thin_, and _density_. An argument **_plottype_** needs to be specified to _parameter_ in order to get the above trace plots. Also, as the _parameter.samples_ in the object _epictmcmc_ is stored as an _mcmc_ object of the **coda** package, the **_plot.mcmc_** function in the **coda** package can be used directly using the input as the _parameter.samples_.\n\nIn the case of datatype is set to either _\"known removal\"_ (unknown infection times only) or _\"unknown removal\"_ (unknown infection and removal times), plots of the average posterior and 95% CI of the unobserved event times can also be produced through specifying the argument **_plottype_** to _inf.times_ or _rem.times_.\n\nThe class _epictmcmc_ contains the MCMC samples of the model parameters and the missing information (in case datatype is not set to _known epidemic_), and other useful information to be used in other functions such as the above S3 methods. For example, when **_datatype_** = _known epidemic_, the class _epictmcmc_ has a list contained the following:\n1. _\"compart.framework\"_\n2. _\"kernel.type\"_\n3. _\"data.assumption\"_\n4. _\"parameter.samples\"_\n5. _\"log.likelihood\"_\n6. _\"acceptance.rate\"_\n7. _\"number.iteration\"_\n8. _\"number.parameter\"_\n9. _\"number.chains\"_\n\nThe following commands are to perform the MCMC for analyzing the above epidemic data set using the **_epictmcmc_** function.\n\n```s\nsuscov \u003c- list(NULL)\nsuscov[[1]] \u003c- list(c(0.01, 0.1), matrix(c(\"gamma\", \"gamma\", 1, 1, 0.1, 0.1, 0.5, 1), ncol = 4, nrow = 2))\nsuscov[[2]] \u003c- cov\nmcmc1 \u003c- epictmcmc(object = epi, datatype = \"known epidemic\", nsim = 150000, control.sus = suscov)\n```\nThe estimates of the model parameters can be then obtained either through using S3 **_summary_** function of the **_epictmcmc_** for the _mcmc1_, or using the **_summary_** function of **coda** package for _mcmc1$parameter.samples_, for example. The posterior means and 95% credible intervals of the model parameters using the former **_summary_** can be obtained via the following command:\n\n```s\nsummary(mcmc1, start = 10000)\n********************************************************* \nModel: SIR network-based continuous-time ILM \nMethod: Markov chain Monte Carlo (MCMC) \nData assumption: fully observed epidemic \nnumber.chains : 1 chains \nnumber.iteration : 140000 iterations \nnumber.parameter : 2 parameters \n********************************************************* \n 1. Empirical mean and standard deviation for each variable,\nplus standard error of the mean:\n                Mean        SD    Naive SE Time-series SE\nAlpha_s[1] 0.0851393 0.0268787 7.18362e-05    0.000279848\nAlpha_s[2] 0.5090538 0.1284466 3.43287e-04    0.000936706\n 2. Quantiles for each variable:\n                2.5%       25%       50%      75%    97.5%\nAlpha_s[1] 0.0409208 0.0656406 0.0825226 0.101275 0.144555\nAlpha_s[2] 0.2820138 0.4187457 0.4997392 0.590065 0.783330\n 3. Empirical mean, standard deviation, and quantiles for the log likelihood,\n          Mean             SD       Naive SE Time-series SE \n  -55.80474998     1.01640137     0.00271644     0.00958428 \n    2.5%      25%      50%      75%    97.5% \n-58.5354 -56.1984 -55.4910 -55.0804 -54.8096 \n 4. acceptance.rate : \nAlpha_s[1] Alpha_s[2] \n  0.112127   0.223155 \n```\n\nThe MCMC trace plots for the model parameters can be produced using the S3 method **_plot.epictmcmc_** as follows:\n\n```s\nplot(mcmc1, plottype = \"parameter\", start = 10000, thin = 10, density = FALSE)\n```\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://user-images.githubusercontent.com/18523406/72844861-726ddc80-3cae-11ea-8fd3-577c01b09549.jpeg\" height=\"400\" width=\"75%\"\u003e \n\u003c/p\u003e\n\n## Built With\n\n* [R](https://cran.r-project.org) - The Comprehensive R Archive Network\n\n## Authors\n\n* **Waleed Almutiry** - *Author and Maintainer*\n* **[Rob Deardon](http://people.ucalgary.ca/~robert.deardon/)** - *Author*\n* **Vineetha Warriyar K. V.** - *Contributer*\n\n## License\n\nThis project is licensed under the GNU General Public License,  version 3 - see the (http://www.r-project.org/Licenses/GPL-3) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwaleedalmutiry%2Fepiilmct","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwaleedalmutiry%2Fepiilmct","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwaleedalmutiry%2Fepiilmct/lists"}