Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

Latin square design with JavaScript

Hello,

I am attempting to implement a latin-square randomized design, and I have created a quick template in OpenSesame to figure out how it would work. I am referencing a previous post by sebastiaan from 2017 (https://forum.cogsci.nl/discussion/2401/selecting-randomization-lists-in-latin-squared-designs). I have created a template with 4 blocks, as shown in the images below:


When I try to run the experiment, I get the error message "ReferenceError: items is not defined". Any ideas on how I can successfully implement this design using JavaScript instead of Python, so that I may run it online?

Thank you!

Daniel

Comments

  • ** Sorry for the duplicate post **

    I solved this problem by using the "slice" command in the block_loop, after creating two variables at the top of the experiment, as so:

    vars.slice_top = (vars.subject_nr * 4);

    vars.slice_bot = (vars.slice_top + 4);

    In the block_loop script, I put:

    slice "[slice_top]" "[slice_bot]"

  • Hello,

    I am having trouble implementing this solution in OSWeb, yet on OpenSesame it works flawlessly. I have several blocks of trials, all under the loop "block_loop". The block_loop contains every condition, with a variable called counterbalancing assigned to it. I then calculate which order of blocks the participant will see using the code above in an inline_javascript item.

    Again, this works in OpenSesame but not in OSWeb. I initially thought it was a problem of OSWeb not having access to any subject number, since it does not query for one at the beginning of the experiment. So, per @Daniel post here: (https://forum.cogsci.nl/discussion/5930/jatos-how-to-assign-or-collect-participant-number), I left the "Possible subject numbers" field empty, uploaded the experiment to the Cortex test server, but still, the experiment never gets into the loop.

    If I place a sketchpad before and after the loop, for instance a welcome and ending screen, those appear sequentially, but the loop is skipped.

    Could this be an issue with the "slice" command in the block_loop script? Or any other ideas?

    Thank you!

    Daniel

  • Hi @Daniel_513

    It seems as if each of your posts in this thread asks a different question, or actually tries to solve a different problem. So to answer a few of your questions in order:

    When I try to run the experiment, I get the error message "ReferenceError: items is not defined". Any ideas on how I can successfully implement this design using JavaScript instead of Python, so that I may run it online?

    This is hard to tell if we don't know where or how in your experiment items is referred to. Did you compose this experiment purely of OpenSesame items, or did you also use inline_javascript items? If ther former, then this may well be a bug. If the latter, then it helps if you also post the contents of your script here.

    Could this be an issue with the "slice" command in the block_loop script? Or any other ideas?

    This is really hard to tell from the information provided. Given that it works in OpenSesame and not in Osweb usually does indicate a bug in Osweb. Have you tried not encapsulating the slice values in quotes? Thus

    slice "[slice_top]" "[slice_bot]"
    

    becomes

    slice [slice_top] [slice_bot]
    

    Otherwise you can post your experiment here and I can have a look.

    Buy Me A Coffee

  • Hello @Daniel,

    Sorry for my confusion with my posts. My first post, where I mentioned the ReferenceError, no longer applies, as I took a different approach to solving this problem by using the slice command in the outer block loop script. I will attach below the project I have been working on to test how to accomplish this randomization in OSWeb. The idea is there are four blocks of trials (in this template every block is simply a number being shown on the screen corresponding to which block is being shown [i.e. 1, 2, 3 or 4]), and based on the subject number, the four numbers are displayed in the order determined by the outer block loop. I have created this template to isolate this issue, so that I don't have to deal with actual blocks of trials and so forth.

    Thank you very much for your help with this!

  • edited June 2

    Hi @Daniel_513

    I think this is indeed a bug in osweb. If I hardcode something like `slice 2 5` the experiment does work in the browser, but if I use variables like you did, it doesn't. I have created an issue for it in osweb's issue tracker: https://github.com/smathot/osweb/issues/18 and we will add a fix for this in the next patch release of osweb. Thanks for reporting it, and apologies for the inconvenience.

    Buy Me A Coffee

  • Hi @Daniel

    Thank you very much for your support with this. I suspected this was the case, as it worked fine in OpenSesame. Would you by chance be able to provide an estimate of when you think the next patch release of osweb will be released? If it would be a matter of weeks, or months, just to have an idea?

    Thanks again!

  • Hi @Daniel_513

    Though this should be a relatively easy and quick fix, I cannot make any promises. I am quite swamped with other tasks at the moment, and since this is a project on the side I cannot give it currently much priority. I hopefully will get around to this next week, but I cannot make any promises. If I get it done then you will have to update osweb inside opensesame manually, as there just has been a new 3.3.2 release, and I have no idea when 3.3.3 will be released.

    Buy Me A Coffee

  • Hi @Daniel

    Sorry for my late response. Thank you very much for your help with this!

  • Hi @Daniel

    I was wondering if you've been able to make any headway with fixing this bug. If not then no worries, as I know you've been really busy with other things. Thanks again for your help!

    --Daniel

  • Hi @Daniel_513.

    I just issued a fix: https://github.com/smathot/osweb/pull/21. It still needs to be reviewed by @sebastiaan though, so I don't know when a patch release of osweb will happen, but this shouldn't take too long. After this, you should be able to upgrade osweb from inside OpenSesame by following the instructions on: https://osdoc.cogsci.nl/3.3/manual/environment/

    Buy Me A Coffee

Sign In or Register to comment.

agen judi bola , sportbook, casino, togel, number game, singapore, tangkas, basket, slot, poker, dominoqq, agen bola. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 50.000 ,- bonus cashback hingga 10% , diskon togel hingga 66% bisa bermain di android dan IOS kapanpun dan dimana pun. poker , bandarq , aduq, domino qq , dominobet. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 10.000 ,- bonus turnover 0.5% dan bonus referral 20%. Bonus - bonus yang dihadirkan bisa terbilang cukup tinggi dan memuaskan, anda hanya perlu memasang pada situs yang memberikan bursa pasaran terbaik yaitu http://45.77.173.118/ Bola168. Situs penyedia segala jenis permainan poker online kini semakin banyak ditemukan di Internet, salah satunya TahunQQ merupakan situs Agen Judi Domino66 Dan BandarQ Terpercaya yang mampu memberikan banyak provit bagi bettornya. Permainan Yang Di Sediakan Dewi365 Juga sangat banyak Dan menarik dan Peluang untuk memenangkan Taruhan Judi online ini juga sangat mudah . Mainkan Segera Taruhan Sportbook anda bersama Agen Judi Bola Bersama Dewi365 Kemenangan Anda Berapa pun akan Terbayarkan. Tersedia 9 macam permainan seru yang bisa kamu mainkan hanya di dalam 1 ID saja. Permainan seru yang tersedia seperti Poker, Domino QQ Dan juga BandarQ Online. Semuanya tersedia lengkap hanya di ABGQQ. Situs ABGQQ sangat mudah dimenangkan, kamu juga akan mendapatkan mega bonus dan setiap pemain berhak mendapatkan cashback mingguan. ABGQQ juga telah diakui sebagai Bandar Domino Online yang menjamin sistem FAIR PLAY disetiap permainan yang bisa dimainkan dengan deposit minimal hanya Rp.25.000. DEWI365 adalah Bandar Judi Bola Terpercaya & resmi dan terpercaya di indonesia. Situs judi bola ini menyediakan fasilitas bagi anda untuk dapat bermain memainkan permainan judi bola. Didalam situs ini memiliki berbagai permainan taruhan bola terlengkap seperti Sbobet, yang membuat DEWI365 menjadi situs judi bola terbaik dan terpercaya di Indonesia. Tentunya sebagai situs yang bertugas sebagai Bandar Poker Online pastinya akan berusaha untuk menjaga semua informasi dan keamanan yang terdapat di POKERQQ13. Kotakqq adalah situs Judi Poker Online Terpercayayang menyediakan 9 jenis permainan sakong online, dominoqq, domino99, bandarq, bandar ceme, aduq, poker online, bandar poker, balak66, perang baccarat, dan capsa susun. Dengan minimal deposit withdraw 15.000 Anda sudah bisa memainkan semua permaina pkv games di situs kami. Jackpot besar,Win rate tinggi, Fair play, PKV Games