Shared Scripts, Data, Stimuli, Files, and Demos

Raven’s Matrices - Voor Matrix puzzles

Raven’s Matrices - Voor Matrix puzzles

BryanV

An additional script should’ve been loaded into this script. If it has not, you can copy it here and add it to the script yourself: https://scripting.neurotask.com/share/77002

No comments yet
 




Comments

No comments yet

If you are a registered user and signed in, you can here copy this script and its stimuli to your own account, where you can edit it and change it in any way you want.

It is absolutely free to register (no credit card info asked!). You can then instantly copy this experiment with one click and edit it, change its accompanying texts, its landing page, stimuli, etc. Invite your colleagues, friends, or students to check out your experiment. There is no limit on how many people can do your experiment, even with a free account.

The catch? There is no catch! Just keep in mind that with a free account, you cannot collect data. For teaching that is usually not a problem. For research, prepaid data collection (unlimited subjects) starts as low as €10.00 for a 10-day period.

 
//intialize variables.
var matrix, practiseMatrix, practiseAnswer, answer, b, e, i, number_correct = 0, total_test_time, 
timeTaskBegin, timeTaskEnd, timeStartAll, timeEndAll, timeTotal;
var chosen_country, chosen_language, date;

// logging the date
// await() functions have a .timestamp property where the date is displayed in
// milliseconds which can be converted to an actual more readable date
datefind = await(200);
console.log(datefind.timestamp);
date = datefind.timestamp;

//start measuring  the time the test is taking
timeStartAll= now();

//the variable practiseMatrix is used to easily have access to all the 
//.jpg file names for loading all the pictures from the Raven's task

practiseMatrix = 
    ["practise_matrix_1.jpg","practise_matrix_2.jpg","practise_matrix_3.jpg",
    "practise_matrix_4.jpg","practise_matrix_5.jpg","practise_matrix_6.jpg"];
    
    
//Create a loop, where for each i/round an image file name is made and
//put into an array, because it is more convenient than typing everything.
//The loop starts with 1 and not 0, because there is no 'matrix_0.jpg'.
matrix = [];
for (var i = 1; i < 37; i++)
{
    matrix[i-1] = ("matrix_" + i + ".jpg");

}

//the answer numbers for the (6) practise questions (practiseAnswer) and
//the answer numbers for the real (36) questions (answer).
practiseAnswer = [4,1,1,6,7,4];
answer = [8,3,2,8,3,4,7,3,8,5,6,7,4,1,4,4,7,5,7,2,8,7,5,5,6,1,1,8,1,6,4,1,1,1,3,6];



//This is a test where there are multiple display languages available, namely: English, Dutch and Japanese
//Using a radio statement a participant can choose their preffered language.
// the radio() function adds a new property to the response object: reponse.chosen_language
// this property is what we will use to make sure the participant sees the correct language at every point.
// The language selected here is also used to determine what educational system the participants have experienced
// Maybe select your 'mother tongue' would be better.
// Perhaps the text above the radio boxes needs to be changed to make sure the participant makes the proper selection.
// 日本語 means Japanese.
// IMPORTANT: make sure that variable values are never logged (with log() or logtrial()) as string that contain Japanese or Chinese characters, 
// the data dashboard will not be able to encode this properly and you will in some cases
//  not be able to decipher what the value of the variable orignally was.

