chris_interval_intersect_0: Calculate the interval intersect (Chris' code).

Description Usage Arguments Value Examples

View source: R/chris_interval_intersect_0.R

Description

This function is used in the calculation of the likelihood for a General Stochastic Epidemic, and calculates the interval intersect used in the calculation of the intergral for the infection likelihood. This is the length of the interval for which (I_i, R_i) (i in infecteds) and (0, I_j) (j in all) overlap. This is the interval max{0, [ min(R_i, I_j) - max(I_i, 0) ]} for i in infecteds and j in all. This is an equivalent calculation, but only in the case where the epidemic is assumed to start at time 0. It can be thought of as calculating the amount of individual j's susceptible period (0, I_j) that is spent in individual i's infectious period (I_i, R_i).

Usage

1
chris_interval_intersect_0(interval_i, interval_j)

Arguments

interval_i

Is the matrix cbind(t_inf, t_rem)[infected, ]. This is a 2 column matrix of the infection and removal times for the infected individuals.

interval_j

Is the matrix cbind(0, t_inf). This is a 2 column matrix of 0s in the first column and the infection times in the second.

Value

Returns a matrix where each column is a vector for each j.

Examples

1
This function is utilised by the log_likelihood function.

BenjamenSimon/EpidemicR documentation built on March 23, 2020, 11:03 p.m.