BuildDMI {ggdmcModel}R Documentation

Build Data Model Instance

Description

Constructs a Data Model Instance (DMI) from data and model specifications. The DMI builder can handle different model types including the Linear Ballistic Accumulator, the Diffusion Decision and hyperparameter. The process of building a 'hyperparameter' DMI amounts to constructing a joint distribution over conventional statistical models.

Usage

BuildDMI(data, model)

Arguments

data

A data frame to be converted to a DMI object.

model

A model specification object of class model containing parameters, and other model-specific information. This is typically created using the 'BuildModel' function.

Value

A 'dmi' object or a list of 'dmi' objects (multiple subjects), with structure:

Each 'dmi' object contains:

Model Types Supported

'"lba"'

Linear Ballistic Accumulator model

'"hyper"'

Hyperparameter model

'"fastdm"'

Diffusion Decision model

Examples

# Hyperparameter model example
hyper_model <- BuildModel(
    p_map = list(A = "1", B = "1", mean_v = "M", sd_v = "1", st0 = "1", t0 = "1"),
    match_map = list(M = list(s1 = "r1", s2 = "r2")),
    factors = list(S = c("s1", "s2")),
    constants = c(sd_v = 1, st0 = 0),
    accumulators = c("r1", "r2"),
    type = "hyper",
    verbose = FALSE
)

# LBA model example
model <- BuildModel(
    p_map = list(A = "1", B = "1", t0 = "1", mean_v = "M", sd_v = "1", st0 = "1"),
    match_map = list(M = list(s1 = "r1", s2 = "r2")),
    factors = list(S = c("s1", "s2")),
    constants = c(st0 = 0, sd_v = 1),
    accumulators = c("r1", "r2"),
    type = "lba"
)

dat <- data.frame(
  RT = c(0.7802726, 0.7890208, 1.3222672, 0.8376305, 0.7144698),
  R  = c("r1", "r1", "r2", "r1", "r1"),
  s  = c(1, 1, 1, 1, 1),
  S  = c("s1", "s1", "s1", "s1", "s1"),
  stringsAsFactors = FALSE
)

sub_dmis <- BuildDMI(dat, model)


[Package ggdmcModel version 0.2.9.0 Index]