radio("Choose a language
Kies een taal
言語をお選んでください",[["English","EN"],["Nederlands","NL"],["日本語","JP"]],"chosen_language"); console.log(response.chosen_language + " was chosen as the display language."); //Provide participants with an information letter and an informed consent. // the information letters and informed consent functions seen below are provided & defined // using another script (Matrixpuzzles-Ravens-Consent-Informationletter) // this was done to conserve space and increase readability of the script as the consents and letters take up a lot of lines in a script. // this script has been added to the current script //When you see: '日本語' in the code, it means Japanese. main.setfontsize(40); //as a large amount of text will be displayed. // setfonsize(40) will decrease the text to 40% of it's standard size. //A switch statement is used, taking response.chosen_languages as a parameter. // Depending on what the value of that parameter is the switch statement will select the appropriate code for each language switch(response.chosen_language) { case 'EN': informationletter_EN(); informedconsent_EN(); break; case "NL": informationletter_NL(); informedconsent_NL(); break; case "JP": informationletter_JP(); informedconsent_JP(); break; } clear(); //provide different instructions for different language speakers //A small amount of text needs to be displayed main.setfontsize(100); // We will now gather info about a participants country of residence // the second parameter for the radio functions is multiple arrays (nested) within another array // the first value of each of the nested arrays always shows the text the participant will see, // the second value shows what the value will be that will be linked to response.chosen_country switch(response.chosen_language) { case 'EN': radio("What country do you currently live in?", [["United States of America","USA"],["United Kingdom","UK"],["the Netherlands","NLD"],["Japan","JPN"],["A different country","Other"]],"chosen_country"); break; case "NL": radio("In welk land woont u op het moment?", [["De Verenigde Staten","USA"],["Het Verenigd Koninkrijk","UK"],["Nederland","NLD"],["Japan","JPN"],["Een ander land","Other"]],"chosen_country"); break; case "JP": radio("今どの国にお住みになりますか?",[["アメリカ","USA"],["イギリス","UK"],["オランダ","NLD"],["日本","JPN"],["他の国","Other"]],"chosen_country"); break; } console.log('the country that was chosen is: ' + response.chosen_country); //Now we will choose which ISCE (International Standard Classification of Education) level a participant has // As this test aims to gather data from different populations from different countries // it is important that their educational levels can actually be compared // the ISCE can help to achieve this. main.setfontsize(50); switch(response.chosen_language) { case 'EN': radio("What is your highest attained/completed level of education (or educational qualification)?", [["Primary (US: 6th grade | UK: primary school) not completed
",0], ["Primary (US: 6th grade | UK: primary school)
",1], ["Lower secondary (US: grades 7-9/ High school freshman
year | UK: secondary school) not completed
",2], ["Lower secondary (US: grades 7-9/ High school freshman
year | UK: secondary school)
",3], ["Upper secondary (US: grades 10-12/ Senior high
school/ high school | UK: GSCE/GCE)
",4], ["US: Associate’s certificate / Associate’s degree |
UK: Further education / sixth form college)
",5], ["Tertiary education: Bachelor’s Degree or higher",6]], "edu"); break; case "NL": radio("Wat is uw hoogst behaalde opleidingsniveau?", [["Lagere school/ Bassischool, maar niet afgemaakt

",0], ["Lagere school / Basisschool

",1], ["Middelbare school / Lager Basis Onderwijs, maar niet
afgemaakt. Wel ten minste tot de 2e klas afgemaakt

",2], ["Middelbare school / Lager basis Onderwijs afgerond

",3], ["Mulo, MBO, MAVO of VMBO-TL diploma/kwalificatie behaald

",4], ["Hbs, HBO, HAVO of VWO diploma behaald

