@decidables/detectable-elements 0.1.2 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -33,199 +33,6 @@ for use in HTML.
33
33
 
34
34
  Building blocks for interactive visualizations of SDT
35
35
 
36
- #### `RDKTask` / `<rdt-task>`
37
-
38
- Displays stimuli for random dot kinematogram signal detection task
39
-
40
- When run, a block of trials is presented. Before each trial is an inter-trial interval (ITI). Each
41
- trial then consists of a stimulus followed by a period of waiting for a response. The stimulus
42
- consists of a circle with a collection of small dots moving about. Some trials are *signal* trials
43
- and others are *noise* trials. On *noise* trials, the directions of the dots is independent and
44
- random. On *signal* trials, a subset of the dots move coherently in the same direction. The task can
45
- be paused and then resumed, and it can also be reset and run again.
46
-
47
- ##### Attributes
48
-
49
- - `coherence: number = 0.5`
50
- - Proportion of dots moving coherently
51
- - `count: number = 100`
52
- - Number of dots
53
- - `probability: number = 0.5`
54
- - Probability of signal (as opposed to noise)
55
- - `duration: number = 2000`
56
- - Duration of stimulus in milliseconds
57
- - `wait: number = 2000`
58
- - Duration of wait period for response in milliseconds
59
- - `iti: number = 2000`
60
- - Duration of inter-trial interval in milliseconds
61
- - `trials: number = 5`
62
- - Number of trials per block
63
- - `running: boolean = false`
64
- - Currently executing block of trials
65
-
66
- ##### Methods
67
-
68
- - `reset()`
69
- - Stops a currently running or ended block of trials and resets everything to be ready to run
70
- again
71
-
72
- ##### Custom Events
73
-
74
- - `rdk-block-start`
75
- - Indicates the beginning of a block of trials
76
- - `rdk-block-end`
77
- - Indicates the completion of a block of trials
78
- - `detail` for `rdk-block-start` and `rdk-block-end`
79
- - `trials: number`
80
- - Number of trials in the block
81
- - `rdk-trial-start`
82
- - Indicates the beginning of a trial (iti is over and stimulus is about to start)
83
- - `rdk-trial-middle`
84
- - Indicates the middle of a trial (stimulus is over and the wait is about to start)
85
- - `rdk-trial-end`
86
- - Indicates the end of a trial (wait is over and iti is about to start)
87
- - `detail` for `rdk-trial-start`, `rdk-trial-middle`, and `rdk-trial-end`
88
- - `trials: number`
89
- - Number of trials in the block
90
- - `duration: number`
91
- - Duration of stimulus in milliseconds
92
- - `wait: number`
93
- - Duration of wait period in milliseconds
94
- - `iti: number`
95
- - Duration of inter-trial interval in milliseconds
96
- - `trial: number`
97
- - Count of trial in block (one-based)
98
- - `signal: string`
99
- - Whether the signal is `present` or `absent` in this trial
100
-
101
- ##### Example
102
-
103
- ```html
104
- <rdt-task coherence="0.1" count="50" probability="0.5" duration="1000" wait="1000" iti="500" trials="10" running></rdt-task>
105
- ```
106
-
107
- #### `ROCSpace` / `<roc-space>`
108
-
109
- Interactive receiver operating characteristic (ROC) plot
110
-
111
- An ROC plot that can show one or more locations in ROC space or zROC space. Each location can be
112
- shown with a point, and/or with intersecting iso-sensitivity and iso-bias curves. In interactive
113
- mode, the points can be moved via direct manipulation with the mouse, touch, or keyboard arrows. The
114
- plot can also display the topography of the space with contour lines indicating iso-sensitivity,
115
- iso-bias, or iso-accuracy.
116
-
117
- ##### Attributes
118
-
119
- - `interactive: boolean = false`
120
- - Allow direct manipulation of points in the plot
121
- - `contour: string = undefined`
122
- - Show contour lines on plot
123
- - Options
124
- - `undefined`
125
- - Show no contours
126
- - `'sensitivity'`
127
- - Show iso-sensitivity contours
128
- - `'bias'`
129
- - Show iso-bias contours
130
- - `'accuracy'`
131
- - Show iso-accuracy contours
132
- - `point: string = 'all'`
133
- - Show a point on the plot for each *location*
134
- - Options:
135
- - `'all'`
136
- - Show points for all *locations*
137
- - `'first'`
138
- - Only show a point for the first (`'default'`) *location*
139
- - `'rest'`
140
- - Show points for all except the first (`'default'`) *location*
141
- - `'none'`
142
- - Show no points
143
- - `iso-d: string = 'first'`
144
- - Show an iso-sensitivity line for each *location*
145
- - Options:
146
- - `'all'`
147
- - Show contours for all *locations*
148
- - `'first'`
149
- - Only show a contour for the first (`'default'`) *location*
150
- - `'rest'`
151
- - Show contours for all except the first (`'default'`) *location*
152
- - `'none'`
153
- - Show no contours
154
- - `iso-c: string = 'first'`
155
- - Show an iso-bias line for each *location*
156
- - Options:
157
- - `'all'`
158
- - Show contours for all *locations*
159
- - `'first'`
160
- - Only show a contour for the first (`'default'`) *location*
161
- - `'rest'`
162
- - Show contours for all except the first (`'default'`) *location*
163
- - `'none'`
164
- - Show no contours
165
- - `z-roc: boolean = false`
166
- - Plot in zROC space instead of ROC space
167
- - `far: number = 0.25`
168
- - False alarm rate for the first (`'default'`) *location*
169
- - `hr: number = 0.75`
170
- - Hit rate for the first (`'default'`) *location*
171
-
172
- ##### Methods
173
-
174
- - `set(hr, far, name = 'default', label = '', s = 1)`
175
- - Create or update the *location* identified by `name`
176
- - The `name` `'default'` is reserved for the first location
177
- - Parameters
178
- - `hr: number`
179
- - Hit rate
180
- - `far: number`
181
- - False alarm rate
182
- - `name: string = 'default'`
183
- - A unique name to identify the *location* being set
184
- - `label: string = ''`
185
- - A visual label to use in the plot for this location
186
- - `s: number = 1`
187
- - Unequal variance parameter (default of `1` is equal variance)
188
- - `setWidthSDT(d, c, name = 'default', label = '', s = 1)`
189
- - Create or update the *location* identified by `name`
190
- - The `name` `'default'` is reserved for the first location
191
- - Parameters
192
- - `d: number`
193
- - Sensitivity
194
- - `c: number`
195
- - Bias
196
- - `name: string = 'default'`
197
- - A unique name to identify the *location* being set
198
- - `label: string = ''`
199
- - A visual label to use in the plot for this location
200
- - `s: number = 1`
201
- - Unequal variance parameter (default of `1` is equal variance)
202
-
203
- ##### Custom Events
204
-
205
- - `roc-point-change`
206
- - Indicates a location on the plot has been moved
207
- - `detail`
208
- - `name: string`
209
- - A unique name to identify the *location*
210
- - `far: number`
211
- - False alarm rate
212
- - `hr: number`
213
- - Hit rate
214
- - `d: number`
215
- - Sensitivity
216
- - `c: number`
217
- - Bias
218
- - `s: number`
219
- - Variance
220
- - `label: string`
221
- - Display label
222
-
223
- ##### Example
224
-
225
- ```html
226
- <roc-space interactive contour="bias" point="all" isoD="first" isoC="first" z-roc far="0.2" hr="0.9"></roc-space>
227
- ```
228
-
229
36
  #### `DetectableControl` / `<detectable-control>`
