Skip to content
Prev 18094 / 20628 Next

Hadfield et al 2014 co-evolution analysis

Hey!

I want to reproduce Hadfield *et al* (2014) analysis in-
https://datadryad.org/stash/dataset/doi:10.5061/dryad.jf3tj. The
data-analysis from the paper is-
https://datadryad.org/stash/dataset/doi:10.5061/dryad.jf3tj

In the Analysis.R file in the data-analysis link, Hadfield *et al* created
an "*ndat"* dataframe which contains host and parasite counts. When I run
the original codes for MCMC run as it is (as shown below), I get the
following error-

##########################
##### MCMC Count Data ####
##########################
#distribution of counts is assumed to be overdispersed zero-truncated
Poisson
alpha.V=1000)})
random=~Region+Parasite.species+Host.species+Parasite.species.ide+Host.species.ide+Host.Parasite+Host.Parasite.ide+Host.Parasite.ide2+Host.Parasite.ide3,
family="ztpoisson", data=ndat, ginverse=list(Host.species=hostA,
Host.Parasite=host.parasiteA, Host.Parasite.ide2=host.parasiteAS,
Host.Parasite.ide3=host.parasiteSA), prior=priorC, nitt=1000000, thin=400,
burnin=200000)

Error-
Error in MCMCglmm(counts ~ log(no.hosts.sampled) +
log(no.parasites.sampled),  :
  Zero-truncated Poisson data must be positive integers

If I remove 0 values in "counts" columns from the "ndat" dataframe, then I
will have to change the prior itself according to the new error-
random=~Parasite.species+Host.species+Parasite.species.ide+Host.species.ide+Host.Parasite+Host.Parasite.ide+Host.Parasite.ide2+Host.Parasite.ide3,
family="ztpoisson", data=ndat_cleaned, ginverse=list(Host.species=hostA,
Host.Parasite=host.parasiteA, Host.Parasite.ide2=host.parasiteAS,
Host.Parasite.ide3=host.parasiteSA), prior=priorC, nitt=1000000, thin=400,
burnin=200000)

Error-
Error in MCMCglmm(counts ~ 1, random = ~Parasite.species + Host.species +
 :
  prior$G has the wrong number of structures

How do I make it work?
I want to ultimately check the effect of each of the random effects
separately on the "counts" variable to compare the effect of host
phylogeny, parasite phylogeny, and host-parasite coevolution. Would I need
to change the priors each time?

Thanks!
Jigyasa Arora