Searches for parasite interactions taking the cumulative effect of age and other risk factors into account.
chi2CorrAge.RdThis 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 chi-square value, a measure of the association between two parasites, and simulates bootstrapped data taking risk factors into account.
Usage
chi2CorrAge(formula, data.obs, namepara1, namepara2, nameage, w1, w2, mort, a,
nsimu, nbcore = 3)Arguments
- 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
Value
The value returned is a list containing:
formulathe model fitted without any response variable
timeduration in seconds of the simulations
nbcorethe number of cores used for parallel simulations
chi2.corr.obsthe Pearson's chi2 statistic calculated on
data.obspvalp-value of the corrected chi-square test under the null hypothesis of independence of the two parasites.
pvalwas 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.
References
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: 48-55. doi:10.1016/j.epidem.2015.02.004.
Examples
if (FALSE) { # \dontrun{
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)
} # }