230
37
 
231
38
  Control panel for SDT demos
@@ -268,7 +75,9 @@ block of trials.
268
75
  - `'response'`
269
76
  - Color based on *'signal'* or *'noise'* response
270
77
  - `'outcome'`
271
- - Color based on outcome of hit, miss, false alarm or correct rejection
78
+ - Color based on outcome of *hit*, *miss*, *false alarm* or *correct rejection*
79
+ - `'all'`
80
+ - Color based on stimulus, response, and outcome
272
81
  - `zRoc: boolean = undefined`
273
82
  - Show a switch to set whether to use z-transformed ROC coordinates (`true`) or ROC coordinates
274
83
  (`false`)
@@ -329,159 +138,32 @@ block of trials.
329
138
  <detectable-control trials="15" duration="1500" coherence="0.2" payoff="75" color="outcome" z-roc run pause reset></detectable-control>
330
139
  ```
331
140
 
332
- #### `SDTModel` / `<sdt-model>`
333
-
334
- Interactive visualization of SDT in terms of signal and noise distributions
335
-
336
- This widget provides a visualization of signal detection theory. It can show *signal* and *noise*
337
- distributions and a threshold. The distributions can have unequal variance. The sensitivity, bias,
338
- and *signal* variance can be set and optionally displayed. In interactive mode, the bias can be
339
- adjusted by directly moving the threshold horizontally with mouse, touch, or keyboard, the
340
- sensitivity can be adjusted by directly moving a distribution horizontally with mouse, touch, or
341
- keyboard, and the variance can be adjusted by directly moving the *signal* distribution vertically
342
- with mouse, touch, or keyboard.
141
+ #### `DetectableResponse` / `<detectable-response>`
343
142
 
344
- In addition, the observation of stimuli can be visualized as blocks arriving at particular evidence
345
- levels, and stacking with previous stimuli to form a histogram. In interactive mode, when the model
346
- is adjusted, the blocks in the histogram will rearrange accordingly.
143
+ Response buttons, feedback, and payoffs for signal detection tasks
347
144
 
348
- The thresholded distributions and the histogram blocks can be colored based on the stimuli, the
349
- responses, or the outcomes.
145
+ This element provides 'present' and 'absent' response buttons. It can also display a running count
146
+ of the trials, display feedback in terms of accuracy or SDT outcome, and display the current trial
147
+ and total payoff.
350
148
 
351
149
  ##### Attributes
352
150
 
353
151
  - `interactive: boolean = false`
354
- - Allow direct manipulation of threshold and distributions
355
- - `color: string = 'outcome'`
356
- - Set how to color distributions and trials
152
+ - Allow user to respond, instead of just displaying simulated model responses
153
+ - `feedback: string = 'outcome'`
154
+ - What type of feedback to display
357
155
  - Options
156
+ - `'none'`
157
+ - No feedback
158
+ - `'accuracy'`
159
+ - Feedback in terms of accuracy, i.e. 'correct' or 'error'
358
160
  - `'outcome'`
359
- - Color based on outcome of the hit, miss, false alarm, or correct rejection
360
- - `'response'`
361
- - Color based on the `'present'` or `'absent'` response provided
362
- - `'stimulus'`
363
- - Color based on the `present` or `absent` stimulus displayed
364
- - `'none'`
365
- - No coloring
366
- - `distributions: boolean = false`
367
- - Show distributions
368
- - `threshold: boolean = false`
369
- - Show threshold
370
- - `unequal: boolean = false`
371
- - Allow unequal variance
372
- - `sensitivity: boolean = false`
373
- - Show the sensitivity as *d'* with a measurement bar
374
- - `bias: boolean = false`
375
- - Show the bias as *c* with a measurement bar
376
- - `variance: boolean = false`
377
- - Show the variance as *s* with a measurement bar
378
- - `histogram: boolean = false`
379
- - Show a histogram with a block for each trial/stimulus
380
- - `d: number = 1`
381
- - Set the sensitivity, *d`*
382
- - `c: number = 0`
383
- - Set the bias, *c*
384
- - `s: number = 1`
385
- - Set the variance of the *signal* distribution, *s*
386
-
387
- ##### Methods
388
-
389
- - `reset()`
390
- - Reset the histogram to have no trials
391
- - `trial(trialNumber, signal, duration, wait, iti)`
392
- - Add a trial to the histogram
393
- - Parameters
394
- - `trialNumber: number`
395
- - Numerical count of the trial in the block
396
- - `signal: string`
397
- - Whether this is a signal `'present'` or `'absent'` trial
398
- - `duration: number`
399
- - The stimulus duration on this trial in milliseconds
400
- - `wait: number`
401
- - The wait duration on this trial in milliseconds
402
- - `iti: number`
403
- - The inter-trial interval duration after this trial in milliseconds
404
- - `pauseTrial()`
405
- - Pause the animation of trials in the histogram
406
- - `resumeTrial()`
407
- - Resume the animation of trials in the histogram
408
-
409
- ##### Custom Events
410
-
411
- - `sdt-model-change`
412
- - Indicates that one or more model parameters have been changed
413
- - `detail`
414
- - `d: number`
415
- - Sensitivity
416
- - `c: number`
417
- - Bias
418
- - `s: number`
419
- - Variance
420
- - `far: number`
421
- - False alarm rate
422
- - `hr: number`
423
- - Hit rate
424
- - `h: number`
425
- - Hits
426
- - `m: number`
427
- - Misses
428
- - `fa: number`
429
- - False alarms
430
- - `cr: number`
431
- - Correct rejections
432
- - `detectable-response`
433
- - Indicates that an animated histogram trial has generated a response
434
- - `detail`
435
- - `stimulus: string`
436
- - Whether the signal was actually `'present'` or `'absent'`
437
- - `response: string`
438
- - Whether the response was `'present'` or `'absent'`
439
- - `outcome: string`
440
- - The outcome of the trial as a hit (`'h'`), miss (`'m'`), correct rejection (`'cr'`), or
441
- false alarm (`'fa'`)
442
- - `h: number`
443
- - Total hits in this block
444
- - `m: number`
445
- - Total misses in this block
446
- - `fa: number`
447
- - Total false alarms in this block
448
- - `cr: number`
449
- - Total correct rejections in this block
450
- - `nr: number`
451
- - Total no responses in this block
452
-
453
- ##### Example
454
-
455
- ```html
456
- <sdt-model interactive color="outcome" distributions threshold unequal sensitivity bias variance histogram d="2" c="1" s="1.5"></sdt-model>
457
- ```
458
-
459
- #### `DetectableResponse` / `<detectable-response>`
460
-
461
- Response buttons, feedback, and payoffs for signal detection tasks
462
-
463
- This element provides 'present' and 'absent' response buttons. It can also display a running count
464
- of the trials, display feedback in terms of accuracy or SDT outcome, and display the current trial
465
- and total payoff.
466
-
467
- ##### Attributes
468
-
469
- - `interactive: boolean = false`
470
- - Allow user to respond, instead of just displaying simulated model responses
471
- - `feedback: string = 'outcome'`
472
- - What type of feedback to display
473
- - Options
474
- - `'none'`
475
- - No feedback
476
- - `'accuracy'`
477
- - Feedback in terms of accuracy, i.e. 'correct' or 'error'
478
- - `'outcome'`
479
- - Feedback in terms of outcome, i.e. 'hit, 'miss', 'false alarm', or 'correct rejection'
480
- - `trial: boolean = false`
481
- - Display the running count of trials, i.e. 'Trial: 2 of 10'
482
- - `payoff: string = 'none'`
483
- - What payoff information to display
484
- - Options
161
+ - Feedback in terms of outcome, i.e. 'hit, 'miss', 'false alarm', or 'correct rejection'
162
+ - `trial: boolean = false`
163
+ - Display the running count of trials, i.e. 'Trial: 2 of 10'
164
+ - `payoff: string = 'none'`
165
+ - What payoff information to display
166
+ - Options
485
167
  - `'none'`
