nROUSE_logLik: The log-likelihood function for the nROUSE model

Description Usage Arguments Value Examples

Description

Calculates the sum of the log-likelihoods for the nROUSE model given a set of data. This function can be used in an optimization routine, like optim to obtain estimates of the nROUSE model parameters.

Usage

1
nROUSE_logLik(par, dat, mapping = c(2, 6, 8), predict = F, estimate = T)

Arguments

par

a vector of log-transformed estimates for the subset of nROUSE parameters.

dat

a matrix (or data frame) with a set of named columns:

TarDur

The duration of the target flash in ms.

MaskDur

The duration of the mask in ms.

PrimeDur

The duration of the prime in ms.

Type

The input for the prime. Negative values denote foil primes, positive values indicate target primes.

Y

The number of correct responses per condition.

N

The total number of items per condition.

mapping

an index for which parameters of the nROUSE model to estimate.

  1. The feedback scalar.

  2. The noise multiplier.

  3. The constant leak current.

  4. The synaptic depletion rate.

  5. The replenishment rate.

  6. The inhibition constant.

  7. The noise multiplier.

  8. The temporal attention parameter.

  9. The visual integration rate.

  10. The orthographic integration rate.

  11. The semantic integration rate.

predict

a logical value. If true, returns the predicted proportion correct per condition.

estimate

a logical value. If true, returns the sum of the log-likelihoods. If false, returns a vector of log-likelihoods.

Value

If predict = TRUE, returns the predicted proportion correct per condition. Otherwise, if estimate = TRUE, returns the sum of the log-likelihoods. If neither variable is set to TRUE, returns the vector of log-likelihoods.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
# Load in example data set
data('priming_ex')
# Select a single subject
d = priming_ex[ priming_ex$Subject == 1, ]

# Specify a set of log-transformed starting values
sv = log( c( N = .0302, I = .9844, Ta = 1 ) )
# Estimate the parameters using maximum likelihood
mle = optim( sv, nROUSE_logLik, dat = d, 
  control = list( fnscale = -1, maxit = 10000 ) )

# Print the parameter estimates
round( exp( mle$par ), 3 )
# Compare to default values:
# N  = 0.030
# I  = 0.9844
# Ta = 1.0

# Generate predicted accuracy from the estimates
pred = nROUSE_logLik( mle$par, d, predict = T )
# Compare predicted against observed
print( round( pred - d$P, 3 ) )

rettopnivek/nROUSE documentation built on May 27, 2019, 5:55 a.m.