wiwMedTree {treespace} | R Documentation |
Median transmission tree
Description
Function to find the median of a list of transmission scenarios
Usage
wiwMedTree(matList, sampled = NULL, weights = NULL)
Arguments
matList |
a list of matrices, each of which is the output of |
sampled |
a vector of node IDs which corresponds to those nodes which are sampled cases |
weights |
optional vector of weights to correspond to the entries of matList |
Value
Returns three objects:
-
centre
: the mean of the matList entries, restricted to the sampled cases -
distances
: for each entry of matList, its distance fromcentre
-
mindist
: the minimum ofdistances
-
median
: the number of the median entry of matList, i.e. the one(s) which achieve themindist
from thecentre
.
Author(s)
Michelle Kendall michelle.louise.kendall@gmail.com
Examples
# create some simple "who infected whom" scenarios:
tree1 <- cbind(Infector=1:5,Infectee=2:6)
tree2 <- cbind(Infector=c(1,5,2,2,3),Infectee=2:6)
tree3 <- cbind(Infector=c(2,2,3,4,5),Infectee=c(1,3,4,5,6))
# create list of the MRCI depth matrices:
matList <- lapply(list(tree1,tree2,tree3), function(x) findMRCIs(x)$mrciDepths)
# median tree, assuming all cases are sampled:
wiwMedTree(matList)
# median tree when cases 1, 2 and 4 are sampled:
wiwMedTree(matList, sampled=c(1,2,4))
[Package treespace version 1.1.4.3 Index]