Description Usage Arguments Details Value Examples
Convert df with one x and one y value per row into trapezoidal data where x values represent successive indexes (i.e., successive delays, cognitive effort, probability) and y values represent subjective values associated with the delay.
1 |
df |
A data frame with one x and one y value on each line |
x |
Column of data frame containing trial index (i.e., successive delays, cognitive effort, probability). traper function sorts the data by x. The user should normalize data to obtain canonical auc ranging from 0 to 1. |
y |
Column of data frame containing subjective values (or scores). The user should normalize data to obtain canonical auc ranging from 0 to 1. |
rename |
Change name of x_lead and y_lead columns to x_lead and y_lead |
Citation: Myerson, J., Green, L., & Warusawitharana, M. (2001). Area under the curve as a measure of discounting. Journal of the experimental analysis of behavior, 76 2, 235-43 .
Data frame where each row contains the data to compute the area of one trapezoid. The *_lead columns are the x and y values from the next row.
1 2 3 4 5 6 7 8 9 10 | #Create data frame with successive delays and subjective values
df_test <- data.frame(delay = sample(1:100, 50, replace = FALSE),
value = sample(1:100, 50, replace = TRUE))
#Normalize data in preparation for auc calculation
df_test$delay <- df_test$delay/max(df_test$delay)
df_test$value <- df_test$value/max(df_test$value)
#Reformat data in preparation to compute the trapezoidal auc
df_test_2 <- traper(df_test, x = delay, y = value, rename = TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.