Description Usage Arguments Details Value Functions References See Also Examples
View source: R/calculate_cophylo_summary_stat.R
Calculate the ParafitGlobal Statistic to be used in the hypothesis test described in Legendre et al. (2002). The null hypothesis of this test being that the evolution of the two trees together with their associations at the present have been independent.
1 2 3  parafit_stat(host_tr, symb_tr, assoc_mat)
parafit_test(host_tr, symb_tr, assoc_mat, D, reps = 99)

host_tr 
The host tree of class "phy" 
symb_tr 
The symbiont tree of class "phy 
assoc_mat 
Association matrix between the extant tips of 'host_tr' and 'symb_tr' 
D 
the statistic calculated using 'parafit_stat' 
reps 
Number of permutations to perform on the association matrix for the hypothesis test 
'parafit_stat' drops any nonextant tips from the tree. Then the phylogenetic distance matrix is obtained for both host and symbiont tree. Next the principal coordinates are found for the host and symbiont distance matrices before these PCoA vectors are used in the following matrix multiplication following Legendre et al. (2002): D = H t(A) A. The trace is then found of this to get our ParaFitGlobal Statistic.
The test function 'parafit_test' performs a rowwise permutation of the association matrix as described in Legendre et al. 2002. This is performed a number of times set by the user (default is 999) and a pvalue is output.
The value from this is input into the test function. Note that this gives only the raw statistic unlike 'ape::parafit'. That is the only reason it is implemented here in treeducken (similar to 'treeducken::cherries').
A pvalue for the hypothesis test described above
parafit_test
: Perform ParaFit Hypothesis Test
Legendre, P., Y. Desdevises and E. Bazin. 2002. A statistical test for hostparasite coevolution. Systematic Biology, 51(2), 217–234.
parafit_test
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15  tr_pair < sim_cophyBD(hbr=0.1,
hdr=0.05,
sdr=0.1,
host_exp_rate=0.4,
sbr = 0.05,
cosp_rate = 1.0,
numbsim = 1,
time_to_sim = 1)
# maybe we are interested in only cophylogenetic object 1
ht < tr_pair[[1]]$host_tree
st < tr_pair[[1]]$symb_tree
A < tr_pair[[1]]$association_mat
pfs < parafit_stat(host_tr = ht, symb_tr = st, assoc_mat = A)
parafit_test(ht, st, A, pfs, reps = 19)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.