From Bill Powers (950728.0955 MDT)]
Modelers:
Appended here is CYCLIC1.PAS which plots the results from the Staddon
experiments that Bruce Abbott brought to our attention. There is a plot for
each of the four rats, showing the schedule lines (white curves going right
and curving upward) and the deduced pressing rate within ratio (green
circles). The white curve on the right (without a green data point)
corresponts to FR-1 where there was no measurement. The others going from
right to left are FR-2,4,8,16,32, and 64.
The red circles show the uncorrected behavior rate plotted as if the ratio
lines were straight lines (these ratio lines are not shown to avoid
cluttering the diagram).
The rat plots are positioned
1 2
3 4
The vertical axis for the green circles is the actual pressing rate; for the
red circles it is the average behavior rate. The horizontal axis is the
reward rate. All time units are in hours (presses per hour, rewards per
hour).
The assumed collection time for each rat is initialized to the values deduced
by Bruce's method from the data. The values are in seconds, being converted
to hours before use in the calculations. These times can be adjusted by using
the up-down arrow keys to select and the + and - keys to change the value.
Hitting the Enter key replots all the data.
Calculations:
The observed behavior rate b is different from the actual pressing rate p
because after each pellet delivery there is a collection time c during which
there is no pressing. The actual time taken between reinforcements is
m/p + c
where m is the ratio, p is the pressing rate, and c is the collection time.
The observed behavior rate is the number of presses required, m, divided by
the time taken for that many presses plus the collection time, or
b = m/(m/p + c)
We can solve this equation for the pressing rate p:
p = m/(m/b - c)
This is how the green circles are positioned in y: the observed behavior rate
for each ratio is converted to a deduced pressing rate, under the assumption
that collection of the reward takes time c.
The reinforcement rate r is simply 1 divided by the time required to produce
m presses, which is m/p + c:
r = 1/(m/p + c)
This equation describes the apparatus: the reinforcement rate that results
from bursts of pressing at rate p alternating with collection times c. The
white lines on the plots are this relationship for each value of the ratio m.
Discussion:
Under the assumption that the pressing rate is constant, a straight line can
be fit to the relationship between ratio and time per reinforcement.
Extrapolating these lines to zero time per reinforcement produces an estimate
of the value of the collection time. The collection times in the parameter
adjustment box are initialized to these values.
If the pressing rate is not constant, then the only way to determine the
collection time is by observation. Since this observation was not made in the
Staddon experiment, we can only experiment with the effects of varying c.
That is why the c parameter is adjustable is this program.
When c is reduced, the pressing rates all show a decline on the right side,
aiming at an intercept at about 600+ rewards per hour. This would be the
proper way to estimate the reference level of a control system. The reference
level of the controlled variable is defined as that value of the increasing
controlled variable at which the behavior affecting it just falls to zero.
The next development of the CYCLICx program will be to include a control-
system model for each rat, with adjustable parameters for fitting the model
to the data for pressing rate. This model will use average values of
variables rather than the detailed treatment of OPCOND5.PAS. A complete test
of the model will not be possible until we have data that include observed
collection times and pressing rates while the animals are actually pressing.
After Bruce Abbott and other modelers check out this program and OPCOND5,
perhaps Bruce will want to post runnable code on his server for those who
don't have the facilities to compile source code.
···
----------------------------------------------------------------------
Best,
Bill P.
program cyclic1;
uses dos,crt,graph,grutils,setparam,frameplt;
const ratio: array[0..6] of real = (2.0,4.0,8.0,16.0,32.0,64.0,1.0);
type dataarray = array[1..4] of array[0..5] of real;
var r,p,b,g,m,ref: real;
c: array[1..4] of real;
i: integer;
rat: integer;
param: paramlisttype;
frame: array[1..4] of frametype;
maxx,maxy: integer;
ch: char;
b_per_hr,p_per_hr: dataarray;
plotarray: array[1..2] of array[1..4] of array[0..5]
of record x,y: integer; end;
procedure loadparams;
begin
with param[1] do
begin
legend := 'coll time 1';
kind := 'r';
rvinit := 5.35;
rvmin := 0.0;
rvmax := 100.0;
rvstep := 0.1;
rv := @c[1] ;
end;
with param[2] do
begin
legend := 'coll time 2';
kind := 'r';
rvinit := 5.77;
rvmin := 0.0;
rvmax := 100.0;
rvstep := 0.1;
rv := @c[2] ;
end;
with param[3] do
begin
legend := 'coll time 3';
kind := 'r';
rvinit := 5.47;
rvmin := 0.0;
rvmax := 100.0;
rvstep := 0.1;
rv := @c[3] ;
end;
with param[4] do
begin
legend := 'coll time 4';
kind := 'r';
rvinit := 5.21;
rvmin := 0.0;
rvmax := 100.0;
rvstep := 0.1;
rv := @c[4] ;
end;
end;
procedure loadframes;
begin
with frame[1] do
begin
numyvars := 1; mx := maxx; my := maxy;
xbase := 30; ybase := 240;
xsize := 250; ysize := 168;
numxgrid := 25; numygrid := 25;
xzero := 0; yzero := 0;
xmax := 1500.0;
ymax[1] := 12000;
ylegend[1] := 'Press Rate' ;
xlegend := 'Reinf Rate' ;
color[1] := white;
yvar[1] := @b ;
xvar := @r ;
end;
with frame[2] do
begin
numyvars := 1; mx := maxx; my := maxy;
xbase := 320; ybase := 240;
xsize := 250; ysize := 168;
numxgrid := 25; numygrid := 25;
xzero := 0; yzero := 0;
xmax := 1500.0;
ymax[1] := 12000;
ylegend[1] := 'Press Rate' ;
xlegend := 'Reinf Rate' ;
color[1] := white;
yvar[1] := @b ;
xvar := @r ;
end;
with frame[3] do
begin
numyvars := 1; mx := maxx; my := maxy;
xbase := 30; ybase := 30;
xsize := 250; ysize := 168;
numxgrid := 25; numygrid := 25;
xzero := 0; yzero := 0;
xmax := 1500.0;
ymax[1] := 12000;
ylegend[1] := 'Press Rate' ;
xlegend := 'Reinf Rate' ;
color[1] := white;
yvar[1] := @b ;
xvar := @r ;
end;
with frame[4] do
begin
numyvars := 1; mx := maxx; my := maxy;
xbase := 320; ybase := 30;
xsize := 250; ysize := 168;
numxgrid := 25; numygrid := 25;
xzero := 0; yzero := 0;
xmax := 1500.0;
ymax[1] := 12000;
ylegend[1] := 'Press Rate' ;
xlegend := 'Reinf Rate' ;
color[1] := white;
yvar[1] := @b ;
xvar := @r ;
end;
end;
procedure loadtable; { experimental data }
begin
b_per_hr[1,0] := 1007; b_per_hr[2,0] := 1050;
b_per_hr[3,0] := 1088; b_per_hr[4,0] := 1125;
b_per_hr[1,1] := 1767; b_per_hr[2,1] := 1825;
b_per_hr[3,1] := 1887; b_per_hr[4,1] := 2022;
b_per_hr[1,2] := 2711; b_per_hr[2,2] := 3026;
b_per_hr[3,2] := 3120; b_per_hr[4,2] := 3522;
b_per_hr[1,3] := 3660; b_per_hr[2,3] := 4146;
b_per_hr[3,3] := 4723; b_per_hr[4,3] := 5243;
b_per_hr[1,4] := 4255; b_per_hr[2,4] := 4820;
b_per_hr[3,4] := 5821; b_per_hr[4,4] := 6486;
b_per_hr[1,5] := 4711; b_per_hr[2,5] := 5893;
b_per_hr[3,5] := 6575; b_per_hr[4,5] := 7481;
end;
procedure placepoint(rat,v: integer);
var u: real;
x,y: integer;
begin
with frame[rat] do
begin
u := yvar[v]^ * yscale[v];
y := my - ybase - yzero - round(u);
x := xbase + xzero + round(xvar^*xscale);
if (y > my - ybase - ysize) and (y < my - ybase) then
circle(x,y,3);
end
end;
procedure showratdata(rat: integer);
var m: real;
i: integer;
begin
for i := 0 to 5 do
begin
m := ratio[i];
r := b_per_hr[rat,i]/m;
b := b_per_hr[rat,i]; { apparent behavior rate }
setcolor(lightred);
placepoint(rat,1);
b := m/(m/b_per_hr[rat,i] - c[rat]/3600.0);
setcolor(lightgreen);
placepoint(rat,1);
end;
end;
procedure showformula(rat: integer);
var m: real;
j,i: integer;
begin
for i := 0 to 6 do
begin
m := ratio[i];
for j := 1 to 200 do
begin
p := 60*j;
b := p;
r := 1.0/(m/p + c[rat]/3600.0);
plotvar(frame[rat]);
end;
end;
end;
begin
clrscr;
initgraphics;
maxx := getmaxx; maxy := getmaxy;
loadparams;
setupparam(maxx - 200,0,4,param);
loadframes;
for rat := 1 to 4 do
initframe(frame[rat]);
loadtable;
repeat
for rat := 1 to 4 do
begin
showratdata(rat);
showformula(rat);
end;
repeat
ch := changeparam(param);
until (ch = chr(13)) or (ch = 'q') or (ch = chr(27));;
for i := 1 to 4 do clrplot(frame[i]);