chi2CorrAge {Interatrix} | R Documentation |
Searches for parasite interactions taking the cumulative effect of age and other risk factors into account.
Description
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.
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:
formula |
the model fitted without any response variable |
time |
duration in seconds of the simulations |
nbcore |
the number of cores used for parallel simulations |
chi2.corr.obs |
the Pearson's chi2 statistic calculated on |
pval |
p-value of the corrected chi-square test under the null hypothesis of independence of the two parasites.
|
tab.th |
expected frequencies, ie. the contingency table calculated on the theoretical (bootstrapped) data |
tab.obs |
observed frequencies, ie. the contingency table calculated on |
chi2.corr.sim |
a vector containing the |
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
## 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)