amu_causes_disease: Effect of AMU on occurence of disease

Description Usage Arguments Details Value Examples

Description

Uses a Fisher exact test to test whether AMU increases disease occurence.

Usage

1
2
amu_causes_disease(x, time = "WEEK", space = "FlockID", amu = "AMU",
  disease = "Sick_yes", week_amu = 1, week_disease = 2)

Arguments

x

a data frame.

time

the name of the data frame variable that corresponds to time (the data frame will be orderd chronologically).

week_amu

the number of weeks before the focal week we consider to define the presence or absence of AMU.

week_disease

the number of weeks after the focal week over which we look for presence or absence of disease.

time

the name of the data frame variable that corresponds to space ( the computation of the presence of AMU and disease will be performed by spatial unit).

time

the name of the data frame variable that corresponds to AMU (logical).

time

the name of the data frame variable that corresponds to presence of disease (logical).

Details

We consider only weeks with no diseases. Among these weeks, we make 2 groups: one with AMU and one without AMU. The groups with AMU contains the weeks that have AMU. The groups without AMU contains the weeks that do not have AMU as well as no AMU of the week_amu weeks that precede. For these 2 groups, we look at the presence of disease during the week_disease weeks that follow. We thus end up with a contingency table of AMU and presence of disease that we feed to a Fisher exact test.

Value

A list containing the contingency table and the result of the Fisher exact test.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
library(dplyr)

amu_with_disease %>%
  amu_causes_disease()

amu_with_disease %>%
  amu_causes_disease(disease = "DIARRHOEA")

amu_with_disease %>%
  mutate(Sick_yes = DIARRHOEA | RESPIRATORY ) %>%
  amu_causes_disease()

amu_with_disease %>%
  mutate(Sick_yes = DIARRHOEA | RESPIRATORY ) %>%
  amu_causes_disease(week_disease = 3)

choisy/viparc documentation built on May 30, 2019, 11:38 p.m.