bind_condition2parameters_r: Map Experimental Conditions to Model Parameters

View source: R/RcppExports.R

split_parameter_x_conditionR Documentation

Map Experimental Conditions to Model Parameters

Description

Binds experimental conditions to model parameters by combining parameter mappings and experimental factors, automatically handling the 'M' ( matching) factor, specifically for the Linear Ballisitic Accumulation Model. split_parameter_x_condition separates bound parameters and conditions.

Usage

split_parameter_x_condition(parameter_M_r)

bind_condition2parameters_r(parameter_map_r, factors_r)

Arguments

parameter_M_r

a string vector of parameter x condition.

parameter_map_r

A named list received from R (converted to Rcpp::List) where:

  • Names correspond to parameter names

  • Elements are character vectors mapping conditions to parameter

factors_r

A named list of experimental factors where:

  • Names are factor names

  • Elements are character vectors of factor levels

Details

This function:

  1. Converts R lists to C++ std::map containers for efficient lookup

  2. Processes the parameter mapping through 'add_M()' to handle response mappings

  3. Returns human-readable parameter-condition pairs

Value

A character vector where each element represents a parameter-condition binding in the format 'parameter.condition'. The special 'M' factor is to represent matching and non-matching true/false in the LBA model.

C++ Implementation

The function uses:

  • Rcpp::List to take the 'list' from R and convert it to C++ std::map for efficient key-value lookups

  • std::vector for storing the resulting parameter-condition pairs

  • Rcpp::CharacterVector for returning the result to R

Examples

p_map <- list(A = "1", B = "1", t0 = "1", mean_v = c("M", "S"), sd_v = "1",
          st0 = "1")
factors <- list(S = c("s1", "s2"))
parameter_M <-bind_condition2parameters_r(p_map, factors)
# [1] "A"               "B"               "mean_v.s1.false" "mean_v.s1.true"
# [5] "mean_v.s2.false" "mean_v.s2.true"  "sd_v"            "st0"
# [9] "t0"

result <- split_parameter_x_condition(parameter_M)
# [[1]]
# [1] "A"
#
# [[2]]
# [1] "B"
#
# [[3]]
# [1] "mean_v" "s1"     "false"
#
# [[4]]
# [1] "mean_v" "s1"     "true"
#
# [[5]]
# [1] "mean_v" "s2"     "false"
#
# [[6]]
# [1] "mean_v" "s2"     "true"
#
# [[7]]
# [1] "sd_v"
#
# [[8]]
# [1] "st0"
#
# [[9]]
# [1] "t0"

ggdmcModel documentation built on Aug. 8, 2025, 7:50 p.m.