View source: R/computeInfoVal2IFC.R
| computeInfoVal2IFC | R Documentation |
Computes the Informational Value of a single CI from a 2IFC task.
computeInfoVal2IFC(
target_ci,
rdata,
iter = 10000,
force_gen_ref_dist = FALSE,
response_seed = NULL,
baseimage = NULL
)
target_ci |
A classification image, as the list returned by |
rdata |
Path to the |
iter |
Number of simulated classification images in the reference distribution. Used only when the reference distribution has to be simulated. |
force_gen_ref_dist |
Boolean: simulate the reference distribution again even if the |
response_seed |
Optional seed for the simulated random responses behind the reference
distribution. The default, |
baseimage |
The base-image label |
The Informational Value is a z-score for the signal in a classification image: the higher it is, the more signal. A cut-off such as z = 1.96 selects classification images with significant signal at alpha = 0.05.
It is computed against a reference distribution: classification images simulated from random responses under the same task parameters as the real data. The Informational Value expresses how unlikely the observed CI is under the null hypothesis that the responses were random.
Simulating the reference distribution takes a long time. It is simulated whenever the
rdata file does not already hold one, and then stored there for reuse. If the file
cannot be written, the simulated reference is used for this call only: a note names the file
(and, for independent base images, the base) that could not be updated, and the next call
simulates it again. An archive on read-only media can therefore still be scored, at the cost of
simulating each time.
For the method, see Brinkman, L., Goffin, S., van de Schoot, R., van Haren, N. E. M., Dotsch, R., & Aarts, H. (2019). Quantifying the informational value of classification images. Behavior Research Methods, 51, 2059-2073. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.3758/s13428-019-01232-2")}
The Informational Value, a z-score.
# a synthetic square grayscale image stands in for a real base face photo
base_face <- tempfile(fileext = ".png")
png::writePNG(matrix(runif(32 * 32), 32, 32), base_face)
stimulus_path <- tempfile("stimuli")
generateStimuli2IFC(
base_face_files = list(face = base_face),
n_trials = 6,
img_size = 32,
stimulus_path = stimulus_path,
seed = 1,
ncores = 1,
nscales = 1,
save_as_png = FALSE
)
rdata_file <- list.files(stimulus_path, pattern = "\\.Rdata$", full.names = TRUE)[1]
# compute (and cache in rdata_file) a reference distribution; iter is kept
# tiny here for a fast example, in practice use iter >= 10000.
suppressWarnings(generateReferenceDistribution2IFC(rdata_file, iter = 3, ncores = 1))
responses <- sample(c(1, -1), 6, replace = TRUE)
target_ci <- generateCI(
stimuli = 1:6, responses = responses, baseimage = "face",
rdata = rdata_file, save_as_png = FALSE
)
computeInfoVal2IFC(target_ci = target_ci, rdata = rdata_file)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.