fit_dd {beezdiscounting}R Documentation

Fit Delay-Discounting Model

Description

This function fits a delay-discounting model to the given dataset using the specified equation and method.

Usage

fit_dd(dat, equation, method)

Arguments

dat

A data frame containing delay (x) and indifference point (y) data. For "two stage" methods, the data must include an id column to identify participants.

equation

A character string specifying the delay-discounting equation to use. Options include:

  • "mazur" or "hyperbolic": Hyperbolic delay-discounting model (y = 1 / (1 + k \cdot x)).

  • "exponential": Exponential delay-discounting model (y = \exp(-k \cdot x)).

method

A character string specifying the method for fitting the model. Options include:

  • "pooled" or "agg": Fits the model using pooled data.

  • "mean": Fits the model using the mean of indifference points at each delay.

  • "ts" or "two stage": Fits the model separately for each participant (requires an id column in dat).

Value

A list object of class "fit_dd", containing:

Examples

data <- data.frame(
  id = rep(1:2, each = 6),
  x = rep(c(1, 7, 30, 90, 180, 365), 2),
  y = c(0.9, 0.5, 0.3, 0.2, 0.1, 0.05, 0.85, 0.55, 0.35, 0.15, 0.1, 0.05)
)
fit_dd(data, equation = "mazur", method = "two stage")

[Package beezdiscounting version 0.3.2 Index]