Title: | Inference for Infectious Disease Transmission in SIR Framework |
Version: | 1.2.1 |
Description: | Model and estimate the model parameters for the spatial model of individual-level infectious disease transmission in Susceptible-Infected-Recovered (SIR) framework. |
License: | MIT + file LICENSE |
Encoding: | UTF-8 |
RoxygenNote: | 7.3.1 |
LazyData: | true |
Suggests: | knitr, rmarkdown, testthat (≥ 3.0.0) |
Config/testthat/edition: | 3 |
Imports: | mvtnorm, psych, stats,MASS,numDeriv,Matrix |
Depends: | R (≥ 2.10) |
NeedsCompilation: | no |
Packaged: | 2024-06-04 16:28:29 UTC; ruwan |
Author: | Ruwani Herath [aut, cre], Leila Amiri [ctb], Mahmoud Torabi [ctb] |
Maintainer: | Ruwani Herath <ruwanirasanjalih@gmail.com> |
Repository: | CRAN |
Date/Publication: | 2024-06-04 17:30:14 UTC |
Area level data
Description
The data which describes the sociodemographic characters (proportion of indigenous people, proportions of immigrants, proportion of low education, median household income) for 96 regions.
Usage
Area_Level_Data
Format
A data frame with 96 rows and 5 columns:
- RHDA
Region name
- Percentage_of_immigrants
percentage of immigrants in each region
- Percentage_of_indigenous
percentage of indigenous people in each region
- Proporton_of_Low_education
proportion of persons 15+ who have not graduated high school
- Income
median household income
...
Individual level data
Description
The data which describes the Individual characteristics (gender, age group, infected status) and corresponding area details for 700 individuals.
Usage
Individual_Level_Data
Format
A data frame with 700 rows and 8 columns:
- Disease_Status
Disease status of the individual
- Region
The regioal health authority of the individual
- Gender
Gender of the individual
- Age_Group
Age group of the individual
- Postal_code
postal code which the individual belong to
- Longitde
longitude of the region
- Latitude
latitude of the region
- Region_Number
Region number assigned for each regional health authority
...
This function is used to estimate model parameters
Description
This function is used to estimate model parameters
Usage
Realdata_Finalmodel(
ITER,
zz,
lambda0,
sigma0,
Di,
D,
n,
time,
tau,
lambda,
alpha0,
q1,
q2,
cov1,
cov2,
phi,
delta0,
Nlabel,
npar,
I
)
Arguments
ITER |
Number of iterations |
zz |
Number of Regions |
lambda0 |
Spatial dependence |
sigma0 |
precision |
Di |
Euclidean distance between susceptible individual and infectious individual |
D |
Neighborhood structure |
n |
total number of individuals |
time |
time |
tau |
tau |
lambda |
lambda ### |
alpha0 |
intercept |
q1 |
Number of variables corresponding to individual level data |
q2 |
Number of variables corresponding to area level data |
cov1 |
Individual level covariates |
cov2 |
Area level covariates |
phi |
Spatial random effects |
delta0 |
Spatial parameter |
Nlabel |
Label for each sample from the area |
npar |
number of parameters |
I |
Identity matrix |
Value
Numerical values for estimates
Examples
Realdata_Finalmodel(2,4,0.2,0.5,
matrix(runif(400,min = 4,max = 20),nrow=20, byrow = TRUE),
matrix(c(0,-1,0,-1,-1,0,-1,-1,0,-1,0,-1,-1,-1,-1,0),nrow=4,byrow=TRUE),20,10,
sample(c(0,1),replace = TRUE, size = 20),rep(3,20),0.4,6,5,
matrix(runif(120, 0, 1),nrow=20,byrow=TRUE),
matrix(runif(20, 0, 1),nrow=4,byrow=TRUE),runif(4,min = 0, max = 1),2,
rep(1:4,each=5),15,diag(4))
Calculating the estimated values for the parameters using log-likelihood function
Description
Calculating the estimated values for the parameters using log-likelihood function
Usage
Sim_Estpar(
Nlabel,
phi,
Di,
alpha1,
delta,
lambda1,
sigma1,
beta1,
beta2,
zz,
time,
n,
tau,
lambda,
I,
D,
cov1,
cov2
)
Arguments
Nlabel |
Label for each sample from the area |
phi |
Spatial random effects |
Di |
Euclidean distance between susceptible individual and infectious individual |
alpha1 |
intercept |
delta |
Spatial parameter |
lambda1 |
Spatial dependence |
sigma1 |
precision of spatial random effects |
beta1 |
the parameter corresponding to the covariate associated with susceptible individual |
beta2 |
the parameter corresponding to the covariate associated with area |
zz |
Number of areas |
time |
Time |
n |
Total number of individuals |
tau |
the set of infectious individuals at time t in the zth area |
lambda |
a vector containing the length of infectious period |
I |
identity matrix |
D |
Neighborhood structure |
cov1 |
Individual level covariates |
cov2 |
Area level covariates |
Value
a list of the solutions for the estimations of the parameters
Examples
Sim_Estpar(rep(1:4,each=5),runif(4,min = 0, max = 1),
matrix(runif(400,min=4,max=20),nrow=20,byrow = TRUE),0.4,3,0.2,0.5,1,1,4,10,
20,sample(c(0,1),replace = TRUE, size = 20),rep(3,20),diag(4),
matrix(c(0,-1,0,-1,-1,0,-1,-1,0,-1,0,-1,-1,-1,-1,0),nrow=4,byrow=TRUE),
runif(20, 0, 1),runif(4, 0, 1))
This function calculates the value of the log-likelihood function
Description
This function calculates the value of the log-likelihood function
Usage
Sim_Loglik(
Nlabel,
phi,
Di,
alpha1,
delta,
lambda,
sigma1,
beta1,
beta2,
time,
n,
zz,
tau,
lambda1,
I,
D,
cov1,
cov2
)
Arguments
Nlabel |
Label for each sample from the area |
phi |
Spatial random effects |
Di |
Euclidean distance between susceptible individual and infectious individual |
alpha1 |
intercept |
delta |
Spatial parameter |
lambda |
a vector containing the length of infectious period |
sigma1 |
precision of spatial random effects |
beta1 |
the parameter corresponding to the covariate associated with susceptible individual |
beta2 |
the parameter corresponding to the covariate associated with area |
time |
time |
n |
Total number of individuals |
zz |
Number of areas |
tau |
the set of infectious individuals at time t in the zth area |
lambda1 |
Spatial dependence |
I |
Identity matrix |
D |
matrix reflecting neighborhood structure |
cov1 |
Individual level covariates |
cov2 |
Area level covariates |
Value
a numeric value for the log-likelihood
Examples
Sim_Loglik(rep(1:4,each=5), runif(4,min = 0, max = 1),
matrix(runif(400,min=4,max=20),nrow=20,byrow=TRUE),0.4, 2,rep(3,20),0.5,1,1,
10,20,4,sample(c(0,1),replace = TRUE, size = 20),0.6,diag(4),
matrix(c(0,-1,0,-1,-1,0,-1,-1,0,-1,0,-1,-1,-1,-1,0),nrow=4,byrow=TRUE),
runif(20, 0, 1), runif(4, 0, 1))
This function can use to estimate the model parameters using the initial values.
Description
This function can use to estimate the model parameters using the initial values.
Usage
Simulation_Finalmodel(
ITER,
zz,
lambda0,
sigma0,
Di,
g,
nSample,
d,
n,
time,
tau,
lambda,
alpha0,
beta10,
beta20,
cov1,
cov2,
phi,
delta0,
Nlabel,
D,
I
)
Arguments
ITER |
Number of iterations |
zz |
Number of Regions |
lambda0 |
initial value for Spatial dependence |
sigma0 |
initial value for the precision of spatial random effects |
Di |
Euclidean distance between susceptible individual and infectious individual |
g |
Number of rows in the lattice |
nSample |
Number of individuals in each cell |
d |
infectious time units |
n |
total number of individuals |
time |
time |
tau |
the set of infectious individuals at time t in the zth area |
lambda |
a vector containing the length of infectious period |
alpha0 |
initial value for the intercept |
beta10 |
initial value for the parameter corresponding to the covariate associated with susceptible individual |
beta20 |
initial value for the parameter corresponding to the area-level covariates corresponding to area |
cov1 |
a vector of covariates associated with susceptible individual |
cov2 |
a vector of area-level covariates corresponding to area |
phi |
Spatial random effects |
delta0 |
Spatial parameter |
Nlabel |
Label for each sample from the area |
D |
matrix reflecting neighborhood structure |
I |
Identity matrix |
Value
the estimated values for the model parameters
Examples
Simulation_Finalmodel(2,4,0.2,0.5,
matrix(runif(1600,min=4,max=20),nrow=40,byrow=TRUE),2,10,3,40,10,
sample(c(0,1),replace=TRUE,size=40),rep(3,40),0.4,1,1,runif(40,0,1),
runif(4,0,1),runif(4,min=0,max=1),2,rep(1:4,each=10),
matrix(c(0,-1,0,-1,-1,0,-1,-1,0,-1,0,-1,-1,-1,-1,0),nrow=4,byrow=TRUE),
diag(4))
TwoWeek
Description
The simulated data for the date diagnosed and tau
Usage
TwoWeek
Format
A data frame with 700 rows and 2 columns:
- date_diagnosed
The date which the disease diagnosed
- V2
the week
...