486
168
  - No payoff information displayed
487
169
  - `'trial'`
@@ -555,74 +237,386 @@ and total payoff.
555
237
  ##### Example
556
238
 
557
239
  ```html
558
- <detectable-response interactive feedback="outcome" trial payoff="total" hit-payoff="60" miss-payoff="-60" false-alarm-payoff="-40" correct-rejection-payoff="40" no-response-payoff="-100"></detectable-response>
240
+ <detectable-response interactive feedback="outcome" trial payoff="total" hit-payoff="60" miss-payoff="-60" false-alarm-payoff="-40" correct-rejection-payoff="40" no-response-payoff="-100"></detectable-response>
241
+ ```
242
+
243
+ #### `DetectableTable` / `<detectable-table>`
244
+
245
+ Interactive table of SDT outcomes
246
+
247
+ A results table for signal detection tasks. The results are presented in a two by two table
248
+ organized by stimuli (signal present or absent) and responses ('present' or 'absent') leading to
249
+ four possible outcomes: hits, misses, false alarms, and correct rejections. Results on signal
250
+ present trials are optionally marginalized with the hit rate and those on signal absent trials with
251
+ the false alarm rate. Results on response 'present' trials are optionally marginalized with the
252
+ positive predictive value and those on response 'absent' trials with the false omission rate. And
253
+ overall results are optionally marginalized with accuracy.
254
+
255
+ ##### Attributes
256
+
257
+ - `interactive: boolean = false`
258
+ - Allow user to change values in the table
259
+ - `numeric: boolean = false`
260
+ - Show numeric values instead of just labelling the cells
261
+ - `summary: Set = <empty>`
262
+ - Which marginals to display
263
+ - Expressed in HTML as a space-separated list
264
+ - Options
265
+ - `'stimulusRates'`
266
+ - Display hit rate and false alarm rate
267
+ - `'responseRates'`
268
+ - Display positive predictive value and false omission rate
269
+ - `'accuracy'`
270
+ - Display overall accuracy
271
+ - `color: string = 'outcome'`
272
+ - How to color the cells
273
+ - Options
274
+ - `'none'`
275
+ - No colors
276
+ - `'accuracy'`
277
+ - Color based on accuracy, i.e. *correct* or *error*
278
+ - `'stimulus'`
279
+ - Color based on stimulus *present* or *absent*
280
+ - `'response'`
281
+ - Color based on response *'present'* or *'absent'*
282
+ - `'outcome'`
283
+ - Color based on *hits*, *misses*, *false alarms* and *correct rejections*
284
+ - `'all'`
285
+ - Color based on stimulus, response, and outcome
286
+ - `hits: number = 40`
287
+ - Number of hits
288
+ - `misses: number = 60`
289
+ - Number of misses
290
+ - `false-alarms: number = 75`
291
+ - Number of false alarms
292
+ - `correct-rejections: number = 25`
293
+ - Number of correct rejections
294
+ - `payoff: boolean = false`
295
+ - Whether to display payoffs
296
+ - `hit-payoff: number = undefined`
297
+ - Payoff for hits
298
+ - `miss-payoff: number = undefined`
299
+ - Payoff for misses
300
+ - `correct-rejection-payoff: number = undefined`
301
+ - Payoff for correct rejections
302
+ - `false-alarm-payoff: number = undefined`
303
+ - Payoff for false alarms
304
+
305
+ ##### Custom Events
306
+
307
+ - `detectable-table-change`
308
+ - One or more values in the table have changed
309
+ - `detail`
310
+ - `h: number`
311
+ - Hits
312
+ - `m: number`
313
+ - Misses
314
+ - `fa: number`
315
+ - False alarms
316
+ - `cr: number`
317
+ - Correct rejections
318
+ - `hr: number`
319
+ - Hit rate
320
+ - `far: number`
321
+ - False alarm rate
322
+ - `ppv: number`
323
+ - Positive predictive value
324
+ - `fomr: number`
325
+ - False omission rate
326
+ - `acc: number`
327
+ - Accuracy
328
+
329
+ ##### Example
330
+
331
+ ```html
332
+ <detectable-table interactive numeric summary="stimulusRates responseRates accuracy" = color="outcome" hits="80" misses="20" false-alarms="35" correct-rejections="65" payoff hit-payoff="60" miss-payoff="-60" false-alarm-payoff="-40" correct-rejection-payoff="40"></detectable-table>
333
+ ```
334
+
335
+ #### `RDKTask` / `<rdt-task>`
336
+
337
+ Displays stimuli for random dot kinematogram signal detection task
338
+
339
+ When run, a block of trials is presented. Before each trial is an inter-trial interval (ITI). Each
340
+ trial then consists of a stimulus followed by a period of waiting for a response. The stimulus
341
+ consists of a circle with a collection of small dots moving about. Some trials are *signal* trials
342
+ and others are *noise* trials. On *noise* trials, the directions of the dots is independent and
343
+ random. On *signal* trials, a subset of the dots move coherently in the same direction. The task can
344
+ be paused and then resumed, and it can also be reset and run again.
345
+
346
+ ##### Attributes
347
+
348
+ - `coherence: number = 0.5`
349
+ - Proportion of dots moving coherently
350
+ - `count: number = 100`
351
+ - Number of dots
352
+ - `probability: number = 0.5`
353
+ - Probability of signal (as opposed to noise)
354
+ - `duration: number = 2000`
355
+ - Duration of stimulus in milliseconds
356
+ - `wait: number = 2000`
357
+ - Duration of wait period for response in milliseconds
358
+ - `iti: number = 2000`
359
+ - Duration of inter-trial interval in milliseconds
360
+ - `trials: number = 5`
361
+ - Number of trials per block
362
+ - `running: boolean = false`
363
+ - Currently executing block of trials
364
+
365
+ ##### Methods
366
+
367
+ - `reset()`
368
+ - Stops a currently running or ended block of trials and resets everything to be ready to run
369
+ again
370
+
371
+ ##### Custom Events
372
+
373
+ - `rdk-block-start`
374
+ - Indicates the beginning of a block of trials
375
+ - `rdk-block-end`
376
+ - Indicates the completion of a block of trials
377
+ - `detail` for `rdk-block-start` and `rdk-block-end`
378
+ - `trials: number`
379
+ - Number of trials in the block
380
+ - `rdk-trial-start`
381
+ - Indicates the beginning of a trial (iti is over and stimulus is about to start)
382
+ - `rdk-trial-middle`
383
+ - Indicates the middle of a trial (stimulus is over and the wait is about to start)
384
+ - `rdk-trial-end`
385
+ - Indicates the end of a trial (wait is over and iti is about to start)
386
+ - `detail` for `rdk-trial-start`, `rdk-trial-middle`, and `rdk-trial-end`
387
+ - `trials: number`
388
+ - Number of trials in the block
389
+ - `duration: number`
390
+ - Duration of stimulus in milliseconds
391
+ - `wait: number`
392
+ - Duration of wait period in milliseconds
393
+ - `iti: number`
394
+ - Duration of inter-trial interval in milliseconds
395
+ - `trial: number`
396
+ - Count of trial in block (one-based)
397
+ - `signal: string`
398
+ - Whether the signal is `present` or `absent` in this trial
399
+
400
+ ##### Example
401
+
402
+ ```html
403
+ <rdt-task coherence="0.1" count="50" probability="0.5" duration="1000" wait="1000" iti="500" trials="10" running></rdt-task>
404
+ ```
405
+
406
+ #### `ROCSpace` / `<roc-space>`
407
+
408
+ Interactive receiver operating characteristic (ROC) plot
409
+
410
+ An ROC plot that can show one or more locations in ROC space or zROC space. Each location can be
411
+ shown with a point, and/or with intersecting iso-sensitivity and iso-bias curves. In interactive
412
+ mode, the points can be moved via direct manipulation with the mouse, touch, or keyboard arrows. The
413
+ plot can also display the topography of the space with contour lines indicating iso-sensitivity,
414
+ iso-bias, or iso-accuracy.
415
+
416
+ ##### Attributes
417
+
418
+ - `interactive: boolean = false`
419
+ - Allow direct manipulation of points in the plot
420
+ - `contour: string = undefined`
421
+ - Show contour lines on plot
422
+ - Options
423
+ - `undefined`
424
+ - Show no contours
425
+ - `'sensitivity'`
426
+ - Show iso-sensitivity contours
427
+ - `'bias'`
428
+ - Show iso-bias contours
429
+ - `'accuracy'`
430
+ - Show iso-accuracy contours
431
+ - `point: string = 'all'`
432
+ - Show a point on the plot for each *location*
433
+ - Options:
434
+ - `'all'`
435
+ - Show points for all *locations*
436
+ - `'first'`
437
+ - Only show a point for the first (`'default'`) *location*
438
+ - `'rest'`
439
+ - Show points for all except the first (`'default'`) *location*
440
+ - `'none'`
441
+ - Show no points
442
+ - `iso-d: string = 'first'`
443
+ - Show an iso-sensitivity line for each *location*
444
+ - Options:
445
+ - `'all'`
446
+ - Show contours for all *locations*
447
+ - `'first'`
448
+ - Only show a contour for the first (`'default'`) *location*
449
+ - `'rest'`
450
+ - Show contours for all except the first (`'default'`) *location*
451
+ - `'none'`
452
+ - Show no contours
453
+ - `iso-c: string = 'first'`
454
+ - Show an iso-bias line for each *location*
455
+ - Options:
456
+ - `'all'`
457
+ - Show contours for all *locations*
458
+ - `'first'`
459
+ - Only show a contour for the first (`'default'`) *location*
460
+ - `'rest'`
461
+ - Show contours for all except the first (`'default'`) *location*
462
+ - `'none'`
463
+ - Show no contours
464
+ - `z-roc: boolean = false`
465
+ - Plot in zROC space instead of ROC space
466
+ - `far: number = 0.25`
467
+ - False alarm rate for the first (`'default'`) *location*
468
+ - `hr: number = 0.75`
469
+ - Hit rate for the first (`'default'`) *location*
470
+
471
+ ##### Methods
472
+
473
+ - `set(hr, far, name = 'default', label = '', s = 1)`
474
+ - Create or update the *location* identified by `name`
475
+ - The `name` `'default'` is reserved for the first location
476
+ - Parameters
477
+ - `hr: number`
478
+ - Hit rate
479
+ - `far: number`
480
+ - False alarm rate
481
+ - `name: string = 'default'`
482
+ - A unique name to identify the *location* being set
483
+ - `label: string = ''`
484
+ - A visual label to use in the plot for this location
485
+ - `s: number = 1`
486
+ - Unequal variance parameter (default of `1` is equal variance)
487
+ - `setWidthSDT(d, c, name = 'default', label = '', s = 1)`
488
+ - Create or update the *location* identified by `name`
489
+ - The `name` `'default'` is reserved for the first location
490
+ - Parameters
491
+ - `d: number`
492
+ - Sensitivity
493
+ - `c: number`
494
+ - Bias
495
+ - `name: string = 'default'`
496
+ - A unique name to identify the *location* being set
497
+ - `label: string = ''`
498
+ - A visual label to use in the plot for this location
499
+ - `s: number = 1`
500
+ - Unequal variance parameter (default of `1` is equal variance)
501
+
502
+ ##### Custom Events
503
+
504
+ - `roc-point-change`
505
+ - Indicates a location on the plot has been moved
506
+ - `detail`
507
+ - `name: string`
508
+ - A unique name to identify the *location*
509
+ - `far: number`
510
+ - False alarm rate
511
+ - `hr: number`
512
+ - Hit rate
513
+ - `d: number`
514
+ - Sensitivity
515
+ - `c: number`
516
+ - Bias
517
+ - `s: number`
518
+ - Variance
519
+ - `label: string`
520
+ - Display label
521
+
522
+ ##### Example
523
+
524
+ ```html
525
+ <roc-space interactive contour="bias" point="all" isoD="first" isoC="first" z-roc far="0.2" hr="0.9"></roc-space>
559
526
  ```
