intensity {epiphy}R Documentation

Construct count, incidence and severity objects.

Description

count(), incidence() and severity() create eponym objects. All of these classes inherit from the base class intensity. The choice of the class depends on the nature of the data set.

Usage

count(data, mapping, keep_only_std = TRUE)

incidence(data, mapping, keep_only_std = TRUE)

severity(data, mapping, keep_only_std = TRUE)

Arguments

data

A data frame. Each line corresponds to a record (or case, or entry).

mapping

A mapping object, created with mapping() or mapping_() functions. ... A vector with all the corresponding variables. The different elements can be named (names of the elements) of the data frame in the incidence object), or unamed. In the latter case, elements must be correctly ordered, i.e. x, y, z, t, r and then n. If variables in NULL, then only the 6 first ... will be take into account in the following (1, 2, ...), i.e. the id of the value. All the 'parameters' need to be specified.

keep_only_std

Are only standard names kept when proceeding to mapping? Setting keep_only_std to TRUE may be useful for subsequent data splitting using extra labels.

Details

incidence reads disease incidence data from a data frame and return an incidence object. All of these classes inherit from intensity class.

Class intensity and inherited classes

All the classes recording disease intensity measurements inherit from this class. The class intensity is virtual which means that no object of a class intensity can be constructed. This class only describes common features of all the different disease intensity measurements implemented in this package (count, incidence and severity). You should call one of these inherited classes instead, depending on the nature of your data.

By convention, the first columns of the different data frames of each slots have names, but the spatial, temporal or even disease information do not need to fit to these conventions or may be less straightforward and need more columns to record correctly all the information. In such unusual situations, the automatic options of the analysis tools would need to be overridden to be able to work in the desired way.

The differences between the different inherited classes regard only the obs slot. In the case of count, the data expected for each record are positive integers (N+). For incidence, the data sets are supposed to be two information set per records, the number of diseased unit per sampling unit (r) and the total number of units per sampling unit (n). Note that in its current implementation, n is supposed to be the same for a whole data set. Unequal sampling units are not implemented yet. Finally, for severity, r is positive real ranging from 0 to 1 and depecting a percentage.

space A data frame containing only spatial information. Each row corresponds to a sampling unit. By convention, the first 3 columns are names x, y, z.

time A data frame containing temporal information. By convention, the first column is named t.

obs A data frame containing disease observations themselves. The name of the columns may differ between the sub-class chosed to record the data.

Note that it is possible to create a "severity" object but no statistical tools are currently implemented to deal with such an object.

An intensity object contains at very least the "pure" intensity records (column r) which is a so-called observational variable. Another observational variable, the number of individuals in a sampling unit (n), is present in the case of a incidence object. Very often in addition to observational variables, there are spatial (columns x, y and/or z) and/or temporal (column t) variables.

Note that the severity class and the z variable (the 3rd spatial dimension) are implemented but no statistical methods use them at this point.

Value

An intensity object.

When printed, difference information are available:

Examples

## Create intensity objects
# Implicite call: The variable mapping does not need to be specified if the
# column names of the input data frame follow the default names.
colnames(tomato_tswv$field_1929) # Returns c("x", "y", "t", "i", "n")
my_incidence_1 <- incidence(tomato_tswv$field_1929)
my_incidence_1
my_incidence_2 <- incidence(tomato_tswv$field_1929,
                            mapping(x = x, y = y, t = t, i = i, n = n))
identical(my_incidence_1, my_incidence_2)

# Explicite call: Otherwise, the variable mapping need to be specified, at
# least for column names that do not correspond to default names.
colnames(aphids) # Returns c("xm", "ym", "i")
my_count_1 <- count(aphids, mapping(x = xm, y = ym, i = i))
my_count_1
# We can drop the "i = i" in the mapping.
my_count_2 <- count(aphids, mapping(x = xm, y = ym))
identical(my_count_1, my_count_2)

# It is possible to change the variable mapping after the creation of an
# intensity object:
another_incidence <- incidence(hop_viruses$HpLV)
another_incidence
remap(another_incidence, mapping(x = xm, y = ym))

## Plotting data
plot(my_incidence_1) # Same as: plot(my_incidence_1, type = "spatial")
plot(my_incidence_1, type = "temporal")

plot(my_count_1, tile = FALSE, size = 5)
plot(my_count_1, type = "temporal") # Not possible: there is only 1 date.

# Using grayscale:
plot(my_count_1, grayscale = TRUE)
plot(my_count_1, grayscale = TRUE, tile = FALSE, size = 5)


[Package epiphy version 0.5.0 Index]