",5], ["Universiteit afgerond (Bachelor, Master of
kwalificatie van een nog hoger niveau)",6]], "edu"); break; case "JP": radio("達成した最高の教育レベルは何ですか?
", [["(未完成) 小学校・支援学校小学部
",0], ["小学校・支援学校小学部
",1], ["(未完成) 中学校 ・ 支援学校中学部・中等教育学校
",2], ["中学校 ・ 支援学校中学部・中等教育学校
",3], ["高校・全日制/定時制別科(普通/総合/専門)
",4], ["短期大学別科・大学学部別科・全日制/定時制-専攻科
(普通/総合/専門)
",5], ["大学学部 ・短期大学・高等専門学校・
専修学校専門課程(専門学校)・大学院",6]], "edu"); break; } console.log("The participant's ISCE level is: " + response.edu); // get the gender from the participants main.setfontsize(135); switch(response.chosen_language) { case 'EN': radio("What is your gender?", ["Male","Female"],"gender"); break; case "NL": radio("Wat is uw geslacht?", [["Man","Male"],["Vrouw","Female"]],"gender"); break; case "JP": radio("性別は何ですか?", [["男性です","Male"],["女性です","Female"]],"gender"); break; } clear(); //log the chosen gender to the console console.log("the chosen gender is: " + response.gender); //Get the age from the participants // range() is used so not all ages have to be typed out. main.setfontsize(100); clear(); switch(response.chosen_language) { case 'EN': select("What is your age?
Please click on the number to select your age.",range(18,111),"age"); break; case "NL": select("Wat is uw leeftijd?
Als u klikt op het getal kunt u deze selecteren.",range(18,111),"age"); break; case "JP": select("年齢はなんですか?
数字をクリックして年齢を選択してください。",range(18,111),"age"); break; } console.log("the chosen age is: " + response.age); //create a block for preloading and later displaying the images. // the switch statements shows the text that is displayed while the images are still preloading switch(response.chosen_language) { case 'EN': text("The test is loading. Please wait a moment."); break; case "NL": text('De test is aan het laden. Een ogenblik geduld.'); break; case "JP": text("テストは読み込み中。しばらくお待ち願います。"); break; } b = main.addblock("center", "center", 60, 50); b.preload_range('matrix_{0}.jpg',1,37); b.preload_range('practise_matrix_{0}.jpg',1,7); image.await("preloading_completed"); clear(); //Display instructions in the different languages main.setfontsize(80); switch(response.chosen_language) { case 'EN': instruction("Welcome to the Raven's Standard Matrices Task."); instruction("You will now be shown various visual patterns. A piece is missing from every pattern. Your task will be to identify what belongs in the empty slot"); instruction("For each pattern there are 8 possible answer options. You can choose between by making use of the numbers keys on your keyboard (1 to 8) or you can click on the answers you think are correct."); instruction("You will frist be shown six practise problems. These won't be scored. After solving these problems you will be taken to the real test (36 problems)."); break; case 'NL': instruction("Welkom bij de Raven's Standard Matrices Taak."); instruction("Er zal een aantal figuurpatronen worden getoond. Er ontbreekt steeds een deel van het patroon."+ "Het is bij deze taak de bedoeling dat u bedenkt wat er op de plaats hoort van het missende deel."); instruction("Er zijn telkens acht antwoordopties. U kunt uw keuze aangeven door te drukken op de een van de toetsen genummerd van 1 tot en met 8. U kunt ook klikken op wat u denkt dat het goede antwoord is."); instruction("Eerst zal u zes oefenpatronen te zien krijgen. Deze tellen niet mee voor uw uiteindelijke score. Na het oplossen van deze patronen zal de echte test (36 patronen) beginnen."); break; case 'JP': instruction("レーブン漸進的マトリックスへようこそ!"); instruction("僕は大学院の神経心理学を専攻していて、知能テストに関する論文に取り組んでいる最中です。" + "

僕のために答えていただきありがとうございます"); instruction("いくつかの視覚的な問題を見せます。"+ "テストの前に実践式で6題の例題を実際に解いていただき最後に本番のテストに移ります(36題)。