560
527
 
561
- #### `DetectableTable` / `<detectable-table>`
528
+ #### `SDTModel` / `<sdt-model>`
562
529
 
563
- Interactive table of SDT outcomes
530
+ Interactive visualization of SDT in terms of signal and noise distributions
564
531
 
565
- A results table for signal detection tasks. The results are presented in a two by two table
566
- organized by stimuli (signal present or absent) and responses ('present' or 'absent') leading to
567
- four possible outcomes: hits, misses, false alarms, and correct rejections. Results on signal
568
- present trials are optionally marginalized with the hit rate and those on signal absent trials with
569
- the false alarm rate. Results on response 'present' trials are optionally marginalized with the
570
- positive predictive value and those on response 'absent' trials with the false omission rate. And
571
- overall results are optionally marginalized with accuracy.
532
+ This widget provides a visualization of signal detection theory. It can show *signal* and *noise*
533
+ distributions and a threshold. The distributions can have unequal variance. The sensitivity, bias,
534
+ and *signal* variance can be set and optionally displayed. In interactive mode, the bias can be
535
+ adjusted by directly moving the threshold horizontally with mouse, touch, or keyboard, the
536
+ sensitivity can be adjusted by directly moving a distribution horizontally with mouse, touch, or
537
+ keyboard, and the variance can be adjusted by directly moving the *signal* distribution vertically
538
+ with mouse, touch, or keyboard.
539
+
540
+ In addition, the observation of stimuli can be visualized as blocks arriving at particular evidence
541
+ levels, and stacking with previous stimuli to form a histogram. In interactive mode, when the model
542
+ is adjusted, the blocks in the histogram will rearrange accordingly.
543
+
544
+ The thresholded distributions and the histogram blocks can be colored based on the stimuli, the
545
+ responses, or the outcomes.
572
546
 
