Package 'ExpBites'

Title: Simulate and Analyze Human Exposure to Mosquito Biting
Description: This package provides tools to analyse human and mosquito behavioral intercations and compute exposure to mosquito bites. It includes functions to generate behavioral data for individuals and biting patterns for mosquitoes, compute hourly exposure for bednet users and non-users, and summarize or visualize these dynamics across a 24-hour cycle.
Authors: Nicolas Moiroux [aut, cre]
Maintainer: Nicolas Moiroux <[email protected]>
License: GPL-3
Version: 0.1.0
Built: 2025-10-03 16:30:04 UTC
Source: https://github.com/Nmoiroux/ExpBites

Help Index


Calculate Hourly Mosquito Biting Exposure for Bednet Users and Non-Users

Description

Using a model of behavioral interactions, computes the hourly exposure to mosquito bites for both bednet users and non-users, based on their location (indoors, outdoors, under a net) and mosquito biting rates. For users, exposure is adjusted for the protective effect of bednets.

Usage

calculate_Exp(df, df_bites, protection = 0.92)

Arguments

df

A dataframe with individual-level data, including columns:

  • individual – individual ID,

  • hour – hour of the day (0–23),

  • state – activity/location state (1 = outdoors, 2 = indoors awake, 3 = indoors asleep, 4 = indoors asleep under bednet),

  • bednet_user – logical indicator of bednet use (TRUE/FALSE).

df_bites

A dataframe of biting rates by hour, with columns:

  • hour – hour of the day (0–23),

  • indoor_bites – number of bites indoors,

  • outdoor_bites – number of bites outdoors.

protection

A numeric value (default = 0.92, according to Corbel et al. 2009 for Permanet 2 ITNs) indicating the proportion of bites prevented by bednet use.

Details

The mathematical model of behavioral interactions is an extension of the Killeen’s model (1) as previously described in Geissbühler et al. (2) and Moiroux et al. (3)

(1) Killeen, Gerry F., Japhet Kihonda, Edith Lyimo, Fred R. Oketch, Maya E. Kotas, Evan Mathenge, Joanna A. Schellenberg, Christian Lengeler, Thomas A. Smith, and Chris J. Drakeley. ‘Quantifying Behavioural Interactions between Humans and Mosquitoes: Evaluating the Protective Efficacy of Insecticidal Nets against Malaria Transmission in Rural Tanzania’. BMC Infectious Diseases 6 (2006): 161. https://doi.org/10.1186/1471-2334-6-161.

(2) Geissbühler, Yvonne, Prosper Chaki, Basiliana Emidi, Nicodemus J. Govella, Rudolf Shirima, Valeliana Mayagaya, Deo Mtasiwa, et al. ‘Interdependence of Domestic Malaria Prevention Measures and Mosquito-Human Interactions in Urban Dar Es Salaam, Tanzania’. Malaria Journal 6 (2007): 126. https://doi.org/10.1186/1475-2875-6-126.

(3) Moiroux, Nicolas, Georgia B. Damien, Marc Egrot, Armel Djenontin, Fabrice Chandre, Vincent Corbel, Gerry F. Killeen, and Cédric Pennetier. ‘Human Exposure to Early Morning Anopheles Funestus Biting Behavior and Personal Protection Provided by Long-Lasting Insecticidal Nets’. PloS One 9, no. 8 (2014): e104967. https://doi.org/10.1371/journal.pone.0104967.

Reference for the protection parameter:

(4) Corbel, Vincent, Joseph Chabi, Roch K. Dabiré, Josiane Etang, Philippe Nwane, Olivier Pigeon, Martin Akogbeto, and Jean-Marc Hougard. ‘Field Efficacy of a New Mosaic Long-Lasting Mosquito Net (PermaNet 3.0) against Pyrethroid-Resistant Malaria Vectors: A Multi Centre Study in Western and Central Africa’. Malaria Journal 9 (27 April 2010): 113. https://doi.org/10.1186/1475-2875-9-113.

Value

