Skip to contents

This function models the effect of vaccination over time using a scaled hyperbolic tangent function to simulate the proportion of vaccinated individuals.

Usage

vac(x, maxv, scale, start)

Arguments

x

Numeric vector representing time.

maxv

Maximum vaccination effect or uptake level.

scale

Scaling factor controlling the rate of change.

start

The time point at which vaccination starts to take effect.

Value

A numeric vector representing the vaccination effect, ensuring non-negative values.

Details

The function applies a hyperbolic tangent transformation to model vaccination uptake. The result is capped at a minimum of zero using `pmax()` to prevent negative values.

Examples

x <- seq(0, 100, by = 1)
maxv <- 0.8
scale <- 10
start <- 50
vac_effect <- vac(x, maxv, scale, start)
plot(x, vac_effect, type = "l", main = "Vaccination Effect Over Time")