573
547
  ##### Attributes
574
548
 
575
549
  - `interactive: boolean = false`
576
- - Allow user to change values in the table
577
- - `numeric: boolean = false`
578
- - Show numeric values instead of just labelling the cells
579
- - `summary: Set = <empty>`
580
- - Which marginals to display
581
- - Expressed in HTML as a space-separated list
582
- - Options
583
- - `'stimulusRates'`
584
- - Display hit rate and false alarm rate
585
- - `'responseRates'`
586
- - Display positive predictive value and false omission rate
587
- - `'accuracy'`
588
- - Display overall accuracy
550
+ - Allow direct manipulation of threshold and distributions
589
551
  - `color: string = 'outcome'`
590
- - How to color the cells
552
+ - Set how to color distributions and trials
591
553
  - Options
592
- - `'none'`
593
- - No colors
594
- - `'accuracy'`
595
- - Color based on accuracy, i.e. correct or error
596
- - `'stimulus'`
597
- - Color based on stimulus present or absent
598
- - `'response'`
599
- - Color based on response 'present' or 'absent'
600
554
  - `'outcome'`
601
- - Full coloration based on hits, misses, false alarms and correct rejections
602
- - `hits: number = 40`
603
- - Number of hits
604
- - `misses: number = 60`
605
- - Number of misses
606
- - `false-alarms: number = 75`
607
- - Number of false alarms
608
- - `correct-rejections: number = 25`
609
- - Number of correct rejections
610
- - `payoff: boolean = false`
611
- - Whether to display payoffs
612
- - `hit-payoff: number = undefined`
613
- - Payoff for hits
614
- - `miss-payoff: number = undefined`
615
- - Payoff for misses
616
- - `correct-rejection-payoff: number = undefined`
617
- - Payoff for correct rejections
618
- - `false-alarm-payoff: number = undefined`
619
- - Payoff for false alarms
555
+ - Color based on outcome of the hit, miss, false alarm, or correct rejection
556
+ - `'response'`
557
+ - Color based on the `'present'` or `'absent'` response provided
558
+ - `'stimulus'`
559
+ - Color based on the `present` or `absent` stimulus displayed
560
+ - `'none'`
561
+ - No coloring
562
+ - `distributions: boolean = false`
563
+ - Show distributions
564
+ - `threshold: boolean = false`
565
+ - Show threshold
566
+ - `unequal: boolean = false`
567
+ - Allow unequal variance
568
+ - `sensitivity: boolean = false`
569
+ - Show the sensitivity as *d'* with a measurement bar
570
+ - `bias: boolean = false`
571
+ - Show the bias as *c* with a measurement bar
572
+ - `variance: boolean = false`
573
+ - Show the variance as *s* with a measurement bar
574
+ - `histogram: boolean = false`
575
+ - Show a histogram with a block for each trial/stimulus
576
+ - `d: number = 1`
577
+ - Set the sensitivity, *d`*
578
+ - `c: number = 0`
579
+ - Set the bias, *c*
580
+ - `s: number = 1`
581
+ - Set the variance of the *signal* distribution, *s*
582
+
583
+ ##### Methods
584
+
585
+ - `reset()`
586
+ - Reset the histogram to have no trials
587
+ - `trial(trialNumber, signal, duration, wait, iti)`
588
+ - Add a trial to the histogram
589
+ - Parameters
590
+ - `trialNumber: number`
591
+ - Numerical count of the trial in the block
592
+ - `signal: string`
593
+ - Whether this is a signal `'present'` or `'absent'` trial
594
+ - `duration: number`
595
+ - The stimulus duration on this trial in milliseconds
596
+ - `wait: number`
597
+ - The wait duration on this trial in milliseconds
598
+ - `iti: number`
599
+ - The inter-trial interval duration after this trial in milliseconds
600
+ - `pauseTrial()`
601
+ - Pause the animation of trials in the histogram
602
+ - `resumeTrial()`
603
+ - Resume the animation of trials in the histogram
620
604
 
621
605
  ##### Custom Events
622
606
 
623
- - `detectable-table-change`
624
- - One or more values in the table have changed
607
+ - `sdt-model-change`
608
+ - Indicates that one or more model parameters have been changed
625
609
  - `detail`
610
+ - `d: number`
611
+ - Sensitivity
612
+ - `c: number`
613
+ - Bias
614
+ - `s: number`
615
+ - Variance
616
+ - `far: number`
617
+ - False alarm rate
618
+ - `hr: number`
619
+ - Hit rate
626
620
  - `h: number`
627
621
  - Hits
628
622
  - `m: number`
@@ -631,21 +625,31 @@ overall results are optionally marginalized with accuracy.
631
625
  - False alarms
632
626
  - `cr: number`
633
627
  - Correct rejections
634
- - `hr: number`
635
- - Hit rate
636
- - `far: number`
637
- - False alarm rate
638
- - `ppv: number`
639
- - Positive predictive value
640
- - `fomr: number`
641
- - False omission rate
642
- - `acc: number`
643
- - Accuracy
628
+ - `detectable-response`
629
+ - Indicates that an animated histogram trial has generated a response
630
+ - `detail`
631
+ - `stimulus: string`
632
+ - Whether the signal was actually `'present'` or `'absent'`
633
+ - `response: string`
634
+ - Whether the response was `'present'` or `'absent'`
635
+ - `outcome: string`
636
+ - The outcome of the trial as a hit (`'h'`), miss (`'m'`), correct rejection (`'cr'`), or
637
+ false alarm (`'fa'`)
638
+ - `h: number`
639
+ - Total hits in this block
640
+ - `m: number`
641
+ - Total misses in this block
642
+ - `fa: number`
643
+ - Total false alarms in this block
644
+ - `cr: number`
645
+ - Total correct rejections in this block
646
+ - `nr: number`
647
+ - Total no responses in this block
644
648
 
645
649
  ##### Example
646
650
 
647
651
  ```html
