This function implements a method to correct for the cumulative effect of age and for other potentially confounding risk factors in the search for interactions. It provides the observed chisquare value, a measure of the association between two parasites, and simulates bootstrapped data taking risk factors into account.
1 2  chi2CorrAge(formula, data.obs, namepara1, namepara2, nameage, w1, w2, mort, a,
nsimu, nbcore = 3)

formula 
a string of characters indicating a symbolic description of the model of shared risk factors (including age) 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 
nameage 
the column name of the age classes 
w1 
a real number between 0 and 1 indicating the antibodies' disappearance rate of the first studied parasite 
w2 
a real number between 0 and 1 indicating the antibodies' disappearance rate of the second studied parasite 
mort 
a vector of real numbers between 0 and 1 giving the mortality rates of all age classes 
a 
a vector of integers giving the bounds of the age classes 
nsimu 
an integer indicating the number of repetitions for the bootstrap simulation 
nbcore 
an integer indicating the number of cores available on the computer to set up a parallel calculation 
The value returned is a list containing:

the model fitted without any response variable 

duration in seconds of the simulations 

the number of cores used for parallel simulations 

the Pearson's chi2 statistic calculated on 

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.
Unknown age in health disorders: a method to account for its cumulative effect and an application to feline viruses interactions. Hellard E., Pontier D., Siberchicot A., Sauvage F. and Fouchet D. (2015). Epidemics 11: 4855. doi:10.1016/j.epidem.2015.02.004.
1 2 3 4 5 6 7  ## Not run:
library(Interatrix)
data(dataInteratrix)
res2 < chi2CorrAge("F1+F2+AGE", dataInteratrix, "Parasite1", "Parasite2", "AGE", w1 = 0,
w2 = 0, mort = c(0.2, 0.2, 0.2), a = c(0, 1, 2, 10), nsimu = 500, nbcore = 2)
## End(Not run)

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
All documentation is copyright its authors; we didn't write any of that.