tisane.variable.Exactly.per

method

Exactly.per(cardinality=None, number_of_instances=None)

Express a per relationship on a given Exactly

Even though cardinality and number_of_instances are both optional parameters, this method requires exactly one of them to be specified – you currently cannot specify both.

Parameters
Returns

An object representing a “_ per _” relationship.

Return type

tisane.variable.Per

See also

tisane.AtMost.per

create a per relationship with an AtMost multiplier

Examples

Rats are either given a supplement or a placebo three times a day, so exactly 3 per day

>>> import tisane as ts
>>> from tisane import Exactly
>>> rat = ts.Unit(name="rat_id", cardinality=30) # 30 rats in the study
>>> days = rat.ordinal(name="day_num", cardinality=28) # 4 weeks of data for each rat
>>> memory_test_result = rat.numeric(name="memory_test_result",
...                                  number_of_instances=days)
>>> supplements = rat.nominal(name="supplement",
...                           categories=["placebo", "supp"],
...                           number_of_instances=Exactly(3).per(cardinality=days))