648
- <detectable-table interactive numeric summary="stimulusRates responseRates accuracy" = color="outcome" hits="80" misses="20" false-alarms="35" correct-rejections="65" payoff hit-payoff="60" miss-payoff="-60" false-alarm-payoff="-40" correct-rejection-payoff="40"></detectable-table>
652
+ <sdt-model interactive color="outcome" distributions threshold unequal sensitivity bias variance histogram d="2" c="1" s="1.5"></sdt-model>
649
653
  ```
650
654
 
651
655
  ### Equations
@@ -786,6 +790,44 @@ False alarm rate from false alarms and correct rejections
786
790
  <sdt-equation-facr2far numeric interactive false-alarms="25" correct-rejections="75"></sdt-equation-facr2far>
787
791
  ```
788
792
 
793
+ #### `SDTEquationHFa2Ppv` / `<sdt-equation-hfa2ppv>`
794
+
795
+ Positive predictive value rate from hits and false alarms
796
+
797
+ ##### Attributes
798
+
799
+ - `numeric: boolean = false`
800
+ - Show values instead of just the names of variables
801
+ - `interactive: boolean = false`
802
+ - Allow editing of numeric values in the equation
803
+ - `hits: number = 0`
804
+ - Hits
805
+ - `false-alarms: number = 0`
806
+ - False alarms
807
+
808
+ ##### Properties
809
+
810
+ - `ppv: number`
811
+ - Positive predictive value
812
+
813
+ ##### Custom Events
814
+
815
+ - `sdt-equation-hfa2ppv-change`
816
+ - Indicates that the values in the equation have changed
817
+ - `detail`
818
+ - `h: number`
819
+ - New value of hits
820
+ - `fa: number`
821
+ - New value of false alarms
822
+ - `hr: number`
823
+ - New value of positive predictive value
824
+
825
+ ##### Example
826
+
827
+ ```html
828
+ <sdt-equation-hfa2ppv numeric interactive hits="75" false-alarms="25"></sdt-equation-hfa2ppv>
829
+ ```
830
+
789
831
  #### `SDTEquationHM2Hr` / `<sdt-equation-hm2hr>`
