Running 'as.datagen.R' [2s/3s]
  Running 'contactnet.R' [1s/1s]
  Comparing 'contactnet.Rout' to 'contactnet.Rout.save' ... OK
  Running 'datagen.R' [2s/2s]
  Running 'epictmcmc.R' [3s/4s]
Running the tests in 'tests/as.datagen.R' failed.
Complete output:
  > library(EpiILMCT)
  Loading required package: coda
  Loading required package: parallel
  > 
  > # Just for illustation:
  > set.seed(4352)
  > 
  > # SIR distance-based ILM for a population of 10 individuals:
  > loc <- cbind(runif(10, 0, 10), runif(10,0,10))
  > net <- contactnet(type = "random", num.id = 10, location = loc, beta = 0.3)
  > infection <- c(2.5, 1, 0, 0, 0.5, 0, 2, 1.5, 0, 3)
  > removal <- c(3.5, 2, 0, 1, 1.5, 0, 3, 2.5, 0, 4)
  > id <- c(2, 1, 4, 7, 10, 3, 5, 9, 8, 6)
  > 
  > epi <- as.epidat(type = "SIR", kerneltype = "distance", inf.time = infection,
  + rem.time = removal, id.individual = id, location = loc)
  > epi
  $type
  [1] "SIR"
  
  $kerneltype
  [1] "distance"
  
  $epidat
        id.individual rem.time inf.period inf.time
   [1,]             7      1.0          1      0.0
   [2,]            10      1.5          1      0.5
   [3,]             1      2.0          1      1.0
   [4,]             9      2.5          1      1.5
   [5,]             5      3.0          1      2.0
   [6,]             2      3.5          1      2.5
   [7,]             6      4.0          1      3.0
   [8,]             4      Inf          0      Inf
   [9,]             3      Inf          0      Inf
  [10,]             8      Inf          0      Inf
  
  $location
            [,1]      [,2]
   [1,] 1.828423 2.7380457
   [2,] 6.251315 3.6714150
   [3,] 8.631550 4.1674895
   [4,] 8.752524 2.5540859
   [5,] 1.588805 0.7560573
   [6,] 2.298943 5.3628061
   [7,] 2.573442 4.7134330
   [8,] 4.146331 8.7564241
   [9,] 5.790433 6.4825925
  [10,] 1.947795 1.0234221
  
  $network
  NULL
  
  attr(,"class")
  [1] "datagen"
  > 
  > # using the data set generated by using the SINR network-based ILM:
  > data(NetworkDataSINR)
  > names(NetworkDataSINR)
  [1] "loc" "net" "cov" "epi"
  > 
  > netSINR<-as.epidat(type = "SINR", kerneltype = "network",
  + incub.time = NetworkDataSINR$epi[,4], inf.time = NetworkDataSINR$epi[,6],
  + rem.time = NetworkDataSINR$epi[,2], id.individual = NetworkDataSINR$epi[,1],
  + location  = NetworkDataSINR$loc, network = NetworkDataSINR$net,
  + network.type = "powerlaw")
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  EpiILMCT
   --- call from context --- 
  as.epidat(type = "SINR", kerneltype = "network", incub.time = NetworkDataSINR$epi[, 
      4], inf.time = NetworkDataSINR$epi[, 6], rem.time = NetworkDataSINR$epi[, 
      2], id.individual = NetworkDataSINR$epi[, 1], location = NetworkDataSINR$loc, 
      network = NetworkDataSINR$net, network.type = "powerlaw")
   --- call from argument --- 
  if (class(network) != "contactnet") {
      if (is.null(network.type)) {
          warning("The network.type option should be specified.", 
              call. = FALSE)
      }
      else if ((network.type != "random") & (is.null(location))) {
          warning("The location option (XY coordinates of individuals) should be specified.", 
              call. = FALSE)
      }
  }
   --- R stacktrace ---
  where 1: as.epidat(type = "SINR", kerneltype = "network", incub.time = NetworkDataSINR$epi[, 
      4], inf.time = NetworkDataSINR$epi[, 6], rem.time = NetworkDataSINR$epi[, 
      2], id.individual = NetworkDataSINR$epi[, 1], location = NetworkDataSINR$loc, 
      network = NetworkDataSINR$net, network.type = "powerlaw")
  
   --- value of length: 2 type: logical ---
  [1] TRUE TRUE
   --- function from context --- 
  function (type, kerneltype, incub.time = NULL, inf.time, rem.time, 
      id.individual, location = NULL, network = NULL, network.type = NULL) 
  {
      n <- length(inf.time)
      if (kerneltype == "network" | kerneltype == "both") {
          if (is.null(network)) {
              stop("As the kerneltype is specified to \"network\" or \"both\", contact network matrix must be included in the argument via the obtion \"network\"", 
                  call. = FALSE)
          }
          else {
              if (all(dim(network) == c(n, n)) == FALSE) {
                  stop("The contact network matrix must be a squared matrix", 
                    call. = FALSE)
              }
          }
          if (class(network) != "contactnet") {
              if (is.null(network.type)) {
                  warning("The network.type option should be specified.", 
                    call. = FALSE)
              }
              else if ((network.type != "random") & (is.null(location))) {
                  warning("The location option (XY coordinates of individuals) should be specified.", 
                    call. = FALSE)
              }
          }
      }
      if (kerneltype == "distance" | kerneltype == "both") {
          if (is.null(location)) {
              stop("As the kerneltype is specified to \"distance\" or \"both\", the XY coordinates of individuals must be included in the argument via the obtion \"location\"", 
                  call. = FALSE)
          }
          else {
              if (all(dim(location) == c(n, 2)) == FALSE) {
                  stop("The location must be a matrix or dataframe of n rows and 2 columns", 
                    call. = FALSE)
              }
          }
      }
      if (type == "SIR") {
          if (length(rem.time) != length(inf.time)) {
              stop("The number of removal and infection times are not equal", 
                  call. = FALSE)
          }
          inf.period <- rem.time - inf.time
          epi <- as.matrix(cbind(id.individual, rem.time, inf.period, 
              inf.time), ncol = 4, nrow = n)
          epi[which(epi[, 2] == 0), c(2, 4)] <- Inf
          epi[which(epi[, 2] == Inf), c(2, 4)] <- Inf
          epi[which(epi[, 2] == Inf), 3] <- 0
          eppi <- epi[order(epi[, 4]), ]
      }
      else if (type == "SINR") {
          if ((length(rem.time) != length(incub.time)) | (length(incub.time) != 
              length(inf.time))) {
              stop("The number of removal, incubation and infection times are not equal", 
                  call. = FALSE)
          }
          delay.period <- rem.time - incub.time
          incub.period <- incub.time - inf.time
          epi <- as.matrix(cbind(id.individual, rem.time, delay.period, 
              incub.time, incub.period, inf.time), ncol = 6, nrow = n)
          epi[which(epi[, 2] == 0), c(2, 4, 6)] <- Inf
          epi[which(epi[, 2] == Inf), c(2, 4, 6)] <- Inf
          epi[which(epi[, 2] == Inf), c(3, 5)] <- 0
          eppi <- epi[order(epi[, 6]), ]
      }
      else {
          stop("The compartmental framework must be either SIR or SINR", 
              call. = FALSE)
      }
      outepi <- list(type = type, kerneltype = kerneltype, epidat = eppi, 
          location = location, network = network)
      class(outepi) <- "datagen"
      outepi
  }
  <bytecode: 0x3c2c888>
  <environment: namespace:EpiILMCT>
   --- function search by body ---
  Function as.epidat in namespace EpiILMCT has this body.
   ----------- END OF FAILURE REPORT -------------- 
  Error in if (class(network) != "contactnet") { : 
    the condition has length > 1
  Calls: as.epidat
  Execution halted
Running the tests in 'tests/datagen.R' failed.
Complete output:
  > library(EpiILMCT)
  Loading required package: coda
  Loading required package: parallel
  > 
  > set.seed(22)
  > loc<- matrix(cbind(runif(50, 0, 10),runif(50, 0, 10)), ncol = 2, nrow = 50)
  > net1<- contactnet(type = "powerlaw", location = loc, beta = 1.5,
  +     nu = 0.5)
  > 
  > #################################
  > #################################
  > #################################
  > ########       SIR       ########
  > #################################
  > #################################
  > #################################
  > 
  > #################################
  > ########  spatial ILMs:  ########
  > #################################
  > 
  > # first: with power-law kernel:
  > 
  > cov1 <- cbind(runif(50, 0, 50), runif(50, 0, 5))
  > cov2 <- cbind(runif(50, 0, 50), runif(50, 0, 5))
  > 
  > # with specifying all the options of susceptibility and transmissibility functions:
  > 
  > epi.dist.po1 <- datagen(type = "SIR", kerneltype = "distance", kernelmatrix = loc,
  +                 initialepi = matrix(c(13, 2, 2, 0), ncol = 4, nrow = 1), tmax = 4,
  +                 distancekernel = "powerlaw", suspar = c(0.01, 2), transpar = c(0.03,0.2),
  +                 powersus = c(0.5, 0.7), powertrans = c(0.7, 1.3),
  +                 kernel.par = 8, delta = c(6,2), suscov = cov1, transcov = cov2,
  +                 seedval = 299)
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  EpiILMCT
   --- call from context --- 
  datagen(type = "SIR", kerneltype = "distance", kernelmatrix = loc, 
      initialepi = matrix(c(13, 2, 2, 0), ncol = 4, nrow = 1), 
      tmax = 4, distancekernel = "powerlaw", suspar = c(0.01, 2), 
      transpar = c(0.03, 0.2), powersus = c(0.5, 0.7), powertrans = c(0.7, 
          1.3), kernel.par = 8, delta = c(6, 2), suscov = cov1, 
      transcov = cov2, seedval = 299)
   --- call from argument --- 
  if (class(kernelmatrix) == "contactnet") {
      n <- dim(kernelmatrix$location)[1]
      distance <- as.matrix(dist(kernelmatrix$location, method = "euclidean"))
      network <- kernelmatrix$contact.network
      location <- kernelmatrix$location
  } else if (!is.list(kernelmatrix) & is.matrix(kernelmatrix)) {
      if (dim(kernelmatrix)[2] == 2) {
          n <- length(kernelmatrix[, 1])
          network <- matrix(0, ncol = n, nrow = n)
          distance <- as.matrix(dist(kernelmatrix, method = "euclidean"))
          location <- kernelmatrix
      }
      else {
          stop("The kernelmatrix must be a class of \"contactnet\" or the XY coordinates", 
              call. = FALSE)
      }
  } else {
      stop("The kernelmatrix must be a class of \"contactnet\" or a matrix of the XY coordinates of individuals", 
          call. = FALSE)
  }
   --- R stacktrace ---
  where 1: datagen(type = "SIR", kerneltype = "distance", kernelmatrix = loc, 
      initialepi = matrix(c(13, 2, 2, 0), ncol = 4, nrow = 1), 
      tmax = 4, distancekernel = "powerlaw", suspar = c(0.01, 2), 
      transpar = c(0.03, 0.2), powersus = c(0.5, 0.7), powertrans = c(0.7, 
          1.3), kernel.par = 8, delta = c(6, 2), suscov = cov1, 
      transcov = cov2, seedval = 299)
  
   --- value of length: 2 type: logical ---
  [1] FALSE FALSE
   --- function from context --- 
  function (type, kerneltype, kernelmatrix, distancekernel = NULL, 
      initialepi = NULL, tmax = NULL, suspar = NULL, transpar = NULL, 
      powersus = NULL, powertrans = NULL, kernel.par = NULL, spark = NULL, 
      gamma = NULL, delta, suscov = NULL, transcov = NULL, seedval = NULL) 
  {
      if (type == "SIR") {
          if (is.null(seedval)) {
              temp <- 0
          }
          else {
              temp <- seedval
          }
          kernelpar <- vector(mode = "double", length = 2)
          if (kerneltype == "distance") {
              anum <- 1
              if (class(kernelmatrix) == "contactnet") {
                  n <- dim(kernelmatrix$location)[1]
                  distance <- as.matrix(dist(kernelmatrix$location, 
                    method = "euclidean"))
                  network <- kernelmatrix$contact.network
                  location <- kernelmatrix$location
              }
              else if (!is.list(kernelmatrix) & is.matrix(kernelmatrix)) {
                  if (dim(kernelmatrix)[2] == 2) {
                    n <- length(kernelmatrix[, 1])
                    network <- matrix(0, ncol = n, nrow = n)
                    distance <- as.matrix(dist(kernelmatrix, method = "euclidean"))
                    location <- kernelmatrix
                  }
                  else {
                    stop("The kernelmatrix must be a class of \"contactnet\" or the XY coordinates", 
                      call. = FALSE)
                  }
              }
              else {
                  stop("The kernelmatrix must be a class of \"contactnet\" or a matrix of the XY coordinates of individuals", 
                    call. = FALSE)
              }
              if (is.null(distancekernel)) {
                  stop("Specify the type of distance kernel as \"powerlaw\" or \"Cauchy\"", 
                    call. = FALSE)
              }
              else if (distancekernel == "powerlaw") {
                  num <- 2
              }
              else if (distancekernel == "Cauchy") {
                  num <- 3
              }
              if (is.null(kernel.par)) {
                  stop("Specify the value of the kernel parameter: kernel.par", 
                    call. = FALSE)
              }
              kernelpar[1] <- kernel.par
              kernelpar[2] <- 0
          }
          else if (kerneltype == "network") {
              if (class(kernelmatrix) == "contactnet") {
                  n <- dim(kernelmatrix$location)[1]
                  distance <- matrix(0, ncol = n, nrow = n)
                  location <- kernelmatrix$location
                  network <- kernelmatrix$contact.network
              }
              else if (!is.list(kernelmatrix) & is.matrix(kernelmatrix)) {
                  if (dim(kernelmatrix)[1] == dim(kernelmatrix)[2]) {
                    n <- length(kernelmatrix[, 1])
                    network <- kernelmatrix
                    distance <- matrix(0, ncol = n, nrow = n)
                    location <- NULL
                  }
                  else {
                    stop("The kernelmatrix must be a class of \"contactnet\" or a squared contact network matrix", 
                      call. = FALSE)
                  }
              }
              else {
                  stop("The kernelmatrix must be a class of \"contactnet\" or a matrix of the XY coordinates of individuals", 
                    call. = FALSE)
              }
              if (is.null(spark)) {
                  anum <- 2
              }
              else {
                  anum <- 1
              }
              num <- 1
              kernelpar[1] <- 0
              kernelpar[2] <- 0
          }
          else if (kerneltype == "both") {
              anum <- 1
              if (class(kernelmatrix) == "contactnet") {
                  n <- dim(kernelmatrix$location)[1]
                  distance <- as.matrix(dist(kernelmatrix$location, 
                    method = "euclidean"))
                  location <- kernelmatrix$location
                  network <- kernelmatrix$contact.network
              }
              else if (is.list(kernelmatrix) & length(kernelmatrix) == 
                  2L) {
                  if (dim(kernelmatrix[[1]])[2] == 2) {
                    n <- dim(kernelmatrix[[1]])[1]
                    distance <- as.matrix(dist(kernelmatrix[[1]], 
                      method = "euclidean"))
                    location <- kernelmatrix[[1]]
                    if (dim(kernelmatrix[[2]])[1] == dim(kernelmatrix[[2]])[2]) {
                      network <- kernelmatrix[[2]]
                    }
                    else {
                      stop("The contact network matrix must be a squared matrix", 
                        call. = FALSE)
                    }
                  }
                  else {
                    stop("The kernelmatrix must be a list of two matrices that contains \n 1) the XY coordinates of individuals, \n 2) the contact network matrix.", 
                      call. = FALSE)
                  }
              }
              else {
                  stop("The kernelmatrix must be a class of \"contactnet\" or a list of two matrices that contains \n 1) the XY coordinates of individuals, \n 2) the contact network matrix.", 
                    call. = FALSE)
              }
              if (is.null(distancekernel)) {
                  stop("Specify the type of distance kernel as \"powerlaw\" or \"Cauchy\"", 
                    call. = FALSE)
              }
              else if (distancekernel == "powerlaw") {
                  num <- 4
              }
              else if (distancekernel == "Cauchy") {
                  num <- 5
              }
              if (is.null(kernel.par)) {
                  stop("Specify the value of the kernel parameters: kernel.par", 
                    call. = FALSE)
              }
              kernelpar[1] <- kernel.par[1]
              kernelpar[2] <- kernel.par[2]
          }
          if (is.null(delta)) {
              stop("Specify the values of the parameters of the infectious period distribution: delta", 
                  call. = FALSE)
          }
          if (!is.matrix(delta) & length(delta) != 2) {
              stop("Error in entering the parameters of the infectious period distribution: delta", 
                  call. = FALSE)
          }
          else if (is.matrix(delta)) {
              if (dim(delta)[1] != 1 & dim(delta)[2] != 2) {
                  stop("Error in entering the parameters of the infectious period distribution: delta", 
                    call. = FALSE)
              }
              deltain1 <- delta[1, 1]
              deltain2 <- delta[1, 2]
          }
          else {
              deltain1 <- delta[1]
              deltain2 <- delta[2]
          }
          if (is.null(initialepi)) {
              observednum <- 1
              observedepi <- c(0, 0, 0, 0)
          }
          else {
              if (length(initialepi[1, ]) != 4) {
                  stop("Error: the initial epidemic must be a matrix of 4 columns: id number(s) of individual(s), removal time(s), infectious period(s) and infection time(s) of the initial infected individual(s)", 
                    call. = FALSE)
              }
              observedepi <- initialepi
              observednum <- length(initialepi[, 1])
          }
          if (is.null(suspar) & is.null(suscov)) {
              suspar <- 1
              suscov <- matrix(rep(1, n), ncol = 1, nrow = n)
              nsuspar <- 1
          }
          else if (!is.null(suspar) & is.null(suscov)) {
              suscov <- matrix(rep(1, n), ncol = 1, nrow = n)
              nsuspar <- 1
          }
          else if (is.null(suspar) & !is.null(suscov)) {
              stop("Specify the susceptibility parameters: suspar", 
                  call. = FALSE)
          }
          else {
              if (any(suscov < 0)) {
                  stop("Covariate(s) values of the susceptibility function must be positive: suscov", 
                    call. = FALSE)
              }
              nsuspar <- length(suscov[1, ])
          }
          if (is.null(transpar) & is.null(transcov)) {
              transpar <- 1
              transcov <- matrix(rep(1, n), ncol = 1, nrow = n)
              ntranspar <- 1
          }
          else if (!is.null(transpar) & is.null(transcov)) {
              transcov <- matrix(rep(1, n), ncol = 1, nrow = n)
              ntranspar <- 1
          }
          else if (is.null(transpar) & !is.null(transcov)) {
              stop("Specify the transmissibility parameters: transpar", 
                  call. = FALSE)
          }
          else {
              if (any(transcov < 0)) {
                  stop("Covariate(s) values of the transmissibility function must be positive: transcov", 
                    call. = FALSE)
              }
              ntranspar <- length(transcov[1, ])
          }
          if (is.null(powersus)) {
              powersus <- rep(1, nsuspar)
          }
          if (is.null(powertrans)) {
              powertrans <- rep(1, ntranspar)
          }
          if (is.null(spark)) {
              spark <- 0
          }
          if (is.null(tmax)) {
              tmax <- 1000
          }
          datgg <- .Fortran("datasimulation_f", n = as.integer(n), 
              anum = as.integer(anum), num = as.integer(num), observednum = as.integer(observednum), 
              observedepi = as.matrix(as.double(observedepi), ncol = 4, 
                  nrow = observednum), tmax = as.double(tmax), 
              temp = as.integer(temp), suspar = as.vector(suspar, 
                  mode = "double"), nsuspar = as.integer(nsuspar), 
              powersus = as.vector(powersus, mode = "double"), 
              transpar = as.vector(transpar, mode = "double"), 
              ntranspar = as.integer(ntranspar), powertrans = as.vector(powertrans, 
                  mode = "double"), kernelpar = as.vector(kernelpar, 
                  mode = "double"), spark = as.double(spark), delta1 = as.double(deltain1), 
              delta2 = as.double(deltain2), suscov = as.matrix(as.double(suscov), 
                  ncol = nsuspar, nrow = n), transcov = as.matrix(as.double(transcov), 
                  ncol = ntranspar, nrow = n), cc = as.matrix(as.double(network), 
                  n, n), d3 = as.matrix(as.double(distance), n, 
                  n), epidat = matrix(0, ncol = 4, nrow = n))
          colnames(datgg$epidat) <- c("id.individual", "rem.time", 
              "inf.period", "inf.time")
      }
      else if (type == "SINR") {
          if (is.null(seedval)) {
              temp <- 0
          }
          else {
              temp <- seedval
          }
          kernelpar <- vector(mode = "double", length = 2)
          if (kerneltype == "distance") {
              anum <- 1
              if (class(kernelmatrix) == "contactnet") {
                  n <- dim(kernelmatrix$location)[1]
                  distance <- as.matrix(dist(kernelmatrix$location, 
                    method = "euclidean"))
                  location <- kernelmatrix$location
                  network <- kernelmatrix$contact.network
              }
              else if (!is.list(kernelmatrix) & is.matrix(kernelmatrix)) {
                  if (dim(kernelmatrix)[2] == 2) {
                    n <- length(kernelmatrix[, 1])
                    network <- matrix(0, ncol = n, nrow = n)
                    distance <- as.matrix(dist(kernelmatrix, method = "euclidean"))
                    location <- kernelmatrix
                  }
                  else {
                    stop("The kernelmatrix must be a class of \"contactnet\" or the XY coordinates", 
                      call. = FALSE)
                  }
              }
              else {
                  stop("The kernelmatrix must be a class of \"contactnet\" or a matrix of the XY coordinates of individuals", 
                    call. = FALSE)
              }
              if (is.null(distancekernel)) {
                  stop("Specify the type of distance kernel as \"powerlaw\" or \"Cauchy\"", 
                    call. = FALSE)
              }
              else if (distancekernel == "powerlaw") {
                  num <- 2
              }
              else if (distancekernel == "Cauchy") {
                  num <- 3
              }
              if (is.null(kernel.par)) {
                  stop("Specify the value of the kernel parameter: kernel.par", 
                    call. = FALSE)
              }
              kernelpar[1] <- kernel.par
              kernelpar[2] <- 0
          }
          else if (kerneltype == "network") {
              if (class(kernelmatrix) == "contactnet") {
                  n <- dim(kernelmatrix$location)[1]
                  distance <- matrix(0, ncol = n, nrow = n)
                  location <- kernelmatrix$location
                  network <- kernelmatrix$contact.network
              }
              else if (!is.list(kernelmatrix) & is.matrix(kernelmatrix)) {
                  if (dim(kernelmatrix)[1] == dim(kernelmatrix)[2]) {
                    n <- length(kernelmatrix[, 1])
                    network <- kernelmatrix
                    location <- NULL
                    distance <- matrix(0, ncol = n, nrow = n)
                  }
                  else {
                    stop("The kernelmatrix must be a class of \"contactnet\" or a squared contact network matrix", 
                      call. = FALSE)
                  }
              }
              else {
                  stop("The kernelmatrix must be a class of \"contactnet\" or a matrix of the XY coordinates of individuals", 
                    call. = FALSE)
              }
              if (is.null(spark)) {
                  anum <- 2
              }
              else {
                  anum <- 1
              }
              num <- 1
              kernelpar[1] <- 0
              kernelpar[2] <- 0
          }
          else if (kerneltype == "both") {
              anum <- 1
              if (class(kernelmatrix) == "contactnet") {
                  n <- dim(kernelmatrix$location)[1]
                  distance <- as.matrix(dist(kernelmatrix$location, 
                    method = "euclidean"))
                  location <- kernelmatrix$location
                  network <- kernelmatrix$contact.network
              }
              else if (is.list(kernelmatrix) & length(kernelmatrix) == 
                  2L) {
                  if (dim(kernelmatrix[[1]])[2] == 2) {
                    n <- dim(kernelmatrix[[1]])[1]
                    distance <- as.matrix(dist(kernelmatrix[[1]], 
                      method = "euclidean"))
                    location <- kernelmatrix[[1]]
                    if (dim(kernelmatrix[[2]])[1] == dim(kernelmatrix[[2]])[2]) {
                      network <- kernelmatrix[[2]]
                    }
                    else {
                      stop("The contact network matrix must be a squared matrix", 
                        call. = FALSE)
                    }
                  }
                  else {
                    stop("The kernelmatrix must be a list of two matrices that contains \n 1) the XY coordinates of individuals, \n 2) the contact network matrix.", 
                      call. = FALSE)
                  }
              }
              else {
                  stop("The kernelmatrix must be a class of \"contactnet\" or a list of two matrices that contains \n 1) the XY coordinates of individuals, \n 2) the contact network matrix.", 
                    call. = FALSE)
              }
              if (is.null(distancekernel)) {
                  stop("Specify the type of distance kernel as \"powerlaw\" or \"Cauchy\"", 
                    call. = FALSE)
              }
              else if (distancekernel == "powerlaw") {
                  num <- 4
              }
              else if (distancekernel == "Cauchy") {
                  num <- 5
              }
              if (is.null(kernel.par)) {
                  stop("Specify the value of the kernel parameters: kernel.par", 
                    call. = FALSE)
              }
              kernelpar[1] <- kernel.par[1]
              kernelpar[2] <- kernel.par[2]
          }
          if (!is.matrix(delta)) {
              stop("The parameters of the incubation and delay periods distributions (delta) must be entered as a 2 by 2 matrix", 
                  call. = FALSE)
          }
          else {
              if (dim(delta)[1] != 2 & dim(delta)[2] != 2) {
                  stop("Error in entering the parameters of the incubation and delay periods distributions: delta", 
                    call. = FALSE)
              }
              deltain1 <- delta[1, 1]
              deltain2 <- delta[1, 2]
              deltanr1 <- delta[2, 1]
              deltanr2 <- delta[2, 2]
          }
          if (is.null(initialepi)) {
              observednum <- 1
              observedepi <- c(0, 0, 0, 0, 0, 0)
          }
          else {
              if (is.vector(initialepi)) {
                  if (length(initialepi) != 6) {
                    stop("Error: the initial epidemic must be a vector of the id number of individual, removal time, delay period, notification time, incubation period, and infection time of the initial infected individual", 
                      call. = FALSE)
                  }
              }
              else {
                  if (length(initialepi[1, ]) != 6) {
                    stop("Error: the initial epidemic must be a matrix of 6 columns: id number(s) of individual(s), removal time(s), delay period(s), notification time(s), incubation period(s), and infection time(s) of the initial infected individual(s)", 
                      call. = FALSE)
                  }
              }
              observedepi <- initialepi
              observednum <- length(initialepi[, 1])
          }
          if (is.null(suspar) & is.null(suscov)) {
              suspar <- 1
              suscov <- matrix(rep(1, n), ncol = 1, nrow = n)
              nsuspar <- 1
          }
          else if (!is.null(suspar) & is.null(suscov)) {
              suscov <- matrix(rep(1, n), ncol = 1, nrow = n)
              nsuspar <- 1
          }
          else if (is.null(suspar) & !is.null(suscov)) {
              stop("Specify the susceptibility parameters: suspar", 
                  call. = FALSE)
          }
          else {
              if (any(suscov < 0)) {
                  stop("Covariate(s) values of the susceptibility function must be positive: suscov", 
                    call. = FALSE)
              }
              nsuspar <- length(suscov[1, ])
          }
          if (is.null(transpar) & is.null(transcov)) {
              transpar <- 1
              transcov <- matrix(rep(1, n), ncol = 1, nrow = n)
              ntranspar <- 1
          }
          else if (!is.null(transpar) & is.null(transcov)) {
              transcov <- matrix(rep(1, n), ncol = 1, nrow = n)
              ntranspar <- 1
          }
          else if (is.null(transpar) & !is.null(transcov)) {
              stop("Specify the transmissibility parameters: transpar", 
                  call. = FALSE)
          }
          else {
              if (any(transcov < 0)) {
                  stop("Covariate(s) values of the transmissibility function must be positive: transcov", 
                    call. = FALSE)
              }
              ntranspar <- length(transcov[1, ])
          }
          if (is.null(powersus)) {
              powersus <- rep(1, nsuspar)
          }
          if (is.null(powertrans)) {
              powertrans <- rep(1, ntranspar)
          }
          if (is.null(spark)) {
              spark <- 0
          }
          if (is.null(gamma)) {
              gamma <- 1
          }
          if (is.null(tmax)) {
              tmax <- 1000
          }
          datgg <- .Fortran("datasimulationsinr_f", n = as.integer(n), 
              anum = as.integer(anum), num = as.integer(num), observednum = as.integer(observednum), 
              observedepi = as.matrix(as.double(observedepi), ncol = 6, 
                  nrow = observednum), tmax = as.double(tmax), 
              temp = as.integer(temp), suspar = as.vector(suspar, 
                  mode = "double"), nsuspar = as.integer(nsuspar), 
              powersus = as.vector(powersus, mode = "double"), 
              transpar = as.vector(transpar, mode = "double"), 
              ntranspar = as.integer(ntranspar), powertrans = as.vector(powertrans, 
                  mode = "double"), kernelpar = as.vector(kernelpar, 
                  mode = "double"), spark = as.double(spark), gamma = as.double(gamma), 
              deltain1 = as.double(deltain1), deltain2 = as.double(deltain2), 
              deltanr1 = as.double(deltanr1), deltanr2 = as.double(deltanr2), 
              suscov = as.matrix(as.double(suscov), ncol = nsuspar, 
                  nrow = n), transcov = as.matrix(as.double(transcov), 
                  ncol = ntranspar, nrow = n), cc = as.matrix(as.double(network), 
                  n, n), d3 = as.matrix(as.double(distance), n, 
                  n), epidat = matrix(0, ncol = 6, nrow = n))
          colnames(datgg$epidat) <- c("id.individual", "rem.time", 
              "delay.period", "incub.time", "incub.period", "inf.time")
      }
      else {
          stop("Error in specifying the compartmental framework of the model: type", 
              call. = FALSE)
      }
      if (kerneltype == "network" | kerneltype == "both") {
          outepi <- list(type = type, kerneltype = kerneltype, 
              epidat = datgg$epidat, location = location, network = network)
      }
      else {
          outepi <- list(type = type, kerneltype = kerneltype, 
              epidat = datgg$epidat, location = location, network = NULL)
      }
      class(outepi) <- "datagen"
      outepi
  }
  <bytecode: 0x4025e28>
  <environment: namespace:EpiILMCT>
   --- function search by body ---
  Function datagen in namespace EpiILMCT has this body.
   ----------- END OF FAILURE REPORT -------------- 
  Error in if (class(kernelmatrix) == "contactnet") { : 
    the condition has length > 1
  Calls: datagen
  Execution halted
Running the tests in 'tests/epictmcmc.R' failed.
Complete output:
  > library(EpiILMCT)
  Loading required package: coda
  Loading required package: parallel
  > ## distance-based SIR continuous-time ILMs ##
  > data(SpatialData)
  > ## performing the MCMC-tool for analyzing the fully observed spatial data 
  > ## under the SIR distance-based continuous ILM:
  > suspar <- list(NULL)
  > suspar[[1]]<-list(2,c("gamma", 1, 0.01, 0.5))
  > suspar[[2]]<- rep(1,length(SpatialData$epidat[,1]))
  > kernel1 <- list(2, c("gamma", 1, 0.01, 0.5))
  > 
  > mcmcres2 <- epictmcmc(object = SpatialData,
  + distancekernel = "powerlaw", datatype = "known epidemic", nsim = 50, 
  + control.sus = suspar,
  + kernel.par = kernel1,  seedval  =  524837)
  ************************************************ 
  * Start performing MCMC for the  known epidemic  SIR ILM for 
  50 iterations 
  ************************************************ 
  > #plot(mcmcres2, plottype = "parameter")
  > print(mcmcres2)
  
  ********************************************************* 
  Model: SIR distance -based continuous-time ILM 
  Method: Markov chain Monte Carlo (MCMC) 
  Data assumption: fully observed epidemic
  ********************************************************* 
  
  Output: 
  
   parameter.samples : 
  Markov Chain Monte Carlo (MCMC) output:
  Start = 1 
  End = 7 
  Thinning interval = 1 
       Alpha_s[1] Spatial parameter
  [1,]    2.00000           2.00000
  [2,]    1.99285           2.50554
  [3,]    1.59467           2.63827
  [4,]    1.59467           2.63827
  [5,]    1.59467           3.24563
  [6,]    1.59467           3.04079
  [7,]    1.57440           3.04079
  
   log.likelihood : 
  Markov Chain Monte Carlo (MCMC) output:
  Start = 1 
  End = 7 
  Thinning interval = 1 
  [1] -3.06312 13.63351 15.64745 15.64745 17.64000 18.04679 17.96373
  
  Available components:
  [1] "compart.framework" "kernel.type"       "data.assumption"  
  [4] "parameter.samples" "log.likelihood"    "acceptance.rate"  
  [7] "number.iteration"  "number.parameter"  "number.chains"    
  > summary(mcmcres2)
  
  ********************************************************* 
  Model: SIR distance-based continuous-time ILM 
  Method: Markov chain Monte Carlo (MCMC) 
  Data assumption: fully observed epidemic 
  number.chains : 1 chains 
  number.iteration : 49 iterations 
  number.parameter : 2 parameters 
  
  ********************************************************* 
  
  
   1. Empirical mean and standard deviation for each variable,
  plus standard error of the mean:
                       Mean       SD  Naive SE Time-series SE
  Alpha_s[1]        1.89199 0.398321 0.0563312      0.1393647
  Spatial parameter 2.97445 0.236320 0.0334206      0.0680907
  
  
  
   2. Quantiles for each variable:
                       2.5%     25%     50%     75%   97.5%
  Alpha_s[1]        1.46165 1.57598 1.86215 2.02520 3.04281
  Spatial parameter 2.53540 2.89962 3.01184 3.10367 3.31936
  
  
  
   3. Empirical mean, standard deviation, and quantiles for the log likelihood,
            Mean             SD       Naive SE Time-series SE 
       17.104935       3.155672       0.446279       0.578746 
  
     2.5%     25%     50%     75%   97.5% 
  13.7450 16.8537 17.8573 18.5840 18.7389 
  
  
  
   4. acceptance.rate : 
         Alpha_s[1] Spatial parameter 
           0.571429          0.326531 
  > 
  > suspar <- list(NULL)
  > suspar[[1]]<-list(2,c("gamma", 1, 0.1, 2.5))
  > suspar[[2]]<- matrix(rep(1,length(SpatialData$epidat[,1])),ncol=1)
  > kernel1 <- list(0.2, c("gamma", 1, 0.1, 0.01))
  > 
  > mcmcres22 <- epictmcmc(object = SpatialData,
  + distancekernel = "Cauchy", datatype = "known epidemic", nsim = 50, 
  + control.sus = suspar,
  + kernel.par = kernel1,  seedval  =  524837)
  ************************************************ 
  * Start performing MCMC for the  known epidemic  SIR ILM for 
  50 iterations 
  ************************************************ 
  > #plot(mcmcres22, plottype = "parameter")
  > print(mcmcres22)
  
  ********************************************************* 
  Model: SIR distance -based continuous-time ILM 
  Method: Markov chain Monte Carlo (MCMC) 
  Data assumption: fully observed epidemic
  ********************************************************* 
  
  Output: 
  
   parameter.samples : 
  Markov Chain Monte Carlo (MCMC) output:
  Start = 1 
  End = 7 
  Thinning interval = 1 
       Alpha_s[1] Spatial parameter
  [1,]    2.00000          0.200000
  [2,]    1.96425          0.210111
  [3,]    1.96425          0.209948
  [4,]    1.96425          0.204625
  [5,]    5.02498          0.204455
  [6,]    5.02498          0.203473
  [7,]    5.02498          0.205957
  
   log.likelihood : 
  Markov Chain Monte Carlo (MCMC) output:
  Start = 1 
  End = 7 
  Thinning interval = 1 
  [1] -16.30159 -15.97433 -15.98526 -16.35387  -2.68093  -2.67626  -2.68942
  
  Available components:
  [1] "compart.framework" "kernel.type"       "data.assumption"  
  [4] "parameter.samples" "log.likelihood"    "acceptance.rate"  
  [7] "number.iteration"  "number.parameter"  "number.chains"    
  > summary(mcmcres22)
  
  ********************************************************* 
  Model: SIR distance-based continuous-time ILM 
  Method: Markov chain Monte Carlo (MCMC) 
  Data assumption: fully observed epidemic 
  number.chains : 1 chains 
  number.iteration : 49 iterations 
  number.parameter : 2 parameters 
  
  ********************************************************* 
  
  
   1. Empirical mean and standard deviation for each variable,
  plus standard error of the mean:
                        Mean        SD   Naive SE Time-series SE
  Alpha_s[1]        5.820410 1.8786962 0.26568777      0.8718595
  Spatial parameter 0.201153 0.0416385 0.00588858      0.0337249
  
  
  
   2. Quantiles for each variable:
                        2.5%     25%     50%      75%    97.5%
  Alpha_s[1]        1.964253 4.03282 6.35174 6.992586 8.907120
  Spatial parameter 0.118686 0.18227 0.20454 0.233045 0.261475
  
  
  
   3. Empirical mean, standard deviation, and quantiles for the log likelihood,
            Mean             SD       Naive SE Time-series SE 
       -3.710893       4.010238       0.567133       1.525971 
  
         2.5%         25%         50%         75%       97.5% 
  -16.2304178  -4.3502900  -2.6851781  -1.6198179  -0.0710728 
  
  
  
   4. acceptance.rate : 
         Alpha_s[1] Spatial parameter 
           0.346939          0.836735 
  > 
  > #plot(mcmcres2$log.likelihood)
  > #plot(mcmcres22$log.likelihood)
  > 
  > ## performing the MCMC-tool for analyzing the partially observed spatial
  > ## data (unknown infection times) under the SIR distance-based 
  > ## continuous ILM:
  > 
  > suspar <- list(NULL)
  > suspar[[1]]<-list(2,c("gamma", 1, 0.01, 0.8))
  > suspar[[2]]<- matrix(rep(1,length(SpatialData$epidat[,1])),ncol=1)
  > kernel1 <- list(2, c("gamma", 1, 0.01, 0.5))
  > 
  > mcmcres22 <- epictmcmc(object = SpatialData, distancekernel = "powerlaw",
  + datatype = "known removal", nsim = 50,  
  + control.sus = suspar, kernel.par = kernel1, delta = list(1, 2, c(4, 2)),  
  + seedval  =  524837)
  ************************************************ 
  * Start performing MCMC for the  known removal  SIR ILM for 
  50 iterations 
  ************************************************ 
  > 
  > #plot(mcmcres22, plottype = "parameter")
  > print(mcmcres22)
  
  ********************************************************* 
  Model: SIR distance -based continuous-time ILM 
  Method: Data augmented Markov chain Monte Carlo (DA-MCMC) 
  Data assumption: partially observed epidemic (unknown infection times)
  ********************************************************* 
  
  Output: 
  
   parameter.samples : 
  Markov Chain Monte Carlo (MCMC) output:
  Start = 1 
  End = 7 
  Thinning interval = 1 
       Alpha_s[1] Spatial parameter Infectious period rate
  [1,]   2.000000           2.00000                2.00000
  [2,]   2.000000           2.10706                1.88851
  [3,]   2.000000           2.18897                1.39947
  [4,]   1.468126           2.18897                1.59104
  [5,]   0.980672           2.34075                1.59342
  [6,]   0.980672           2.72192                2.20612
  [7,]   0.980672           2.72192                2.04167
  
   log.likelihood : 
  Markov Chain Monte Carlo (MCMC) output:
  Start = 1 
  End = 7 
  Thinning interval = 1 
  [1] -37.5869 -29.5496 -17.4319 -19.3013 -21.2541 -37.0023 -33.0528
  
   infection.times.samples : 
  Markov Chain Monte Carlo (MCMC) output:
  Start = 1 
  End = 7 
  Thinning interval = 1 
       [,1]       [,2]     [,3]     [,4]      [,5]     [,6]     [,7]     [,8]
  [1,]    0 0.00205424 0.170259 0.171529 0.2294014 0.266345 0.296273 0.305499
  [2,]    0 0.00205424 0.170259 0.171529 0.2294014 0.266345 0.296273 0.305499
  [3,]    0 0.00205424 0.170259 0.171529 0.2294014 0.266345 0.294512 0.305499
  [4,]    0 0.00205424 0.170259 0.171529 0.3267262 0.266345 0.294512 0.305499
  [5,]    0 0.00205424 0.170259 0.143796 0.0755763 0.266345 0.294512 0.305499
  [6,]    0 0.00205424 0.444749 0.143796 0.3618180 0.266345 0.294512 0.305499
  [7,]    0 0.00205424 0.444749 0.143796 0.4195985 0.266345 0.294512 0.305499
           [,9]    [,10]    [,11]    [,12]    [,13]    [,14]   [,15]   [,16]
  [1,] 0.318990 0.337687 0.362637 0.403727 0.432961 0.591705 2.28403 2.32537
  [2,] 0.237981 0.339907 0.362637 0.403727 0.432961 0.591705 2.28403 2.46579
  [3,] 0.227037 0.339907 0.362637 0.403727 0.432961 0.591705 2.28403 2.34285
  [4,] 0.217150 0.339907 0.362637 0.403727 0.432961 0.591705 2.28403 2.16838
  [5,] 0.284616 0.339907 0.362637 0.403727 0.432961 0.591705 2.28403 2.45650
  [6,] 0.499376 0.379290 0.225046 0.403727 0.484467 0.591705 2.28403 2.45650
  [7,] 0.370765 0.480171 0.346546 0.793590 0.484467 0.591705 2.28403 2.10678
         [,17]   [,18]   [,19]   [,20]   [,21]   [,22]   [,23]   [,24]  [,25]
  [1,] 2.34818 2.57043 2.57258 2.57268 2.57963 2.59514 2.60761 2.60862 2.6131
  [2,] 2.34818 2.57043 2.57258 2.57268 2.57963 2.59514 2.60761 2.60862 2.6131
  [3,] 2.34818 2.57043 2.57258 2.57268 2.57963 2.59514 2.60761 2.60862 2.6131
  [4,] 2.34818 2.57043 2.57258 2.57268 2.57963 2.59514 2.61060 2.60862 2.6131
  [5,] 2.34818 2.57043 2.57258 2.57268 2.57963 2.59514 2.61060 2.49888 2.6131
  [6,] 2.34818 2.57043 2.57258 2.57268 2.57963 2.59514 2.61060 2.49888 2.6131
  [7,] 2.34818 2.57043 2.57258 2.57268 2.57963 2.59514 2.61060 2.49888 2.6131
         [,26]   [,27]   [,28]   [,29]   [,30]   [,31]   [,32]   [,33]
  [1,] 2.61327 2.62189 2.75117 2.89072 2.93546 3.15278 3.72520 3.93308
  [2,] 2.61327 2.62189 2.55850 2.89072 2.89327 3.22323 3.57679 3.82845
  [3,] 2.61327 2.62189 2.54235 2.89072 3.00641 3.22323 3.25021 3.82845
  [4,] 2.61327 2.62189 2.54235 2.89072 3.00641 3.38122 3.25021 3.38065
  [5,] 2.61327 2.62189 2.54235 2.60926 2.97817 3.38122 3.25021 3.17937
  [6,] 2.61327 2.62189 2.09205 3.25118 2.95632 3.38122 3.25021 3.17937
  [7,] 2.61327 2.62189 2.70803 3.56584 2.78519 3.38122 3.25021 3.17937
  
   Average.infectious.periods : 
  Markov Chain Monte Carlo (MCMC) output:
  Start = 1 
  End = 7 
  Thinning interval = 1 
  [1] 0.526360 0.537143 0.548211 0.559540 0.576025 0.548796 0.519972
  
  Available components:
   [1] "compart.framework"          "kernel.type"               
   [3] "data.assumption"            "parameter.samples"         
   [5] "log.likelihood"             "acceptance.rate"           
   [7] "number.iteration"           "number.parameter"          
   [9] "number.chains"              "infection.times.samples"   
  [11] "Average.infectious.periods"
  > summary(mcmcres22)
  
  ********************************************************* 
  Model:SIR distance-based continuous-time ILM 
  Method: Data augmented Markov chain Monte Carlo (DA-MCMC) 
  Data assumption: partially observed epidemic (unknown infection times) 
  number.chains : 1 chains 
  number.iteration : 49 iterations 
  number.parameter : 3 parameters
  ********************************************************* 
  
  
   1. Empirical mean and standard deviation for each variable,
  plus standard error of the mean:
                            Mean       SD  Naive SE Time-series SE
  Alpha_s[1]             1.32470 0.288530 0.0408044      0.0536844
  Spatial parameter      2.72264 0.223316 0.0315817      0.0839535
  Infectious period rate 1.82216 0.262716 0.0371537      0.0371537
  
  
  
   2. Quantiles for each variable:
                             2.5%     25%     50%     75%   97.5%
  Alpha_s[1]             0.977197 1.07975 1.27557 1.49691 2.00000
  Spatial parameter      2.125493 2.71128 2.75719 2.88183 2.92424
  Infectious period rate 1.399778 1.64533 1.79559 1.99162 2.48244
  
  
  
   3. Empirical mean, standard deviation, and quantiles for the log likelihood,
            Mean             SD       Naive SE Time-series SE 
       -31.01779        6.04597        0.85503        0.85503 
  
      2.5%      25%      50%      75%    97.5% 
  -43.3173 -34.1281 -30.3429 -27.5192 -19.6227 
  
  
  
   4. Empirical mean, standard deviation, and quantiles for the average infectious periods,
            Mean             SD       Naive SE Time-series SE 
      0.55886551     0.02913373     0.00412013     0.00671857 
  
      2.5%      25%      50%      75%    97.5% 
  0.513134 0.536363 0.556784 0.580775 0.611694 
  
  
  
   5. acceptance.rate : 
              Alpha_s[1]      Spatial parameter Infectious period rate 
                0.387755               0.408163               1.000000 
  > 
  > ## distance-based and network-based SIR ILMs ##
  > data(SpatialNetData)
  > ## performing the MCMC-tool for analyzing the fully observed spatial and 
  > ## network data
  > ## under the SIR distance-based and network-based continuous-time ILM:
  > suspar <- list(NULL)
  > suspar[[1]]<-list(c(0.08,0.2),matrix(c("gamma", "gamma", 1, 1, 0.01, 0.01, 0.1, 0.5), 
  + ncol = 4, nrow = 2))
  > suspar[[2]]<- SpatialNetData[[2]]
  > kernel1 <- list(c(5, 0.5), matrix(c("gamma", "gamma", 1, 1,
  + 0.01, 0.01, 0.5, 1), ncol = 4, nrow = 2))
  > 
  > mcmcres3 <- epictmcmc(object = SpatialNetData[[1]], distancekernel = "powerlaw",
  + datatype = "known epidemic", nsim = 50, 
  + control.sus = suspar, kernel.par = kernel1, 
  + seedval  =  524837)
  ************************************************ 
  * Start performing MCMC for the  known epidemic  SIR ILM for 
  50 iterations 
  ************************************************ 
  > #plot(mcmcres3, plottype = "parameter")
  > print(mcmcres3)
  
  ********************************************************* 
  Model: SIR both -based continuous-time ILM 
  Method: Markov chain Monte Carlo (MCMC) 
  Data assumption: fully observed epidemic
  ********************************************************* 
  
  Output: 
  
   parameter.samples : 
  Markov Chain Monte Carlo (MCMC) output:
  Start = 1 
  End = 7 
  Thinning interval = 1 
        Alpha_s[1] Alpha_s[2] Spatial parameter Network parameter
  [1,] 0.080000000  0.2000000           5.00000          0.500000
  [2,] 0.078570137  0.2000000           4.60182          0.500000
  [3,] 0.004548079  0.0538514           3.84279          1.714717
  [4,] 0.000494403  0.0538514           3.46290          1.714717
  [5,] 0.000494403  0.2008621           2.71330          0.588549
  [6,] 0.009314934  0.2008621           2.48489          0.588549
  [7,] 0.009314934  0.2008621           2.48489          0.588549
  
   log.likelihood : 
  Markov Chain Monte Carlo (MCMC) output:
  Start = 1 
  End = 7 
  Thinning interval = 1 
  [1] -1685.1976  -835.6888   -89.7862   -84.8022   -74.3987   -64.8056   -64.8056
  
  Available components:
  [1] "compart.framework" "kernel.type"       "data.assumption"  
  [4] "parameter.samples" "log.likelihood"    "acceptance.rate"  
  [7] "number.iteration"  "number.parameter"  "number.chains"    
  > summary(mcmcres3)
  
  ********************************************************* 
  Model: SIR both-based continuous-time ILM 
  Method: Markov chain Monte Carlo (MCMC) 
  Data assumption: fully observed epidemic 
  number.chains : 1 chains 
  number.iteration : 49 iterations 
  number.parameter : 4 parameters 
  
  ********************************************************* 
  
  
   1. Empirical mean and standard deviation for each variable,
  plus standard error of the mean:
                         Mean        SD   Naive SE Time-series SE
  Alpha_s[1]        0.0161953 0.0141215 0.00199709     0.00291284
  Alpha_s[2]        0.2413550 0.0517926 0.00732458     0.02100707
  Spatial parameter 2.0179686 0.7234552 0.10231201     0.28894322
  Network parameter 0.4281332 0.3456321 0.04887976     0.09740370
  
  
  
   2. Quantiles for each variable:
                          2.5%        25%       50%       75%     97.5%
  Alpha_s[1]        0.00110145 0.00770095 0.0174696 0.0174696 0.0648399
  Alpha_s[2]        0.08673484 0.20488217 0.2745847 0.2745847 0.2903367
  Spatial parameter 1.51269347 1.63953681 1.7974591 2.0023263 4.4310354
  Network parameter 0.16191513 0.16746966 0.4208825 0.5470820 1.5611094
  
  
  
   3. Empirical mean, standard deviation, and quantiles for the log likelihood,
            Mean             SD       Naive SE Time-series SE 
       -110.0391       252.3185        35.6832        54.8785 
  
       2.5%       25%       50%       75%     97.5% 
  -667.8607  -61.3080  -60.8391  -59.7544  -59.3836 
  
  
  
   4. acceptance.rate : 
         Alpha_s[1]        Alpha_s[2] Spatial parameter Network parameter 
           0.163265          0.142857          0.530612          0.346939 
  > 
  > ## network-based SIR ILMs ##
  > data(NetworkData)
  > ## performing the MCMC-tool for analyzing the fully observed network data 
  > ## under the SIR network-based continuous-time ILM:
  > 
  > suspar <- list(NULL)
  > suspar[[1]]<-list(c(0.08,0.5),matrix(c("gamma", "gamma", 1, 1, 1, 1, 0.1, 0.5), 
  + ncol = 4, nrow = 2))
  > suspar[[2]]<- NetworkData[[2]]
  > 
  > mcmcres4 <- epictmcmc(object = NetworkData[[1]], datatype = "known epidemic",
  + nsim = 50, control.sus = suspar,  seedval  =  524837)
  ************************************************ 
  * Start performing MCMC for the  known epidemic  SIR ILM for 
  50 iterations 
  ************************************************ 
  > #plot(mcmcres4, plottype = "parameter")
  > print(mcmcres4)
  
  ********************************************************* 
  Model: SIR network -based continuous-time ILM 
  Method: Markov chain Monte Carlo (MCMC) 
  Data assumption: fully observed epidemic
  ********************************************************* 
  
  Output: 
  
   parameter.samples : 
  Markov Chain Monte Carlo (MCMC) output:
  Start = 1 
  End = 7 
  Thinning interval = 1 
       Alpha_s[1] Alpha_s[2]
  [1,]  0.0800000   0.500000
  [2,]  0.0785701   0.500000
  [3,]  0.0392596   0.491872
  [4,]  0.1309855   0.483348
  [5,]  0.1030769   0.434282
  [6,]  0.1030769   0.434282
  [7,]  0.0751011   0.434282
  
   log.likelihood : 
  Markov Chain Monte Carlo (MCMC) output:
  Start = 1 
  End = 7 
  Thinning interval = 1 
  [1] -47.4443 -47.4564 -49.4719 -48.2774 -47.7047 -47.7047 -47.7761
  
  Available components:
  [1] "compart.framework" "kernel.type"       "data.assumption"  
  [4] "parameter.samples" "log.likelihood"    "acceptance.rate"  
  [7] "number.iteration"  "number.parameter"  "number.chains"    
  > summary(mcmcres4)
  
  ********************************************************* 
  Model: SIR network-based continuous-time ILM 
  Method: Markov chain Monte Carlo (MCMC) 
  Data assumption: fully observed epidemic 
  number.chains : 1 chains 
  number.iteration : 49 iterations 
  number.parameter : 2 parameters 
  
  ********************************************************* 
  
  
   1. Empirical mean and standard deviation for each variable,
  plus standard error of the mean:
                  Mean        SD   Naive SE Time-series SE
  Alpha_s[1] 0.0961915 0.0238917 0.00337879     0.00562274
  Alpha_s[2] 0.4649383 0.0763419 0.01079638     0.01958017
  
  
  
   2. Quantiles for each variable:
                  2.5%       25%       50%      75%    97.5%
  Alpha_s[1] 0.0561159 0.0789276 0.0969105 0.117333 0.133511
  Alpha_s[2] 0.3153073 0.4342822 0.4628187 0.496342 0.617549
  
  
  
   3. Empirical mean, standard deviation, and quantiles for the log likelihood,
            Mean             SD       Naive SE Time-series SE 
     -48.0573295      0.5397130      0.0763269      0.1030277 
  
      2.5%      25%      50%      75%    97.5% 
  -49.3077 -48.2244 -47.9476 -47.6546 -47.4600 
  
  
  
   4. acceptance.rate : 
  Alpha_s[1] Alpha_s[2] 
    0.469388   0.387755 
  > 
  > ## network-based SINR ILMs ##
  > data(NetworkDataSINR)
  > names(NetworkDataSINR)
  [1] "loc" "net" "cov" "epi"
  > 
  > 
  > netSINR<-as.epidat(type = "SINR", kerneltype = "network", incub.time = NetworkDataSINR$epi[,4], inf.time = NetworkDataSINR$epi[,6], rem.time = NetworkDataSINR$epi[,2], id.individual = NetworkDataSINR$epi[,1], location  = NetworkDataSINR$loc, network = NetworkDataSINR$net, network.type = "powerlaw")
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  EpiILMCT
   --- call from context --- 
  as.epidat(type = "SINR", kerneltype = "network", incub.time = NetworkDataSINR$epi[, 
      4], inf.time = NetworkDataSINR$epi[, 6], rem.time = NetworkDataSINR$epi[, 
      2], id.individual = NetworkDataSINR$epi[, 1], location = NetworkDataSINR$loc, 
      network = NetworkDataSINR$net, network.type = "powerlaw")
   --- call from argument --- 
  if (class(network) != "contactnet") {
      if (is.null(network.type)) {
          warning("The network.type option should be specified.", 
              call. = FALSE)
      }
      else if ((network.type != "random") & (is.null(location))) {
          warning("The location option (XY coordinates of individuals) should be specified.", 
              call. = FALSE)
      }
  }
   --- R stacktrace ---
  where 1: as.epidat(type = "SINR", kerneltype = "network", incub.time = NetworkDataSINR$epi[, 
      4], inf.time = NetworkDataSINR$epi[, 6], rem.time = NetworkDataSINR$epi[, 
      2], id.individual = NetworkDataSINR$epi[, 1], location = NetworkDataSINR$loc, 
      network = NetworkDataSINR$net, network.type = "powerlaw")
  
   --- value of length: 2 type: logical ---
  [1] TRUE TRUE
   --- function from context --- 
  function (type, kerneltype, incub.time = NULL, inf.time, rem.time, 
      id.individual, location = NULL, network = NULL, network.type = NULL) 
  {
      n <- length(inf.time)
      if (kerneltype == "network" | kerneltype == "both") {
          if (is.null(network)) {
              stop("As the kerneltype is specified to \"network\" or \"both\", contact network matrix must be included in the argument via the obtion \"network\"", 
                  call. = FALSE)
          }
          else {
              if (all(dim(network) == c(n, n)) == FALSE) {
                  stop("The contact network matrix must be a squared matrix", 
                    call. = FALSE)
              }
          }
          if (class(network) != "contactnet") {
              if (is.null(network.type)) {
                  warning("The network.type option should be specified.", 
                    call. = FALSE)
              }
              else if ((network.type != "random") & (is.null(location))) {
                  warning("The location option (XY coordinates of individuals) should be specified.", 
                    call. = FALSE)
              }
          }
      }
      if (kerneltype == "distance" | kerneltype == "both") {
          if (is.null(location)) {
              stop("As the kerneltype is specified to \"distance\" or \"both\", the XY coordinates of individuals must be included in the argument via the obtion \"location\"", 
                  call. = FALSE)
          }
          else {
              if (all(dim(location) == c(n, 2)) == FALSE) {
                  stop("The location must be a matrix or dataframe of n rows and 2 columns", 
                    call. = FALSE)
              }
          }
      }
      if (type == "SIR") {
          if (length(rem.time) != length(inf.time)) {
              stop("The number of removal and infection times are not equal", 
                  call. = FALSE)
          }
          inf.period <- rem.time - inf.time
          epi <- as.matrix(cbind(id.individual, rem.time, inf.period, 
              inf.time), ncol = 4, nrow = n)
          epi[which(epi[, 2] == 0), c(2, 4)] <- Inf
          epi[which(epi[, 2] == Inf), c(2, 4)] <- Inf
          epi[which(epi[, 2] == Inf), 3] <- 0
          eppi <- epi[order(epi[, 4]), ]
      }
      else if (type == "SINR") {
          if ((length(rem.time) != length(incub.time)) | (length(incub.time) != 
              length(inf.time))) {
              stop("The number of removal, incubation and infection times are not equal", 
                  call. = FALSE)
          }
          delay.period <- rem.time - incub.time
          incub.period <- incub.time - inf.time
          epi <- as.matrix(cbind(id.individual, rem.time, delay.period, 
              incub.time, incub.period, inf.time), ncol = 6, nrow = n)
          epi[which(epi[, 2] == 0), c(2, 4, 6)] <- Inf
          epi[which(epi[, 2] == Inf), c(2, 4, 6)] <- Inf
          epi[which(epi[, 2] == Inf), c(3, 5)] <- 0
          eppi <- epi[order(epi[, 6]), ]
      }
      else {
          stop("The compartmental framework must be either SIR or SINR", 
              call. = FALSE)
      }
      outepi <- list(type = type, kerneltype = kerneltype, epidat = eppi, 
          location = location, network = network)
      class(outepi) <- "datagen"
      outepi
  }
  <bytecode: 0x353f708>
  <environment: namespace:EpiILMCT>
   --- function search by body ---
  Function as.epidat in namespace EpiILMCT has this body.
   ----------- END OF FAILURE REPORT -------------- 
  Error in if (class(network) != "contactnet") { : 
    the condition has length > 1
  Calls: as.epidat
  Execution halted