解答は1〜8で答えてください。正しいと思う答えをクリックすることもできます。" + "答えるために、キーボードで1−8のキーをお押し願います"); instruction("例題で始めましょう"); break; } clear(); // example trials start here // there are 6 rounds so a for loop is made with 6 rounds. // it starts a timer logging how long the actual tests takes to complete, disregarding the questions // some text in the form of a counter is added for covinience, so people can see which out of the 6 matrices they are making. // participants can give answers the the matrix problems by using the number 1 to 8 on their keyboards. // in these practise trials, participants will be alerted if they answer incorrectly // if they answer correctly they will move on to the next matrix, until they finish the test trials. // they will need to repeat the same round until the press the correct number // if the participants presses the wrong button they will have to redo the same trial // the images are resized to 120% of their original size as a test trial participant mentioned the letters // for choosing the different answer options are too small var firstroundcomplete = 0; // this defined as such to prevent the timer defined below from resetting when round 0 has to be done again. var clickblock1 = addblock(55,20,24,15); var clickblock2 = addblock(55,36,24,15); var clickblock3 = addblock(55,52,24,15); var clickblock4 = addblock(55,68,24,15); var clickblock5 = addblock(82,20,24,15); var clickblock6 = addblock(82,36,24,15); var clickblock7 = addblock(82,52,24,15); var clickblock8 = addblock(82,68,24,15); var clickblockarr = [clickblock1,clickblock2, clickblock3, clickblock4, clickblock5, clickblock6, clickblock7, clickblock8]; for (i = 0; i < 6; i++) { if (i === 0 && firstroundcomplete === 0){ timeTaskBegin = now(); } var counter = addblock(10,20,10,10); counter.text((i+1)+"/6",80); b.setimage(practiseMatrix[i]); b.resize(120,120); waitfor { e = clickblockarr[0].await('click'); e.key = "1"; } or { e = clickblockarr[1].await('click'); e.key = "2"; } or { e = clickblockarr[2].await('click'); e.key = "3"; } or { e = clickblockarr[3].await('click'); e.key = "4"; } or { e = clickblockarr[4].await('click'); e.key = "5"; } or { e = clickblockarr[5].await('click'); e.key = "6"; } or { e = clickblockarr[6].await('click'); e.key = "7"; }or { e = clickblockarr[7].await('click'); e.key = "8"; } or { e = awaitkey('1,2,3,4,5,6,7,8'); } counter.destroy(); console.log("it should give the pressed key which is: " + e.key); console.log(e); if(e.key == practiseAnswer[i]) { switch(response.chosen_language) { case 'EN': alert("well done! This is correct. The next problem will now appear."); break; case 'NL': alert("Goed gedaan! Dit is het goede antwoord. Het volgende patroon zal nu verschijnen."); break; case 'JP': alert("よく出来ました!正解です 今次の例題が現れる"); break; } } else if (e.key !== '1'|'2'|'3'|'4'|'5'|'6'|'7'|'8') { console.log("An incorrect anwser was given for: " + practiseMatrix[i]); switch(response.chosen_language) { case 'EN': alert("This is not the correct answer, please try again"); break; case 'NL': alert("Dit is niet het goede antwoord. Probeer het opnieuw."); break; case 'JP': alert("この答えは正解ではありません。もう一度お試しください"); break; } i--; // decrement i by one so participant will do the same trial again. firstroundcomplete = 1; // this has been added to prevent the timer from restting when the participant // fails on the first trial } } b.destroy(); // so the box won't interfere with instructions. for (var i = 0; i < 8; i++) { clickblockarr[i].destroy(); // destroy all clickboxes so they won't interfere with the instructions. } clear(); // a message notifying the participants that the practise problems are over and the real questions will start from here. main.setfontsize(70); switch(response.chosen_language) { case "EN": instruction("You have finished the practise problems. After clicking on the screen, the real test will begin. The problems will increase in difficulty as you solve more. Try to find a solution for all the problems even if they seem difficult. If you nevertheless find yourself unable to continue any further you can press the 'abort test' button"); break; case "NL": instruction("U bent klaar met de oefenproblemen. Nadat u op het scherm heeft geklikt, begint de echte test. De patronen lopen op in moeilijkheid. Probeer de test volledig te maken en een antwoord te geven op elk probleem, zelfs wanneer de problemen moeilijk lijken te zijn. Als u toch overhoopt niet meer verder wilt gaan met de taak dan kunt u drukken op de knop met de tekst 'test afbreken'."); break; case "JP": instruction("練習問題はこれで完了です。 画面をクリックすると、現在のテストが開始されます。 問題はますます難しくなっています。 問題が難しそうと思われる場合でも、テストを完了して問題に回答してください。 それでもタスクを続行したくない場合は、「テストを中止する」というボタンを押すことができます。"); break; } //create the second block for preloading and later displaying the images. // A second one is made, and the first one is cleared so the block can never interfere with the 'OK' buttons in the instructions. switch(response.chosen_language) { case 'EN': text("The test is loading. Please wait a moment."); break; case "NL": text('De test is aan het laden. Een ogenblik geduld.'); break; case "JP": text("テストは読み込み中。しばらくお待ち願います。"); break; } b = main.addblock("center", "center", 60, 50); b.preload_range('matrix_{0}.jpg',1,37); b.preload_range('practise_matrix_{0}.jpg',1,7); image.await("preloading_completed"); clear(); // create the necessary blocks for clicking and put them in an array that can be looped through var clickblock1 = addblock(55,20,24,15); var clickblock2 = addblock(55,36,24,15); var clickblock3 = addblock(55,52,24,15); var clickblock4 = addblock(55,68,24,15); var clickblock5 = addblock(82,20,24,15); var clickblock6 = addblock(82,36,24,15); var clickblock7 = addblock(82,52,24,15); var clickblock8 = addblock(82,68,24,15); var clickblockarr = [clickblock1,clickblock2, clickblock3, clickblock4, clickblock5, clickblock6, clickblock7, clickblock8]; // keep track of the score for each individual item in the test. var itemsscore = []; var itemsscorefill = 0; // this fills in the score as 0 for all remaining items in the itemsscore array var didyouquit = "no"; // this will only change when somebody click the abort button //The REAL trials start here. //there are 36 rounds. In other aspects this loop is the same as the previous one // except for a couple important differences // 1. there is now a 'I give up' button if the participant no longer wants to continue // so that we can still log values properly even if they lose motivation // clicking the 'I give up' button lets the participant exit this loop and continue to the final questions // 2. When a particpant answers incorrectly they will not be notified. Their amount of correct answers will be tracked. for (i = 0; i < 36; i++) { if(itemsscorefill === 1) { itemsscore[i] = 0; continue; } var counter = addblock(10,20,10,10); counter.text((i+1)+"/36",80); var quit = addblock(35,75,35,20); switch(response.chosen_language) { case "EN": quit.button("taak afbreken"); break; case "NL": quit.button("abort task"); break; case "JP": quit.button("テストを中止する"); break; } b.setimage(matrix[i]); b.resize(120,120); console.log(quit); waitfor {var eQuit = quit.await('click');} or {e = awaitkey('1,2,3,4,5,6,7,8');} or { e = clickblockarr[0].await('click'); e.key = "1"; } or { e = clickblockarr[1].await('click'); e.key = "2"; } or { e = clickblockarr[2].await('click'); e.key = "3"; } or { e = clickblockarr[3].await('click'); e.key = "4"; } or { e = clickblockarr[4].await('click'); e.key = "5"; } or { e = clickblockarr[5].await('click'); e.key = "6"; } or { e = clickblockarr[6].await('click'); e.key = "7"; }or { e = clickblockarr[7].await('click'); e.key = "8"; } counter.destroy(); //if people click on give up if (eQuit === undefined) { eQuit = {}; eQuit.type = "notclick"; console.log("this is eQUIT", eQuit); } if (eQuit.type === 'click'){ itemsscore[i] = 0; //current item will be seen as incorrectly answered itemsscorefill = 1; didyouquit = "yes"; // because the person quit, this is for logging purposes. } // show what key has been pressed in the console (for convenience) console.log("participant pressed the: " + e.key + " key during the" + (i+1) +'th trial.'); if(e.key == answer[i]) { ++number_correct; itemsscore[i] = 1; console.log(itemsscore); //uncomment the console.log commands below for seeing the total score //console.log("A point was scored for "+ matrix[i]); //console.log("The total score is now: " + number_correct); //console.log("number_correct = " + number_correct); } else if (e.key !== '1'|'2'|'3'|'4'|'5'|'6'|'7'|'8') { //uncomment the console.log commands below for seeing the total score and which answers would've been correct itemsscore[i] = 0; console.log(itemsscore); //console.log("An incorrect anwser was given for: "+matrix[i]); //console.log("the answer should have been: " + answer[i]); //console.log("number_correct = " + number_correct); } else // if this else statement ever gets activated something has seriously gone wrong { console.log("The else statement was activated. This shouldn't be happening."); alert("You should press one of the number keys ranging from 1-8"); continue; } await(50); b.clear(); await(100); clear(); b.clear(); quit.destroy(); } // destroy the block that held the images b.destroy(); for (var i = 0; i < 8; i++) { clickblockarr[i].destroy(); // destroy all clickblocks so they won't interfere with the coming instructions. } timeTaskEnd = now(); total_test_time = timeTaskEnd - timeTaskBegin; //message displayed when having solved all the matrix problems or when the participant has pressed 'i give up'. switch(response.chosen_language) { case "EN": instruction("Well done! You've finished the test. Now we will ask you two questions about your experience during the test."); break; case "NL": instruction("Goed gedaan! Je hebt de test volledig gemaakt. We zullen u nu twee vragen stellen over uw ervaring gedurende de test."); break; case "JP": instruction("よく出来ました! テストが完了しました。 次に、テスト中の体験について2つの質問をします。"); break; } //question about how fun the test was for the participant switch(response.chosen_language) { case "EN": select("On a scale of 1 to 10 (where 10 is the highest/best score), how fun was this test?",range(1,11),"fun_o_meter"); break; case "NL": select("Hoe leuk was om deze test te maken op een schaal van 1 tot 10? (10 betekent de hoogste/beste mogelijke score)",range(1,11),"fun_o_meter"); break; case "JP": select("1から10までのスケールで、このテストはどのくらい楽しかったですか? (ここで、10は最高のスコアです)",range(1,11),"fun_o_meter"); break; } // question about how stressful the test was for the participant main.setfontsize(70); switch(response.chosen_language) { case "EN": scale("how stressful was this test for you?","Very Stressful", "Not Stressful at all","stress_o_meter"); break; case "NL": scale("hoe stressvol was deze test voor u?","Zeer stressvol", "helemaal niet stressvol","stress_o_meter"); break; case "JP": scale("このテストはあなたにとってどのくらいストレスがたまりましたか?","ストレスがたまりました", "全然ストレスがたまりませんでした","stress_o_meter"); break; } //provide different 'thank you' messages to different language speakers main.setfontsize(); switch(response.chosen_language){ case 'EN': text("Well done, you completed everything! Thanks for participating."); break; case 'NL': text("Goed gedaan, u heeft alles voltooid! Bedankt voor uw deelname."); break; case 'JP': text("よくできました。すべて完了しました! ご参加いただきありがとうございます!"); break; } //get end time of test + all questions timeEndAll = now(); timeTotal = timeEndAll-timeStartAll; //defining some variables so they can be logged. // all the relevant variables are logged in one row, which is more convenient than having many columns. logtrial(number_correct,"total_score",didyouquit); // con 1 = whether the participant quit the test or not log (date, "date"); // the date logged in milliseconds log(reponse.chosen_language, "test_language"); log(response.chosen_country, "country_residence"); log(response.gender, "gender"); log(response.age,"age"); log(itemsscore, "scores"); // this is an array of all the scores for each item log(total_test_time,"time_task"); // logs the time taken to finish the task, timer starts after the instructions for the practise items and ends // when all items have been answered or if the participants quits. log(timeTotal,"time_total"); // logs the time taken from the start of the test until the very end, including all instrunctions log(response.stress_o_meter,"stress_level"); // logs how stressful the participants thought the test was log(repsonse.fun_o_meter,"fun_level"); // logs how fun the participants thought the test was await(5000); closesession; await(3000);

Data inspection is forthcoming!

In the mean time, authors may download their own data and make it available as an Excel file. Check out the 'Stimuli and Files' tab.

Related Experiments