790
832
 
791
833
  Hit rate from hits and misses
@@ -954,6 +996,44 @@ Sensitivity from hit rate and false alarm rate
954
996
  <sdt-equation-hrfar2d numeric interactive unequal hit-rate="0.75" false-alarm-rate="0.25" s="1.5"></sdt-equation-hrfar2d>
955
997
  ```
956
998
 
999
+ #### `SDTEquationMCr2Fomr` / `<sdt-equation-mcr2fomr>`
1000
+
1001
+ Positive predictive value rate from hits and false alarms
1002
+
1003
+ ##### Attributes
1004
+
1005
+ - `numeric: boolean = false`
1006
+ - Show values instead of just the names of variables
1007
+ - `interactive: boolean = false`
1008
+ - Allow editing of numeric values in the equation
1009
+ - `misses: number = 0`
1010
+ - Misses
1011
+ - `correct-rejections: number = 0`
1012
+ - Correct rejections
1013
+
1014
+ ##### Properties
1015
+
1016
+ - `fomr: number`
1017
+ - False omission rate
1018
+
1019
+ ##### Custom Events
1020
+
1021
+ - `sdt-equation-mcr2fomr-change`
1022
+ - Indicates that the values in the equation have changed
1023
+ - `detail`
1024
+ - `m: number`
1025
+ - New value of misses
1026
+ - `cr: number`
1027
+ - New value of correct rejections
1028
+ - `fomr: number`
1029
+ - New value of false omission rate
1030
+
1031
+ ##### Example
1032
+
1033
+ ```html
1034
+ <sdt-equation-mcr2fomr numeric interactive misses="75" correct-rejections="25"></sdt-equation-mcr2fomr>
1035
+ ```
1036
+
957
1037
  #### `SDTEquation`
958
1038
 
959
1039
  Base class for all interactive SDT equations
@@ -966,7 +1046,7 @@ export default class SDTEquationSomething extends SDTEquation {
966
1046
  }
967
1047
  ```
