R/RcppExports.R

Defines functions advisorChoiceError trustUpdate

Documented in advisorChoiceError trustUpdate

# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

#' Calculates the evolving trust scores based on agreement
#'
#' @param trust Matrix of trust values - dims = trials x advisors
#' @param advisorId ids of the advisor giving advice on each trial
#' @param advisorAgrees whether advisor agrees on each trial
#' @param updateRate amount to down/upweight trust given dis/agreement
#' @return New trust values after iterating through and up/downweighting trust
trustUpdate <- function(trust, advisorId, advisorAgrees, updateRate) {
    .Call(`_adviseR_trustUpdate`, trust, advisorId, advisorAgrees, updateRate)
}

#' Calculate choice error averaged over the last 5 trials
#' @param trust Matrix of trust values - dims = trials x advisors
#' @param advisorIndex indices of chosen advisors
#' @param choice0 indices of the advisor in the first choice slot
#' @param choice1 indices of the advisor in the second choice slot
#' @param slope slope of the sigmoid function
#' @param nBack number of trials to look back. Looks at previous trials where
#'   the advisorIndex advisor is in one of the choice slots.
#'
#' @return Matrix of mean pick rate for the advisorIndex advisor (column 1) and
#'   mean predicted pick rate for that advisor (column 2)
advisorChoiceError <- function(trust, advisorIndex, choice0, choice1, slope, nBack = 5L) {
    .Call(`_adviseR_advisorChoiceError`, trust, advisorIndex, choice0, choice1, slope, nBack)
}
oxacclab/adviseR documentation built on Oct. 7, 2021, 8:05 p.m.