getAccumulatorMatrix: Map a parameter vector to an accumulator matrix

Description Usage Arguments Value Examples

Description

An Rcpp function to get accumulator x parameter matrix for a design cell. For two accumulator model, like drift-diffusion model, the accumulators are r1 and r2. For mulitple-accumulator model, like LBA model, the accumulators are r1, r2, r3, etc. But because LBA probability density has yet implemented, the function now only works for DDM. The part calling transform.dmc is replaced by ordering the parameter sequence inside density.cpp. The n1order switch is still kept, until the R's simulate.dmc is upgraded to C++ version. This function is akin to DMC's p.df.dmc. This is a Rcpp function.

Usage

1
getAccumulatorMatrix(pVec, cell, model, n1order = TRUE)

Arguments

pVec

a user supplied parameter vector or a sampler supplied theta/phi vector.

cell

a string indicating the name of a experimental condition

model

an EAM model specification, created usually by model.dmc. Read as a NumericVector, so attributes are kept.

n1order

a boolean value indicating if swap accumulator row to use "n1" order. This is for LBA model

Value

an accumulator x EAM parameter matrix (without factor level).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
m1 <- model.dmc(
    p.map     = list(a="1",v="F",z="1",d="1",sz="1",sv="F",t0="1",st0="1"),
    match.map = list(M=list(s1="r1", s2="r2")),
    factors   = list(S=c("s1","s2"), F=c("f1","f2")),
    constants = c(st0=0,d=0),
    responses = c("r1","r2"),
    type      = "rd")
# Parameter vector names are: ( see attr(,"p.vector") )
# [1] "a"     "v.f1"  "v.f2"  "z"     "sz"    "sv.f1" "sv.f2" "t0"
#
# Constants are (see attr(,"constants") ):
#   st0   d
#     0   0
#
# Model type = rd

attr(m1,"p.vector")
# a  v.f1  v.f2     z    sz sv.f1 sv.f2    t0
# NA    NA    NA    NA    NA    NA    NA    NA
pVec <- c(1,1,1,1, 1,1,1,1)
names(pVec) <- names(attr(m1, "p.vector"))

accMat1 <- getAccumulatorMatrix(pVec, "s1.f1.r2", m1, FALSE)
##         col_names
##row_names a v z d sz sv t0 st0
##       r1 1 1 0 0  1  1  1   0
##       r2 1 1 0 0  1  1  1   0
accMat2 <- getAccumulatorMatrix(pVec, "s1.f1.r2", m1, TRUE)

TasCL/ggdmc documentation built on May 9, 2019, 4:19 p.m.