Searches for parasite interactions taking risk factors into account.
chi2Corr.RdThis function implements a method to correct for shared risk factors in the search for interactions. It provides the observed chi-square value, a measure of association between two parasites, and simulates bootstrapped data taking risk factors into account.
Arguments
- formula
a string of characters indicating a symbolic description of the model of shared risk factors to be fitted without any response variable
- data.obs
the name of the data set to be used
- namepara1
the name of the column giving the status to the first parasite
- namepara2
the name of the column giving the status to the second parasite
- nsimu
an integer indicating the number of repetitions for the bootstrap simulation
Value
The value returned is a list containing:
formulathe model fitted without any response variable
timeduration in seconds of the simulations
chi2.corr.obsthe Pearson's chi2 statistic calculated on
data.obsdispcoeffthe estimated coefficient of over- (or under-) dispersion, defined as the mean of the bootstrapped values of the corrected chi-square.
pval1p-value of the corrected chi-square test under the null hypothesis of independence of the two parasites.
pval1was estimated assuming that the corrected chi-square is proportional to a chi-square with one degree of freedom.pval2p-value of the corrected chi-square test under the null hypothesis of independence of the two parasites.
pval2was given by the proportion of bootstrapped corrected chi-squares smaller than the observed value (chi2.corr.obs).tab.thexpected frequencies, ie. the contingency table calculated on the theoretical (bootstrapped) data
tab.obsobserved frequencies, ie. the contingency table calculated on
data.obschi2.corr.sima vector containing the
nsimuPearson's chi2 statistics calculated on simulated data.
The distribution of the bootstrapped corrected chi-squares (an histogram) is also provided.
Note
pval2 is better than pval1 but requires running enough simulations, wich may be long in some cases. pval1 allows working with smaller numbers of simualtions when simulation times are too long.
References
True versus False Parasite Interactions: A Robust Method to Take Risk Factors into Account and Its Application to Feline Viruses. Hellard E., Pontier D., Sauvage F., Poulet H. and Fouchet D. (2012). PLoS ONE 7(1): e29618. doi:10.1371/journal.pone.0029618.
Examples
if (FALSE) { # \dontrun{
library(Interatrix)
data(dataInteratrix)
res1 <- chi2Corr("F1+F2*F3+F4", dataInteratrix, "Parasite1", "Parasite2", 500)
} # }