968
1048
 
969
- `SDTEquation` extends `DetectableElement` extends `DecidableElement` extends `LitElement`
1049
+ `SDTEquation` extends `DetectableElement` extends `DecidablesElement` extends `LitElement`
970
1050
 
971
1051
  ### Examples
972
1052
 
@@ -1118,6 +1198,49 @@ because their values are received from the model's task performance.
1118
1198
  </detectable-example-model>
1119
1199
  ```
1120
1200
 
1201
+ #### `DetectableExampleMultiple` / `<detectable-example-multiple>`
1202
+
1203
+ Multiple value example
1204
+
1205
+ Used to build specialized examples with multiple values for one variable (sensitivity or bias) and a
1206
+ single value for the other variable. Can include controls, ROC space, and a visual rendering of
1207
+ signal detection theory. The SDT model can be interactive.
1208
+
1209
+ ##### Attributes
1210
+
1211
+ - `variable: string = 'd'`
1212
+ - Choose which variable to have multiple values
1213
+ - Options
1214
+ - `'d'`
1215
+ - Sensitivity
1216
+ - `'c'`
1217
+ - Bias
1218
+ - `values: Array = [0, 1]`
1219
+ - Which marginals to display
1220
+ - Expressed in HTML as a space-separated list of numbers
1221
+
1222
+ ##### Slots
1223
+
1224
+ - *unnamed*
1225
+ - Place relevant `detectable-elements` components here
1226
+ - Wired elements
1227
+ - `<detectable-control>`
1228
+ - Allows user to adjust parameters
1229
+ - `<sdt-model>`
1230
+ - Display and change a visual rendering of sensitivity and bias
1231
+ - `<roc-space>`
1232
+ - Displays the hit rate and false alarm rate in ROC space
1233
+
1234
+ ##### Example
1235
+
1236
+ ```html
1237
+ <sdt-example-multiple variable="d" values="0 1 2 3 4">
1238
+ <detectable-control z-roc></detectable-control>
1239
+ <sdt-model interactive threshold bias></sdt-model>
1240
+ <roc-space z-roc point="rest" iso-d="rest" iso-c="first"></roc-space>
1241
+ </sdt-example-multiple>
1242
+ ```
1243
+
1121
1244
  #### `DetectableExampleUnequal` / `<detectable-example-unequal>`
1122
1245
 
1123
1246
  Unequal variance example
@@ -1164,7 +1287,7 @@ export default class DetectableExampleSomething extends DetectableExample {
1164
1287
  }
1165
1288
  ```
1166
1289
 
1167
- `DetectableExample` extends `DetectableElement` extends `DecidableElement` extends `LitElement`
1290
+ `DetectableExample` extends `DetectableElement` extends `DecidablesElement` extends `LitElement`
1168
1291
 
1169
1292
  ### Base class
1170
1293
 
@@ -1180,7 +1303,7 @@ export default class DetectableElementSomething extends DetectableElement {
1180
1303
  }
1181
1304
  ```
1182
1305
 
1183
- `DetectableElement` extends `DecidableElement` extends `LitElement`
1306
+ `DetectableElement` extends `DecidablesElement` extends `LitElement`
1184
1307
 
1185
1308
  ## Development
1186
1309