 Inquisit Language Reference

# itemprobabilities attribute

The itemprobabilities attribute specifies the probabilities with which the items in a list should be selected.

<list>

## Syntax

/ itemprobabilities = (value, value, value, ...]

or

/ itemprobabilities = [expression; expression; expression; ...]

or

/ itemprobabilities = distribution

## Parameters

value Any property or constant that can be converted to a decimal value.
expression Any valid expression that evaluates to a decimal value.
distribution One of the following values:
 Value Description uniform Randomly selects items with uniform probablity (i.e., 1/N). normal (Not yet implemented) Randomly selects items according to a gaussian distribution.

## Remarks

The itemprobabilities attribute is used to build a selection pool in which the specified items occur with the given probabilities. To build the selection pool with the given probabilities, the poolsize attribute must also be specified. Each probability must be a decimal value between 0 and 1, with the sum of all probabilities listed equal to 1. By default, items are selected with uniform probability. That is, items are added to the pool in proportion to their occurence in the items attribute.

Random selection is done on the fly, so if additional selection constraints such as maxrunsize or replace are in place, it may not be possible to satisfy them all on a give trial, especially if there are only a few remaining items in the selection pool. In that case, the list will suspend one of the constraints and try again. If it still can not satisfy the remaining constraints, it suspends another and tries again, and so forth. By default, the maxrunsize constraint is suspended first, then replace, and finally the not constraints. If a procedure requires that the constraints always be satisfied, pregenerate a set of selection sequences that satisfy the constraints and then randomly select one of the pregenerated sequences to use for a given session.

## Examples

The following list randomly creates a selection pool consisting of 25 instances of "A", 25 instances of "B", and 50 instances of "C", and randomly selects from this pool according to a uniform distribution.

``<list mylist>/ items=["A"; "B"; "C";]/ itemprobabilities=[.25; .25; .5;]/ poolsize=100/ selectionmode=random</list>``

Send comments on this topic:
Copyright Millisecond Software, LLC. All rights reserved.