Preparing a list of numbers based on certain rules and conditions

Dear All,
I need to generate a list of 100 trials for my experiment. Each trial is a row with 5 columns consisting of the numbers 1,2,3,4 and 5. Eg: Trial 1 = 5 3 2 1 4 Trial 2 = 5 4 2 3 1 Trial 3 = 4 2 3 5 1 The conditions and rules are as follows:
1) The number 5 is the target number
2) None of the numbers from 1 to 5 should repeat itself within a trial except in catch trials.
3) Valid trials = In 60 % of the trials the target number should occur in the first column
4) Invalid trials = 20 % of the trials the target number should occur in the remaining columns (2nd, 3rd, 4th and 5th columns). The individual probability of target number occurring in each of these 4 columns should be nearly equal. Invalid trails cannot occur consecutively and should be preceded by either a catch trial or valid trial with equal probability.
5) Catch trials = In the remaining 20 % of the trials none of the columns should contain the target number. Any one non-target number from 1 to 4 can be repeated with equal probability of each of those 4 numbers to be repeated within the 20 trials
6) There should be a minimum of 3 consecutive valid trials before a catch or invalid trial.
As I am just a beginner, any help in this regard is much appreciated. Thanks in anticipation.
Regards, Imran

2 comentarios

Sounds like a fairly strict set of conditions. Originally reading your post I thought you were looking to randomly generate these trials with roughly 60/20/20% probability. But it sounds like you need exactly 60/100 valid, etc., which would mean you need to generate each trial conditionally based on the trials that preceded it. Please confirm. If that is the case you should be able to just loop over the 100 trials and have different sub-functions to generate each trial type.
@ Anthony Smith. Thanks for the reply. Yes, you are correct the trials need to be generated based on the ones preceding it.
regards,
Imran

Iniciar sesión para comentar.

 Respuesta aceptada

Daniel Shub
Daniel Shub el 17 de Jun. de 2011
I would split this problem into two parts. The first part would be to create a cell array trialType (100 x 1) which indicates the type of trial (valid, invalid, or catch) that satisfies all the requirements on the trials (i.e., 60%, 20%, 20%, no consecutive invalid trials, and starting with 3 valid trials). Then once you know the trial type, make the row of 5 numbers for each trial.

2 comentarios

@ Daniel. Thanks for the reply. Could you please elaborate the method of generating the first part ? I am still finding it difficult to generate the first part.
Thanks.
I would suggest editing this question (or potentially asking another question) which shows what you have tried and where you are stuck. Can you make a list of 100 trials that satisfies the 60/20/20 relationship? What about the starting with 3 valid trials ...

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Graphics Performance en Centro de ayuda y File Exchange.

Etiquetas

Aún no se han introducido etiquetas.

Preguntada:

el 16 de Jun. de 2011

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by