-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathvery_simple_demo.html
45 lines (41 loc) · 1.92 KB
/
very_simple_demo.html
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<!DOCTYPE html>
<html>
<head>
<script src="./dist/jsQUEST.js"></script>
</head>
<body>
<p>This program simulates the QUEST method: a Bayesian adaptive psychometric method (<a href="https://link.springer.com/article/10.3758/BF03202828">Watson & Pelli, 1983</a>).</p>
<p>This program is a rewrite of <a href="http://psychtoolbox.org/docs/QuestDemo">QuestDemo</a>, which is distributed as a part of <a href="http://psychtoolbox.org/">Psychtoolbox</a>, using <a href= "https://www.jspsych.org/">jsPsych</a> and <a href="https://github.com/kurokida/jsQUEST">jsQUEST</a>.</p>
<p>Please open the JavaScript console window in your browser. If you are using Chrome on Windows, press Ctrl + Shift + I to open the console.</p>
</body>
<script>
const tGuess = -1
const tGuessSd = 2
const pThreshold = 0.82;
const beta = 3.5;
const delta = 0.01;
const gamma = 0.5;
// Initialization
let q = jsQUEST.QuestCreate(tGuess, tGuessSd, pThreshold, beta, delta, gamma);
console.log(q)
///////////////////////////////////
// Trial 1
// % Get recommended level. Choose your favorite algorithm.
let tTest = jsQUEST.QuestQuantile(q); // % Recommended by Pelli (1987), and still our favorite.
console.log(tTest)
// Assume a YES/SUCSESS response.
let response = 1;
// % Update the pdf
q = jsQUEST.QuestUpdate(q, tTest, response); // % Add the new datum (actual test intensity and observer response) to the database.
console.log(`Threshold estimate (mean+-sd) is ${jsQUEST.QuestMean(q)} +- ${jsQUEST.QuestSd(q)}`)
///////////////////////////////////
// Trial 2
tTest = jsQUEST.QuestQuantile(q);
console.log(tTest)
// Assume a NO/FAILURE response.
response = 0;
// % Update the pdf
q = jsQUEST.QuestUpdate(q, tTest, response);
console.log(`Threshold estimate (mean+-sd) is ${jsQUEST.QuestMean(q)} +- ${jsQUEST.QuestSd(q)}`)
</script>
</html>