clust_cp_epi {BayesChange}R Documentation

Clustering Epidemiological survival functions with common changes in time

Description

Clustering Epidemiological survival functions with common changes in time

Usage

clust_cp_epi(
  data,
  n_iterations,
  M,
  B,
  L,
  gamma = 1/8,
  alpha = 1,
  q = 0.1,
  dt = 0.1,
  a0 = 4,
  b0 = 10,
  c0 = 1,
  d0 = 1,
  MH_var = 0.01,
  S0 = 1,
  R0 = 0,
  p = 0.003,
  coars = 1,
  print_progress = TRUE,
  user_seed = 1234L
)

Arguments

data

a matrix where each entry is the number of infected for a population (row) at a specific discrete time (column).

n_iterations

Second value

M

number of Monte Carlo iterations when computing the likelihood of the survival function.

B

number of orders for the normalisation constant.

L

number of split-merge steps for the proposal step.

gamma

recovery rate fixed constant for each population at each time.

alpha

\alpha for the acceptance ration in the split-merge procedure.

q

probability of performing a split when updating the single order for the proposal procedure.

dt, a0, b0, c0, d0

parameters for the computation of the integrated likelihood of the survival functions.

MH_var

variance for the Metropolis-Hastings estimation of the proportion of infected at time 0.

S0, R0

parameters for the SDE solver.

p

prior average number of change points for each order.

coars

coarsening parameter.

print_progress

If TRUE (default) print the progress bar.

user_seed

seed for random distribution generation.

Value

Function clust_cp_epi returns a list containing the following components:

Examples


data_mat <- matrix(NA, nrow = 5, ncol = 50)

betas <- list(c(rep(0.45, 25),rep(0.14,25)),
              c(rep(0.55, 25),rep(0.11,25)),
              c(rep(0.50, 25),rep(0.12,25)),
              c(rep(0.52, 10),rep(0.15,40)),
              c(rep(0.53, 10),rep(0.13,40)))

 inf_times <- list()

 for(i in 1:5){

   inf_times[[i]] <- sim_epi_data(10000, 10, 50, betas[[i]], 1/8)

   vec <- rep(0,50)
   names(vec) <- as.character(1:50)

   for(j in 1:50){
     if(as.character(j) %in% names(table(floor(inf_times[[i]])))){
       vec[j] = table(floor(inf_times[[i]]))[which(names(table(floor(inf_times[[i]]))) == j)]
     }
   }
   data_mat[i,] <- vec
 }

 out <- clust_cp_epi(data = data_mat, n_iterations = 3000, M = 250, B = 1000, L = 1)

 get_clust_VI(out$clust[1000:3000,])


[Package BayesChange version 1.1.2 Index]