This function implements a method to correct for shared risk factors in the search for interactions. It provides the observed chisquare value, a measure of association between two parasites, and simulates bootstrapped data taking risk factors into account.
1 
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 
The value returned is a list containing:

the model fitted without any response variable 

duration in seconds of the simulations 

the Pearson's chi2 statistic calculated on 

the estimated coefficient of over (or under) dispersion, defined as the mean of the bootstrapped values of the corrected chisquare. 

pvalue of the corrected chisquare test under the null hypothesis of independence of the two parasites.


pvalue of the corrected chisquare test under the null hypothesis of independence of the two parasites.


expected frequencies, ie. the contingency table calculated on the theoretical (bootstrapped) data 

observed frequencies, ie. the contingency table calculated on 

a vector containing the 
The distribution of the bootstrapped corrected chisquares (an histogram) is also provided.
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.
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.
1 2 3 4 5 6  ## Not run:
library(Interatrix)
data(dataInteratrix)
res1 < chi2Corr("F1+F2*F3+F4", dataInteratrix, "Parasite1", "Parasite2", 500)
## End(Not run)

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
Please suggest features or report bugs with the GitHub issue tracker.
All documentation is copyright its authors; we didn't write any of that.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.