Learn R Programming

ggdmc (version 0.2.5.2)

sumloglike: Calculate Summed, Log-likelihood of a Cognitive Model

Description

The function calculates log-likelihood for every trial. The input must be a data model instance.

Usage

sumloglike(pVec, pnames, allpar, parnames, model, type, dim1, dim2, dim3,
  n1idx, ise, cellidx, RT, matchcell, isr1, posdrift, nsim, bw, ncore,
  gpuid, debug)

Arguments

pVec

a parameter vector

pnames

a string vector storing the name of a parameter vector

allpar

all parameters

parnames

parameter names

model

a model specification

type

model type

dim1

first dimension of a model

dim2

second dimension of a model

dim3

third dimension of a model

n1idx

n1 order index

ise

an index vector storing if a cell is empty.

cellidx

cell index

RT

a RT vector

matchcell

an index vector storing is the cell is a match response

isr1

is r1 index

posdrift

a Boolean switch to enforce postive drift rate correction

nsim

number of simulation

bw

bandwidth

ncore

number of parallel core

gpuid

GPU card index on a multiple GPU machine

debug

whether to print debugging information for assuming drift rates are drawn from a normal distribution.

Value

a double scalar

Examples

Run this code
# NOT RUN {
m1 <- BuildModel(
  p.map     = list(a = "1", v = "1", z = "1", d = "1", sz = "1", sv = "1",
              t0 = "1", st0 = "1"),
  constants = c(st0 = 0, d = 0),
  match.map = list(M = list(s1 = "r1", s2 = "r2")),
  factors   = list(S = c("s1", "s2")),
  responses = c("r1", "r2"),
  type      = "rd")

p.vector <- c(a = 1, v = 1, z = 0.5, sz = 0.25, sv = 0.2, t0 = .15)

## Set up a model-data instance
dat <- simulate(m1, 128, ps = p.vector)
dmi <- BuildDMI(dat, m1)
## sumloglike(p.vector, dmi)
## [1] 0.3796048
# }

Run the code above in your browser using DataLab