likelihood_norm: Calculate log likelihoods

Description Usage Arguments Value References Examples

View source: R/likelihood.R

Description

These function calculate log likelihoods. likelihood_rd implements the equations in Voss, Rothermund, and Voss (2004). These equations calculate diffusion decision model (Ratcliff & Mckoon, 2008). Specifically, this function implements Voss, Rothermund, and Voss's (2004) equations A1 to A4 (page 1217) in C++.

Usage

1
2
3
4
5
6
7
likelihood_norm(x, data, min_lik = 1e-10)

likelihood_norm_pda(x, data, min_lik = 1e-10)

likelihood_rd(x, data, min_lik = 1e-10)

likelihood_cnorm(x, data, min_lik = 1e-10)

Arguments

x

a parameter vector

data

data model instance

min_lik

minimal likelihood.

Value

a vector

References

Voss, A., Rothermund, K., & Voss, J. (2004). Interpreting the parameters of the diffusion model: An empirical validation. Memory & Cognition, 32(7), 1206-1220.

Ratcliff, R. (1978). A theory of memory retrival. Psychological Review, 85, 238-255.

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
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 = 1, s2 = 2)),
factors   = list(S = c("s1", "s2")),
constants = c(st0 = 0, sd_v = 1),
responses = c("r1", "r2"),
type      = "norm")

p.vector <- c(A = .25, B = .35,  t0 = .2, mean_v.true = 1, mean_v.false = .25)
dat <- simulate(model, 1e3,  ps = p.vector)
dmi <- BuildDMI(dat, model)
den <- likelihood_norm(p.vector, dmi)
## den <- likelihood_norm_pda(p.vector, dmi) ## This takes more than 1 s, so commented out

model <- BuildModel(
p.map     = list(a = "1", v = "1", z = "1", d = "1", t0 = "1", sv = "1",
            sz = "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)
dat <- simulate(model, 1e2, ps = p.vector)
dmi <- BuildDMI(dat, model)
den <- likelihood_rd(p.vector, dmi)

ggdmc documentation built on Sept. 2, 2018, 1:03 a.m.