# fleshler_hoffman()

## Introduction

The task of designing reinforcement schedules often face the challenge of generating intervals that mimic the variability observed in naturalistic environments while ensuring experimental control and reliability. The Fleshler & Hoffman (1962) progression offers a theoretical framework to address this challenge, providing a method for the systematic calculation of variable intervals for behavioral experiments.

At its core, the Fleshler and Hoffman progression leverages principles from the Poisson process, a stochastic model widely used to describe the occurrence of rare events over time. By employing the inverse of the Poisson process, characterized by the function \(−log(1−p)^{-1}\), where \(p\) denotes the probability of reinforcement per unit of time, the progression facilitates the calculation of intervals approximating an exponential distribution. This approach ensures that the expected value of the intervals aligns with the desired variable-interval parameter.

The formula for calculating such distribution can be described as follow:

\[t_n = \left[-\log_e(1 - p)\right]^{-1} \left[1 + \log_e(N) + (N - n) \log_e(N - n) - (N - n + 1) \log_e(N - n + 1)\right]\] Where \(t_n\), is the \(n^{th}\) term of the progression; \(N\) is the total number of terms; and \(p\) is the fixed probability of the event within a unit interval.

Here we introduce the `fleshler_hoffman()` function which calculate a distribution with \(N\) intervals such that the mean is equal to the \(VI\) value with an exponential increase for each subsequent element. The function takes the following parameters:

- `N` the number of intervals to obtain.
- `VI` the Variable Interval value (the expected value or mean of the intervals).

## Example

Let’s create a distribution of 12 elements with a VI of 30s:

    # Calculate intervals for N = 10, and IV = 30
    N <- 12
    VI <- 30

    intervals <- round(fleshler_hoffman(N, VI), 3)
    print(intervals)

    ##  [1]   1.286   4.017   7.022  10.363  14.122  18.423  23.446  29.487  37.067
    ## [10]  47.261  62.958 104.547

Now let’s plot the intervals and the exponential distribution corresponding to the same mean (VI):

## References

Fleshler, M., & Hoffman, H. S. (1962). A progression for generating variable-interval schedules. Journal of the Experimental Analysis of Behavior, 5(4), 529.