Appendix

This content is an excerpt from

z-Tree 3.5: Tutorial and Reference Manual
by

Urs Fischbacher, Thurgau Institute of Economics at the University of Konstanz
Katharine Bendrick, Southern Connecticut State University
Stefan Schmid, University of Zurich

Zleaf properties

Input layouts

Integer number

1

integer

Text (predefined)

!text: 1="one"; 2="two"; 3="three";

text

Radio

!radio: 1="one; 2=two"; 3="three";

radio

Radioline

!radioline: 1="one"; 3="three";3;

radioline

Radiosequence

!radiosequence: 1="one; 2=two"; 3="three";

radiosequence

Slider

!slider: 1="one"; 3="three";3;

slider

Scrollbar

!scrollbar: 1="one"; 3="three";3;

scrollbar

Checkbox

!checkbox: 1="one; 2=two"; 3="three";

checkbox

Button

!button: 1="one; 2=two"; 3="three";

button

!string

Important functions

Scope operator

The scope operator : defines which variables are used to compute function's outcomes.

Take the following example form the manual

C = sum( A * B);
D = sum( :A * B);
E = sum( :A * :B);
A B C = sum( A * B ) D = sum( :A * B ) E = sum( :A * :B )
2 5 10 + 48 + 56 = 114 10 + 24 + 14= 48 10 + 10 + 10 = 30
4 12 10 + 48 + 56 = 114 20 + 48 + 28 = 96 48 + 48 + 48 = 144
8 7 10 + 48 + 56 = 114 40 + 96 + 56 = 192 56 + 56 + 56 = 168

This is an example taken from the manual (page 27)

A V
1 3
4 6
B V
7 8
10 11
13 14

This is the zTree code

X1= sum(V);
X2= tb.sum(V);
X3= tb.sum(:V);
X4= sum(:V);
X5= tb.sum(:V);
X6= sum( product (V) );
X7= sum( product (:V) );
X8= sum( product (::V) );
X9= tb.sum( product (V) );

These are the results

A V X1 X2 X3 X4 X6 X7 X8 X9
1 3 9 3+63+6 33 8+11+148+11+14 9 3+3+33+3+3 6 3+33+3 36 36+633*6+6*3 45 33+663*3+6*6 18 3333*3*3 3696 811148*11*14+811148*11*14+811148*11*14
4 6 9 6+36+3 33 8+11+148+11+14 18 6+6+66+6+6 12 6+66+6 36 63+366*3+3*6 45 66+336*6+3*3 72 6666*6*6 3696 81114+81114+811148*11*14+8*11*14+8*11*14

The scope operator allows also to specify the level to which we access one variable when functions are carried out in nested tables.

Take the following example: the variable vv is present in table tAt_A, in table tBt_B and in table tCt_C.

Assume that the following operation is conducted in table tAt_A.

X=vtA+tB.sum(vtB:vtA+tC.sum(vtC:vtB::vtA))X=\underbrace{v}_{t_A} +t_B.sum(\underbrace{v}_{t_B} * \underbrace{:v}_{t_A} + t_C.sum(\underbrace{v}_{t_C} * \underbrace{:v}_{t_B} * \underbrace{::v}_{t_A} ))

The equation shows the "scoped" variables