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 chi-square value, a measure of the association between two parasites, and simulates bootstrapped data taking risk factors into account.
chi2CorrAge(formula, data.obs, namepara1, namepara2, nameage, w1, w2, mort, a,
nsimu, nbcore = 3)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.obs
pvalp-value of the corrected chi-square test under the null hypothesis of independence of the two parasites.
pval was 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.obs
chi2.corr.sima vector containing the nsimu Pearson's chi2 statistics calculated on simulated data.
The distribution of the bootstrapped corrected chi-squares (an histogram) is also provided.
a string of characters indicating a symbolic description of the model of shared risk factors (including age) to be fitted without any response variable
the name of the data set to be used
the name of the column giving the status to the first parasite
the name of the column giving the status to the second parasite
the column name of the age classes
a real number between 0 and 1 indicating the antibodies' disappearance rate of the first studied parasite
a real number between 0 and 1 indicating the antibodies' disappearance rate of the second studied parasite
a vector of real numbers between 0 and 1 giving the mortality rates of all age classes
a vector of integers giving the bounds of the age classes
an integer indicating the number of repetitions for the bootstrap simulation
an integer indicating the number of cores available on the computer to set up a parallel calculation
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.
if (FALSE) {
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)
}
Run the code above in your browser using DataLab