Description Usage Arguments Details Value Examples
Ontogenetic shifts in central-place foraging insects
1 |
name |
The identity of the insect (e.g. a bee) as factor (e.g. "A00103C00020C301", "bee1"). |
Age |
The age of the insect in day as numeric (e.g. 1, 4, 32). |
x |
The daily activity of the insect at a given age as a numeric value, for instance (i) the number of the trips per day, (ii) the duration of the trips per day, or (iii) the time of the trips per day. |
A breakpoint-based method to detect ontogenetic shifts in univariate time-activity budget series of central-place foraging insects. The method finds a single change point according to the likelihood function. The method was developed with honey bees in order to detect the Age at Onset of Foraging (AOF), but can be used for the detection of other ontogenetic shifts in other central-place foraging insects. For more details, see Requier et al. (2020) Measuring ontogenetic shifts in central-place foraging insects: a case study with honey bees. Journal of Animal Ecology.
A data.frame containing the aof results (one row per insect).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | require("bcpa")
# Exemple with simulated data:
# A study case with with change simulated (i.e. mu1 and mu2 are different)
# --------------------------------------------------
mu1 <- 25 # behavioural value at stage 1
mu2 <- 50
rho1 <- 0.5 # interval frequency at stage 1
rho2 <- rho1
# Low number of individuals (N, n.obs) and low variance (V, sigma)
# create time series from 0 to 50 with a behavioural change at 25
t.full <- 0:50
t.break <- 25
n.obs <- 35 # no. observations randomly selected in the time series: 5 to 45
sigma1 <- 0.1 # variance: 0.1 to 3
sigma2 <- sigma1
SimTS <- function(n, mu, rho, sigma){
X.standard <- arima.sim(n, model = list(ar = rho))
X.standard/sd(X.standard)*sigma + mu
}
x.full <- c(SimTS(t.break, mu1, rho1, sigma1),
SimTS(max(t.full)-t.break+1, mu2, rho2, sigma2))
# subsample of observations (n defined above) and estimate
keep <- sort(sample(1:length(x.full), n.obs))
TimeBudget <- data.frame(
name = "A",
Age = t.full[keep],
x = x.full[keep])
# Running the algorithm
AOF <- aof(
name = TimeBudget$name,
Age = TimeBudget$Age,
x = TimeBudget$x)
print(AOF)
# Exemple with real data extracted from Requier et al.
# (2020, J. Animal Ecology):
# --------------------------------------------------
TimeBudget <- dataExample
# working on Number of trips
varX <- "Number"
AOF_number <- aof(
name = TimeBudget[,1],
Age = TimeBudget[,2],
x = TimeBudget[varX])
print(AOF_number)
# working on Duration of trips
varX <- "Duration"
AOF_duration <- aof(
name = TimeBudget[,1],
Age = TimeBudget[,2],
x = TimeBudget[varX])
print(AOF_duration)
# working on Time of trips
varX <- "Time"
AOF_time <- aof(
name = TimeBudget[,1],
Age = TimeBudget[,2],
x = TimeBudget[varX])
print(AOF_time)
# see vignette for more examples
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.