A dataframe with one row per hour (0–23) and the following columns:

  • Bi_t – indoor biting rate,

  • Bo_t – outdoor biting rate,

  • N – number of human individuals,

  • Np – number of human individuals that are net users,

  • It – proportion of people indoors (users and non-users),

  • Eui – mean exposure of non-users indoors,

  • Euo – mean exposure of non-users outdoors,

  • Eu – total mean exposure of non-users,

  • p_in – proportion of people (users) being indoors,

  • p_net – proportion of people (users) being asleep (under net),

  • Epi – mean exposure of users indoors (not under net),

  • Epn – mean exposure of users indoors under bednet (adjusted by protection),

  • Epo – mean exposure of users outdoors,

  • Epp – mean exposure prevented by bednet use,

  • Ep – total mean exposure of users.

Examples

# generate fake data 
df <- gen_df_human(n_individuals = 100, hours = c(0:9,17:23))
df_bites <- gen_df_mosquito() 
# calculate mean hourly exposure to bites
exposure_results <- calculate_Exp(df, df_bites)

Generate a Simulated Dataset of Human Behavioral States Over 24 Hours

Description

Simulates the hourly state of a set of individuals (either bednet users or non-users) over a 24-hour period. Each individual's state is assigned probabilistically based on the hour of the day and whether they use a bednet.

Usage

gen_df_human(n_individuals = 100, hours = c(0:23), prob_use = 0.5)

Arguments

n_individuals

Integer. Number of individuals to simulate. Default is 100.

hours

Integer vector. The hours of the day to simulate, typically 0:23. Default is 0:23.

prob_use

Numeric. Probability of being a bednet user vs non-user. Default is 0.5.

Value

A data.frame with the following columns:

individual

Individual ID.

hour

Hour of the day (0–23).

bednet_user

Logical, indicating whether the individual is a bednet user.

state

Integer representing the individual’s state at that hour: 1 = outdoors, 2 = indoors and awake, 3 = indoors asleep (non-user), 4 = indoors asleep under bednet (user).

state_label

Factor version of state with descriptive labels.

Examples

df <- gen_df_human(n_individuals = 50)
df <- gen_df_human(n_individuals = 100, hours = c(0:9,17:23))
head(df)

Generate a Simulated Dataset of Hourly Mosquito Biting Rates

Description

Simulates the number of Anopheles mosquito bites occurring indoors and outdoors for each hour of the day. Biting rates follow predefined lambda patterns that reflect typical mosquito activity (e.g., low during the day, peaking at night).

Usage

gen_df_mosquito()

Value

A data.frame with the following columns:

hour

Hour of the day (0–23).

indoor_bites

Simulated number of mosquito bites occurring indoors for each hour.

outdoor_bites

Simulated number of mosquito bites occurring outdoors for each hour.

Examples

df_bites <- gen_df_mosquito()
head(df_bites)

Plot Human and Mosquito Behaviors by Hour

Description

Generates a dual-axis plot showing the hourly variation in human behavior (proportion of individuals indoors and under bednets) and mosquito biting behavior (biting rates indoors and outdoors). Human behavior is shown as a stacked area plot on the primary Y-axis, while mosquito biting rates are shown as lines on the secondary Y-axis. Hours are centered on midnight.

Usage

plot_behaviors(data)

Arguments

data

A dataframe (typically the output of calculate_Exp) containing the following columns:

  • hour – hour of the day (0–23),

  • p_in – proportion of users indoors (not under a net),

  • p_net – proportion of users under a net,

  • Bi_t – indoor mosquito biting rate,

  • Bo_t – outdoor mosquito biting rate.

Value

A ggplot2 plot object with a stacked area chart for human behavior (on the primary Y-axis) and line plots for mosquito biting rates (on the secondary Y-axis), with hours centered on midnight.

Examples

# Assuming `result` is the output from `calculate_Exp()`
plot_behaviors(result)

Plot Exposure to Mosquito Bites by Hour for Bednet Users

Description

