Abstract:
A system and method for the operant conditioning of subjects using biofeedback includes means to measure a variable condition, such as posture, which is controllable by the subject. The apparatus sets criteria which, if not met, may result in a negative reinforcement, such as unpleasant audio tone or, if the criteria is met, will reward the subject. The criteria is automatically adjusted, upwards or downwards, in accordance with the subject&#39;s history of reaching, or not reaching, the criteria. 
     The device includes a programmed microcomputer whose inputs include digital converters and which simultaneously adjusts the criteria and which controls the stimuli means, such as a tone generator and its speaker.

Description:
This application is a continuation-in-part application based upon U.S. patent application Ser. No. 07/357,463, filed May 25, 1989, now U.S. Pat. No. 5,082,002. 
    
    
     BACKGROUND OF THE INVENTION 
     1. Field of the Invention 
     The present invention relates generally to biofeedback training using an automatic system for operant conditioning, and more particularly to a microcomputer-based training device to be worn by subjects. 
     2. Description of the Related Art 
     The present invention relates, in its broad aspects, to the field in experimental psychology known as operant conditioning. An article in this field is &#34;Shaping By Automated Tracking Of An Arbitrary Operant Response&#34;, by Pear and Legris, Journ. Experimental Analysis of Behavior, No. 2, Mar. 1987, pgs. 241-247, which describes the training of pigeons to peck at a target by rewarding the pigeons with food when they pecked at the target. The process is called &#34;shaping&#34; of &#34;operant responses&#34; because closer approximations to the target are rewarded (&#34;reinforced&#34;). The subject must continually improve in order to gain the reward. In the Pear-Legris article the size of the target was made smaller, which made the pigeons improve in finding the target and the birds&#39; movements were recorded using two TV-cameras connected to a microcomputer. The article concludes that &#34;current knowledge of what happens during shaping is primarily qualitative and not easily communicated . . . &#34; 
     An improved and microcomputer controlled automatic operant shaping process and system is envisioned to be applicable to various fields. For example, in the field of human physical rehabilitation training involving the skeleton-muscle system, it may be used to correct the walking gait of stroke patients. Another use may be as a respiration trainer for post-surgical patients who fail to breathe deeply enough following their operation. Other examples include its employment as a type of biological feedback to modify visceral functions, such as blood pressure and sensory motor rhythms. Outside of the field of medicine, operant response conditioning may be employed to improve sports performance and &#34;small motor&#34; tasks, i.e., hand tasks, such as keyboard entry learning. 
     The particular application of the present invention, discussed as an embodiment, is the treatment of idiopathic scoliosis, which is the pathologic lateral curvature of the spine. Idiopathic scoliosis, it is reported, affects 2-4% of adolescents, 80% of whom are female, and at least 6% of those affected have a truncal deformity which grows worse throughout adolescence. The usual treatment is for the patient to wear a brace, such as the Milwaukee brace, which fits around the chest and neck. The brace should be worn 23 hours a day, 7 days a week, from 2-4 years. Young girls hate wearing such braces, and often refuse or neglect to do so. Even those who manage to wear braces suffer. Sometimes the brace, in restricting truncal motion, may cause the trunk muscles to weaken or atrophy. The brace&#39;s constant pressure causes deformation of the rib cage or soft tissue on which the brace rests. 
     U.S. Pat. No. 4,055,168 to Neal Miller and Barry Dworkin, assigned to Rockefeller University, and the article &#34;Behavioral Method For the Treatment of Idiopathic Scoliosis&#34;, by Dworkin, Miller et al, Proc. Natl. Acad. Sci., Vol. 82, pgs. 2493-2497, Apr. 1985, both incorporated by reference, describe a posture training device for the treatment of idiopathic scoliosis. In that device one cable (body harness cord) extends around the chest of the patient to monitor respiration and a second cable extends around the longitudinal axis of the body from the pubis to the scalpula. Both cables are connected at their ends, in one embodiment, to slidable plates and in another embodiment to rotary potentiometers. 
     Although that posture training device was relatively successful on groups of test patients, compared to the treatment using braces, the device has not been commercially produced. 
     U.S. Pat. No. 4,337,049 to Edward Connolly describes a biofeedback system for the automated training of manual skills. The tasks are made &#34;successively more difficult until he reaches the criterion performance&#34; and the system &#34;varies criterion performance as a function of performance achievement by the trainee.&#34; The Connelly system changes the reinforcement feedback as the subject attempts to reach an ever-increasing goal, until finally there may be so much feedback that the subject tends to give up the training. 
     OBJECTIVES AND FEATURES OF THE INVENTION 
     It is an objective of the present invention to provide a method and system for use in biofeedback operant conditioning in which the subject&#39;s responses will be automatically obtained and the target conditions will be automatically and appropriately adjusted. 
     It is a further objective of the present invention to provide such a method and system in which the biofeedback is subject to program control which controls the density of the reinforcement feedback and, if the reinforcement is negative, adjusts it to within the tolerance of the subject, within upper and lower limits. 
     It is a still further objective of the present invention to adjust the feedback according to criteria, which is adjustable, so that the adjustments in the criteria track the subject responses, the closeness of such tracking also being selectable. 
     It is a further objective of the present invention, in the embodiment of a posture training device for the treatment of idiopathic scoliosis, to provide a device which permits the patient to move normally and without the confinement or embarrassment of a brace, whose warning signal of poor posture is not an embarrassment to the patient, and which provides a carefully programmed series of positive reinforcement rewards and negative reinforcement in a programmed series of changes in the criteria of acceptable posture, responsive to improvements and non-improvements, to enable the patient to attain an increasingly improved posture. 
     It is a feature of the present invention to provide a method and system for the training of subjects by biofeedback operant conditioning using a device worn by the subject. The method includes the steps of measuring for each time interval a body function variable R which changes and which the subject may control through effort. For example, the time intervals are sample periods of one second. The measurement is converted into digital data and communicated to a microcomputer within the device. The microcomputer automatically calculates an adjustable criteria C for the body function. 
     The microcomputer controls a feedback stimulus to the subjects, such as an audio tone, if the body function R does not meet the adjustable criteria C. The criteria C are automatically adjusted by the device to higher values when R exceeds C and to lower values when R is less than C, within upper and lower bounds for C. The variable R may be a calculated composite of two variable body functions, namely, automatic body function, such as breathing, and a conscious controllable body function, such as posture (spinal length). 
     It is a further feature of the present invention to provide a portable device for the treatment of patients having idiopathic scoliosis. The device is worn by the patient and uses biofeedback to improve the posture of the patient. The device includes one cable removably positioned around the chest of the patient to measure respiration (RES) and another cable longitudinally around the trunk of the patient to measure the length of the spine. The device has two transducer means connected to the cables to convert the expansion and contraction lengths of the cables and convert those changes in length into digital electrical signals. A digital microcomputer is connected to the transducers and has digital programmed memory and additional digital memory. The device has a feedback stimulus means, such as an audio tone, controlled by the microcomputer to stimulate the patient for training reinforcement. The microcomputer has computation means to compute an actual effective spine length R during sample periods where R=T-K·RES, T being the original in-posture spine length and K being the coefficient of coupling between T and RES; and control means to control the stimulus means so that the stimulus is applied only if R&lt;C where C is an adjustable criterion. The microcomputer also had adjustment means to automatically adjust C based upon prior R and C relationship. 
     SUMMARY OF THE INVENTION 
     In accordance with the present invention, there is provided a method and system to obtain improved training using biofeedback operant conditions, in which a microcomputer controlled device automatically responds to changes by a subject. The device is an automatic training or teaching instrument which shapes the subject&#39;s behavior. One embodiment is a patient-worn device for posture training in the treatment of idiopathic scoliosis. The device is battery operated and has two cables, one around the chest to monitor respiration and the other longitudinally about the trunk to monitor spinal length. Each cable has an end fixed at the device and a pullable end connected to a spring-loaded distance transducer. The transducers are preferably shaft encoders which are rotary motion to digital signal converters. 
     The device measures the posture of the subject, as monitored by the longitudinal trunk cable, taking account of respiration, as monitored by the chest cable. When the patient&#39;s posture is poor, a warning may be given, subject to the amount of the patient&#39;s prior poor performance, so that continued bad posture will provoke a warning signal, preferably an annoying tone sound audible to the patient. 
     The device is programmed, in accordance with the present invention, to provide what appears to the subject to be a random time period between the onset of bad posture and the start of the warning signal. That time period will vary depending on the amount of &#34;credit&#34; for good posture (within-criteria time) that has been accumulated by the subject in the reward timer. The device does not provide an immediate warning signal on the onset of bad posture, except if the subject has no &#34;credit&#34; in the reward timer, because such an immediate signal (tightly coupled time frame) would stress and irritate the subject. For good posture, the device is programmed to provide an instantaneous feedback, i.e., a tight coupled time frame of less than 1 second, so that good posture will immediately turn off the warning signal (negative reinforcer). The device automatically monitors and registers, in its memory, the amount of time the patient is out of correct posture and the amount of the time the warning is on. If the warning time is too long, for example, over 10% in any hour (over 6 minutes) the criteria of what constitutes the limits of acceptable posture are lowered (CL 1  lower criteria and CU 1  upper criteria). Conversely, if the patient does well for a time period, for example, one hour, the aforementioned limits of acceptable posture criteria are raised. The upper criteria (CU) and lower criteria (CL) are not fixed, but rather constitute a band which is automatically changed, for example, hourly, depending on the patient&#39;s progress. The audio tone, which is the negative reinforcement, includes a multiplicity of tone levels, and the level of time rises should the patient persist in remaining out of proper posture. However, if the patient maintains good posture, he will build-up &#34;credits&#34;, i.e., an accumulation of good posture time, which permits some time period of slouching, i.e., semi-poor posture. The device provides a constantly moving target which is immediately responsive to the subject. For example, if the subject is tired for a period (time epoch), for example, one hour, the limits (band) of acceptable posture are lowered. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     Other objectives and features of the present invention will be apparent from the following detailed description, taken in conjunction with the accompanying drawings. In the drawings: 
     FIG. 1 is a top plan view of the device of an embodiment of the present invention; 
     FIG. 2 is a front view of a patient indicating the orientation of the cables associated with the device of FIG. 1; 
     FIG. 3 is a block diagram and partly in perspective of an embodiment of the device of the present invention as shown in FIG. 1; 
     FIG. 4 is a circuit diagram of the circuitry of FIG. 3; 
     FIG. 5 is a software routine block diagram of the adjustment of k (coupling coefficient); 
     FIG. 6 is a software routine block diagram of the calculation of C (criterion) and tone management; 
     FIG. 7 is a software routine block diagram of the adjustment of C (criteria); 
     FIG. 8 is a chart plotting R,C, CU, and CL in arbitrary scale units against time; 
     FIG. 9 is a software routine block diagram of the compliance (use of the device); 
     FIG. 10 is a software routine block diagram of record keeping (storage); 
     FIG. 11 is a chart representing relationships between the criterion variable, the behavioral responsive variable (R), and the upper and lower criterion limits (CU, CL) at an arbitrary time in the present invention; and 
     FIGS. 12(a) and 12(b) are flow diagrams of a computer model of a behavioral tracking and shaping paradigm. 
    
    
     DETAILED DESCRIPTION 
     SYSTEM DESCRIPTION 
     As shown in FIGS. 1-3, the mechanical construction of the posture training device 1 is similar to the device of U.S. Pat. No. 4,155,168 in having two cables 10 and 11 connected at one of their respective ends to a case 1. The cable 10 extends around the chest and monitors respiration and the cable 11 extends longitudinally about the trunk to measure the spinal length, see FIG. 2. 
     The cables 10 and 11 each have intermediate buckles (not shown) to permit their fastening and unfastening. 
     The chest cable 10, which measures the length of the chest, as a respiration measure, at its end, is wound about a spring-loaded bobbin 20 connected to a shaft encoder 21. Similarly the trunk cable, which measures torso length, is wound on spring-loaded bobbin 22 which is connected to a shaft encoder 24. The encoders 21 and 24 are preferably rotary shaft encoders whose absolute (not relative) rotational position is converted by a Gray code by brushes which read conducting and non-conducting regions on the surface of the disks. Alternatively, other types of length to digital data transducers may be used. The digital Gray code electrical signal outputs of the shaft encoders 21 and 24 are converted into conventional binary code by the microcomputer 25. The microcomputer is preferably a NEC7500 which is a large-scale solid-state integrated circuit having an internal PROM program (Programmable Read Only Memory) 32. The various switches, controls and outputs of the device 1 are electrically connected to its internal microcomputer 25. 
     The signal inputs to the microcomputer 25 include the shaft encoders 21 and 24, the panic button 26 and the difficulty switches 27. 
     The signal outputs of microcomputer 25 are to the audio feedback 28, which is a piezoelectric tone generator and speaker, and the interface connector 29 which permits data loading and unloading from a host computer, for example, a personal computer (PC) such as the IBM-AT. A low power sensor 30 indicates when the battery power 31 is low. 
     The panic button 26 is a button on the device which may be operated by the user. The button 26, when depressed, stops the warning tone. The number of times that the button is depressed for a period, for example, one week, is recorded in the RAM memory 19. After the panic button 26 is pushed, the microcomputer 25 imposes a random delay, preferably between 1-5 seconds, before turning off the audio warning. The purpose of this delay, a loose time relationship between button actuation and deactivation of the audio tone, is to teach the user that it is better to improve his posture, thereby turning off the tone, than to push the panic button. 
     The warning audio tone is turned off immediately by the microcomputer when the spinal length is within the criteria, as explained below. For example, if the patient corrects his posture, the tone is immediately turned off, within 200 milliseconds and, in any event, less than 1 second. 
     OPERANT RESPONSE METHOD 
     The method is described below, in detail, in connection with the scoliosis device. However, its principles are applicable to other operant response systems and more than two encoders may be similarly combined. 
     The device obtains samples of the two parameters measured by the encoders. These parameters are &#34;RES&#34;, respiration and &#34;T&#34;, measured spine length. The samples are taken preferably at least once each second the device is worn by the patient. 
     The basic equation computed in the device is: 
     
         R=T-k·RES                                         Eq. 1 
    
     In this equation &#34;R&#34; is the &#34;calculated spine length&#34;, i.e., the spine length which is a measure of the spine length, moment-by-moment, taking account of respiration and other factors. &#34;T&#34; is the uncompensated torso length. &#34;RES&#34; is the respiration of the patient, i.e., the patient&#39;s chest expansion with each breath. &#34;k&#34; is the coefficient of coupling between T and RES and is a measure of the contamination which is automatically adjusted, as explained below. 
     The adjustment of k may reduce k to medium levels, for example, between 0.55 and 0.65 where T and RES are on arbitrary scales of 0 to 100. 
     As an example, without subtraction of the contaminating influence of respiration on spine length, variations in RES from a value of 30 (inspiration or breath in) to a value of 20 (expiration or breath out), might produce variations in T (and hence R) from 68 to 62 when its true length is 50. However, when k is set to 0.6, the calculated value of T will remain 50 (its true value) during both inspiration and expiration. 
     The microcomputer is programmed to adjust the value of k, shown by the software routine of FIG. 5 as follows. An adjustment &#34;minor epochs&#34; is set by the program, for example, 10 minutes. The processor (microcomputer and its inputs) measures R and stores, in its memory, the values of R. The values of the highest (R high) and lowest (R low) are retained in memory. After the series of minor epochs, for example, each hour, the adjustment is calculated by the formulas Eq. 2 and 3 below: ##EQU1## 
     The sums are over the series of minor epochs. 
     
         If S.sub.D &gt;1.0 increase k.                                Eq. 3 
    
     
         If S.sub.D &lt;1.0 decrease k 
    
     The increase or decrease is predetermined and is preferably about 0.01. The limits of k are set at between 0.5 and 0.85. 
     The above-described procedure for the adjustment of k is illustrated in FIG. 5. 
     The microcomputer calculates R (effective length) for each sample. A sample duration, for example, is one second. As shown in FIG. 6, the calculation of R controls the tone, i.e., audio tone signal which is produced by the speaker within the device 1. R, for each sample, is compared to &#34;C&#34;, which is a calculated number defining an acceptable posture, i.e., C is a standard defining an out-of-posture value. C is not constant, but is adjusted automatically by the microcomputer, as explained below. If R is less than C for a sample, i.e., the posture is below the accepted limit of C, the out-of-posture timer 40 is actuated. If R is greater than C, i.e., the posture is acceptable during the sample period, the in-posture timer 41 is actuated. If the tone is already on, the acceptable posture (R&gt;C) turns it off. If the tone is off, then the acceptable posture (R&gt;C) is timed and accumulated by the reward timer 42, which has a preset maximum, for example, 20 seconds. The various timers (counters) 40,41 and 45,46 are programmed counter functions of the microcomputer, as are the other timers (counters). 
     On the other hand, if R&lt;C, and the reward timer 42 has accumulated 0 time rewards, then the tone is turned on, i.e., the tone control flip-flop is set, which increments the tone-on-timer 44. In addition, an inner loop 50, 200 MS in duration, is actuated (shown by dot-dot line in FIG. 6). R is recalculated with the inner loop 50. If R&gt;C (posture acceptable) the tone is turned off. If the posture stays unacceptable (R&lt;C), the loop is repeated 5 times (1 second) before resuming the program. 
     Generally, the subject is simply told that his actions are, or are not, obtaining the desired target goal. For example, the patient is informed if his blood pressure is falling or rising. 
     An important element of the present invention is the automatic adjustment of C, the standard for an acceptable posture. The active control and management of C (acceptable posture) is central to the shaping of behavior. If C were to be static, as is often the case in biofeedback systems, the most efficient shaping of behavior would not occur. The programmed microcomputer presents a moving target, i.e., an ever-changing C. The definition of what constitutes an acceptable posture, so as to not turn on the tone, is automatically changed (adjusted). 
     As shown in FIG. 7, the changes in C are in response to the patient&#39;s maintaining acceptable posture, or failing to maintain acceptable posture. R may be less than C, i.e., R&lt;C (measured posture R worse than adjustable criteria C for a sample period, for example, 1 second). The times R&lt;C and R&gt;C decrement counters 45,46. If either times exceeds a pre-set time limit, C is adjusted. The amount of time set by the limits of counters 45,46 (47,48) determine how often C is changed, i.e., the fineness of the time varying gradations in C. Preferably the limits of limit counters 45,46 are in the range of 0.5-3 minutes, preferably 1 minute. 
     When the time limits in counters 45,46 are reached, C is changed by &#34;Delta&#34;, which is a predetermined amount. For example, where C is on a scale of 0 to 100, then Delta is in the range of 1-5, and is preferably 1. However, there is no change to C if its predetermined upper limit Cu (upper bound of C) or lower limit (C L  lower bound of C) would be reached. For example, if the limit 47 is exceeded because posture has been good for over 2 minutes, then C is adjusted upwardly (increment) by one unit, unless C is already equal to Cu (upper bound). Conversely, if limit 48 is reached C may be decremented, as explained above, unless C L  (lower bound) has been reached. After C is adjusted the limit counters 45,46 are reset to their original limits, i.e., 1 minute. 
     The predetermined adjustment amount Delta, for example 1 unit, is satisfactory for periods of acceptable posture. Adjustments of C using a fixed Delta provides a constantly higher definition of C (acceptable posture). For example, if C starts at 70 and the patient has 20 consistent periods of acceptable posture (R&gt;C) then C is adjusted to 90. The adjustment upwards of C stops at its upper limit (Cu), for example, at 90. 
     However, a fixed adjustment amount is unsatisfactory for the decrement adjustments. A fixed decrement amount would reward bad posture. Instead, until the lower bound (C L ) is reached, C is adjusted downwardly (decrement) by the formula: 
     
         Decrement by delta if C-R&gt;Delta                            Eq. 4 
    
     
         If C-R&lt;Delta then calculate C as C=R+e(psilon)             Eq. 5 
    
     As an example of Eq. 4, if C starts at 70 and R is measured at 65, and Delta is 1, then C-R (5)&gt;Delta (1) so the decrement adjustment to C is 1, C becomes 64. As an example of Eq. 5, if C starts at 70 and R is measured at 69, then C-R (1)=Delta (1) so that the decrement is not Delta but e(psilon), which is fixed but is less than Delta, for example 1/2. C is adjusted to 69.5 and continuing bad posture has not been rewarded as R remains below C, so that the tone may remain on. No criterion adjustment decrement C is made such that C is less than or equal to R, as such action would turn off the tone had it been on. Thus, the adjustment does not act as a reinforcer to the bad posture behavior. 
     In FIG. 8, the curve of R, as measured over time t of 1-second samples, is shown as gradually increasing in a non-linear manner. C (criterion) is progressively increased in 1 unit steps between Cu (upper limit) and C L  (lower limit). At position 60, R has dropped below C (cross-hatched lines) and consequently C is decremented. 
     FIG. 9 illustrates a suitable software routine to measure compliance. In the context of the posture training device, compliance is the amount of time that the subject wears the device, regardless of the subject&#39;s posture, and non-compliance is the amount of time the subject does not wear the device. For example, if a subject is supposed to wear the device almost all the time, even while sleeping, and the non-compliance time amount is over 20 hours a week, it indicates that the subject has not followed instructions in wearing the device. The device, in effect, looks at the cable around the chest and sees if it moves as it would during normal breathing (respiration RES). If the measured times between chest cable movements, which is RES old-RES new, is more than one minute, then the cable length is not being changed and the device is not being worn. 
     As shown in FIG. 9, the difference of successive respiration values increments an increment counter. If the limit is exceeded, the counter is reset and the non-compliance counter is started. This indicates that the device is not being worn. In addition, in order to save battery energy, part of the system is, in effect, put &#34;to sleep&#34; in that, as a result of the software routine shown in FIG. ;9, the multiplexer samples input data only once a minute instead of at its ordinary (non-sleep) input data sampling rate of once per second. The system will, under clock control, after a pre-set period, for example, one minute, automatically &#34;wake-up&#34;, i.e., go to its regular data sampling rate to take new readings. If the new readings still show that the device is not being worn, part of the system will again be put &#34;to sleep&#34;. The repeated putting to sleep of part of the system saves battery energy. 
     FIG. 10 illustrates the software rountine for record keeping. Counters in the device accumulate the subject&#39;s level of performance and time of compliance. The subject&#39;s performance is measured by the value of Cu attained each day. This is a stable and convenient measure of performance. The subject&#39;s compliance time, i.e., the time the device is worn, is measured by the non-compliance counter. Preferably, the performance measure (Cu) and compliance times are accumulated each day. The device uses 16 counters which are able to accumulate the most recent 16 days of data. This is the &#34;circular queue&#34; of FIG. 10 in which the counters form a circular buffer. The counters should be accessed and the data transferred to the host computer, i.e., downloaded, before the 16 days expire, through the interface 29 of the device. 
     In addition, another counter is used as a yearly cumulative counter. This counter will record the overall times the subject has been in compliance. 
     The embodiment set forth above and shown in FIGS. 1-10 relates to operant conditioning of patients with idiopathic scoliosis using an automated microcomputer-based posture training device. The discussion which follows is a general description of shaping behavior using an automated microcomputer-based device which preferably is worn by the subject. In the following discussion, the term R refers to the general body function which is variable and which the subject may control through effort, and R does not refer to the calculated spine length, which is a specific example of R. T is defined below and is not the uncompensated torso length, the specific example of T considered in the embodiment of FIGS. 1-10. As used below, C is the general behavioral criteria leverl (time varying target) at which behavior is reinforced, and not the standard defining an out-of-posture value, the specific example of C which is used in the embodiment of FIGS. 1-10. 
     INSTRUMENT BEHAVIOR SHAPING 
     The following additional definitions are used in the following discussion: 
     CL=The lower bound for C. This is adjusted by the device from time to time. 
     CU=The upper bound for C. This is adjusted by the device from time to time. 
     Ts=The sampling time at which C may be adjusted relative to R. Periodically, C will be increased or decreased (parameter). 
     T=The time at which (learned) behavior is re-evaluated; CL and CU may be changed at this time (parameter). 
     INCC=The amount by which C is incremented if the automatic device determines that it is appropriate. 
     DECC=The amount by which C is decremented. 
     INC(T)=The amount by which CL and CU are incremented at T if the percentage of time that the the subject has been reinforced is less than a specified (parametric) amount during the prior period (T). 
     DEC(T)=The amount by which CL and CU are decremented at T, if the percentage of time that the the subject has been reinforced is greater than a specified amount during the prior period. 
     r=The reinforcement; this is the information, for example the tone, which is returned to the subject regarding the relationship between C and R. 
     % r=percentage of reinforcement. 
     reward=Behavioral reward parameter which helps to determine if reinforcement is to be provided to the subject. 
     FIG. 11 represents the relationship between the variables C and R, and the parameters CL and CU at a given (and arbitrary) point in time. (The line represents a continuum of possible behavioral responses.) At each sampling period (Ts), the following (simplified) sequence of rules are applied: ##EQU2## 
     The first part of the sequence, above, is interpreted as follows: if R exceeds (or is equal) to C and the subject is being reinforced (aversive) then the reinforcement is immediately discontinued, however if, for this condition, reinforcement is not enabled then the subject is rewarded via the procedure &#34;increase (reward).&#34; The variable reward is considered to have a bounded value. If C exceeds R and the subject has exhausted the reward then the reinforcement is enabled, however the reinforcement may remain disabled if the subject has some remaining reward with the only consequence being the diminution of the reward (procedure &#34;decrease (reward)&#34;). 
     The second part of the sequence indicates that C will be increased if C is less than or equal to R, or decreased if C exceeds R. This second rule need not be imposed at every sampling interval but may be constrained so as to occur at less frequent intervals. However, the repeated application of this rule will result in C &#34;tracking&#34; R. An example of such tracking is shown in FIG. 11, where R is initially assumed to be well above C, and R remains constant over the interval of interest. If R continued to remain constant beyond the time frame which is included then C would &#34;oscillate&#34; about R and the reinforcement r would remain enabled for 50% of the time--% r would be 50. This would also be true, in the steady state, if S&#39;s response (R) were to vary in a random manner. This will be true as long as R does not migrate to either CL or CU. In such circumstances % r will take the steady state values shown in Table 1. 
     
                       TABLE 1______________________________________  Position of R           % r______________________________________  CL       100  CU        0______________________________________ 
    
     In the first instance (Table 1) C cannot be less than CL; C will be greater than R and r will be continuously enabled (true). Alternatively--the second case--C will always be less than R as it cannot exceed CU, consequently r will be continuously disabled. 
     In the prior discussion (FIG. 11(b)) it has been assumed that reinforcement is given when the subject fails to achieve the criterion (negative reinforcement). It is possible to structure the model such that positive reinforcement in the case of the subject may receive differential reinforcement, i.e. different feedback (e.g. tones) for success and failure. 
     The shaping of behavior is accomplished by extension of the tracking process. Periodically, at a time specified by the parameter T, the subject&#39;s performance is evaluated (by the device); the evaluation is based on the % r which has been achieved in the prior interval (T). CL and CU are changed according to the following rule: 
      (* In the Pascal pseudo-fragment which follows, % rlow and % rhigh are parameters which specify the limits of % r which are deemed to constitute a change in behavior; for example, for % r between 5% and 75%, no change in the criterion limits (CL, CU) are an appropriate decision for the device. *) ##EQU3## 
     The code fragment can be summarized as follows: if % r is less than % rlow (say 5%) then it is implied (see Table 1) that the subject&#39;s behavioral variable has been at CU a significant proportion of the time--the task is too easy and the limits of C (CU and CL) should be raised. If % r is greater than % rhigh, it may be inferred that the subject has been at CL a significant proportion of the time and the task is considered too difficult--the limits of C should be lowered. If the subject&#39;s behavior falls between these limits then no change is indicted. The combination of this rule and the tracking process previously described will maintain, in the steady state, % r at a constant value as described by the training strategy. The model described above would shape a one dimensional behavioral variable; extension to the multidimensional case would include parameters and variables for each behavioral component. 
     The result of this shaping paradigm is the tracking (&#34;servomechanism&#34;) of reinforcement density. That reinforcement density is kept at, or near, a constant. For example, the subject will receive reinforcement (negative) tones 1% of the time, on both his/her good and bad days. This is contrasted with baseline averaging which has been used in other instances and which results in great variability in the reinforcement. In the present system local changes in reinforcement density (transients) which are brought about by changes in CU and CL result ultimately in increasing reward. 
     A computer software outline Flow Diagram of a stochastic model of the paradigm described above is shown in FIG. 12, consisting of the TRACK (FIG. 12(a)) and SHAPING (FIG. 12(b)) procedures. This algorithm may be used to study the nature of instrumental learning as well as the various parameters which might affect its outcome (e.g. the way in which reward influences behavior). 
     The TRACK procedure simulates the tracking process previously discussed. The computer first calculates a pseudorandom number which is compared against the present value of the probability of the desired behavior. If the desired behavior (probability) exceeds the random number then the subject is considered to have made a proper behavioral response. The (simulated) value of this response is compared against a criterion. If the subject exceeds the criterion, the criterion is increased and the subject is credited with a reward value. 
     An aversive reinforcement may be generated if the criterion exceeds the value of the response, but will not be introduced if the subject has any reward remaining from antecedent trials. If this is the case, the reward parameter is decremented without application of reinforcement. If the subject has no outstanding reward, the reinforcement is initiated, the criterion is decreased, and the subject&#39;s ability to make the correct response is increased by increasing the probability of the correct response. The TRACK procedure may be repeated a number of times in order to simulate operation of the device. 
     Periodically, the SHAPING procedure may be executed; this corresponds to the periodic evaluation of the subject performance by the device. The training strategy to be simulated relies on relative constancy of reinforcement. The procedure includes a test to determine if ultimate goals should be adjusted. If the number of reinforcements (% of reinforcements) have been too few, then during the prior epoch the behavioral task has been &#34;too easy&#34; and the goals are increased. If the number of reinforcements have been too high then the task has been excessively onerous during the epoch, the criterion too stringent, and they are therefore reduced. 
     The SHAPING procedure introduces a sudden change in goals which will result in a behavioral transient. The subject may experience a short time increase in the number of reinforcements (during the TRACK procedure). The local increase in aversive reinforcement density has the effect of increasing response variability. As performance changes, the number of reinforcements are restored to a level which is acceptable to the subject.