## ----include = FALSE---------------------------------------------------------- knitr::opts_chunk$set( collapse = TRUE, comment = "#>" ) ## ----setup-------------------------------------------------------------------- library(tempodisco) ## ----------------------------------------------------------------------------- data("td_bc_single_ptpt") mod <- kirby_score(td_bc_single_ptpt) print(mod) ## ----------------------------------------------------------------------------- mod_exp <- kirby_score(td_bc_single_ptpt, discount_function = 'exponential') print(mod_exp) mod_pow <- kirby_score(td_bc_single_ptpt, discount_function = 'power') print(mod_pow) mod_ari <- kirby_score(td_bc_single_ptpt, discount_function = 'arithmetic') print(mod_ari) ## ----------------------------------------------------------------------------- mod <- wileyto_score(td_bc_single_ptpt) print(mod) ## ----------------------------------------------------------------------------- mod <- td_bclm(td_bc_single_ptpt, model = 'all') print(mod) ## ----------------------------------------------------------------------------- mod <- td_bcnm(td_bc_single_ptpt, discount_function = 'all') print(mod) ## ----------------------------------------------------------------------------- # Probit choice rule: mod <- td_bcnm(td_bc_single_ptpt, discount_function = 'exponential', choice_rule = 'probit') # Power choice rule: mod <- td_bcnm(td_bc_single_ptpt, discount_function = 'exponential', choice_rule = 'power') ## ----------------------------------------------------------------------------- data("td_bc_study") # Select the second participant second_ptpt_id <- unique(td_bc_study$id)[2] df <- subset(td_bc_study, id == second_ptpt_id) mod <- td_bcnm(df, discount_function = 'exponential', fit_err_rate = T) plot(mod, type = 'endpoints', verbose = F) lines(c(0, 1), c(0, 0), lty = 2) lines(c(0, 1), c(1, 1), lty = 2) cat(sprintf("epsilon = %.2f\n", coef(mod)['eps'])) ## ----------------------------------------------------------------------------- mod <- td_bcnm(df, discount_function = 'exponential', fixed_ends = T) plot(mod, type = 'endpoints', verbose = F, del = 50, val_del = 200)