Creates a stacked area chart showing the hourly distribution of exposure to mosquito bites among bednet users, broken down by exposure type: outdoors, indoors (no net), indoors (under net), and prevented exposure due to bednet use. The hours are centered on midnight for better visualization.

Usage

plot_exposure(data, cPalette = c("#000000", "#E69F00", "#56B4E9", "#009E73"))

Arguments

data

A dataframe resulting from the calculate_Exp function, containing columns:

  • hour – hour of the day (0–23),

  • Epo – exposure outdoors,

  • Epi – exposure indoors (not under a net),

  • Epn – exposure indoors under a net,

  • Epp – exposure prevented by net use.

cPalette

A character vector of color values (hex codes or color names) used to fill each exposure category. Must be of length 4 and will be applied in the following order: Prevented, Indoor (under net), Indoor (no net), Outdoor. Defaults to c("#000000", "#E69F00", "#56B4E9", "#009E73").

Value

A ggplot2 stacked area chart object showing the distribution of exposure types across centered hours.

Examples

# Assuming `result` is the output from `calculate_Exp()`
plot_exposure(result)

Summarize Exposure to Mosquito Bites Over 24h and a Time Interval

Description

Computes daily (24h) and interval-specific exposure statistics for both non-users and bednet users, based on the output of calculate_Exp. Protective efficacy of bednets and proportion of exposure indoors or during the specified interval are computed.

Usage

summarise_exposure(data, interval = c(22, 5))

Arguments

data

A dataframe returned by calculate_Exp(), including columns:

  • Eui, Euo, Eu – indoor, outdoor, and total exposure for non-users,

  • Epi, Epn, Epo, Epp, Ep – indoor, indoor under net, outdoor, prevented, and total exposure for users,

  • hour – hour of the day (0–23).

interval

A numeric vector of length 2 giving the start and end hour (inclusive) of the time interval, e.g., c(22, 5) for 10pm to 5am. Wraps over midnight if needed.

Details

The mathematical model of behavioral interactions is an extension of the Killeen’s model (1) as previously described in Geissbühler et al. (2) and Moiroux et al. (3)

(1) Killeen, Gerry F., Japhet Kihonda, Edith Lyimo, Fred R. Oketch, Maya E. Kotas, Evan Mathenge, Joanna A. Schellenberg, Christian Lengeler, Thomas A. Smith, and Chris J. Drakeley. ‘Quantifying Behavioural Interactions between Humans and Mosquitoes: Evaluating the Protective Efficacy of Insecticidal Nets against Malaria Transmission in Rural Tanzania’. BMC Infectious Diseases 6 (2006): 161. https://doi.org/10.1186/1471-2334-6-161.

(2) Geissbühler, Yvonne, Prosper Chaki, Basiliana Emidi, Nicodemus J. Govella, Rudolf Shirima, Valeliana Mayagaya, Deo Mtasiwa, et al. ‘Interdependence of Domestic Malaria Prevention Measures and Mosquito-Human Interactions in Urban Dar Es Salaam, Tanzania’. Malaria Journal 6 (2007): 126. https://doi.org/10.1186/1475-2875-6-126.

(3) Moiroux, Nicolas, Georgia B. Damien, Marc Egrot, Armel Djenontin, Fabrice Chandre, Vincent Corbel, Gerry F. Killeen, and Cédric Pennetier. ‘Human Exposure to Early Morning Anopheles Funestus Biting Behavior and Personal Protection Provided by Long-Lasting Insecticidal Nets’. PloS One 9, no. 8 (2014): e104967. https://doi.org/10.1371/journal.pone.0104967.

Value

A tibble with three columns:

type

Character string indicating the category of summary: "non_user_daily", "user_daily", "non_user_interval", "user_interval", "interval_vs_daily" or "net_efficacy".

output

Name of the exposure component or metric (e.g., "Eui", "Euo", "Ep", "Epp", "prop_indoor", etc., "prop_interval_non_user", "prop_interval_user" and "prop_prevented").

value

Numeric value corresponding to the output for the given type.

Examples

# Assuming `result` is the output from calculate_Exp()
summarise_exposure(result, interval = c(22, 5))