Removes all elements from the vectors listed.
In Resampling Stats, only one vector was allowed as an argument to this command. Statistics101 allows any number of vectors to be cleared with one command.
This command is most often used to clear a scoring vector (a vector created by the SCORE command) at the end of a nested loop so that the score will start from scratch on the next cycle through the outer loop. See the example at right.
COPY 1,10 var PRINT var CLEAR var PRINT var
The above program produces the following output:
var: (1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0) var: ()
The following program shows a typical use of the CLEAR command to clear a scoring vector before the next round of a loop:
'This calculates the probability that you will 'get exactly 4 heads in a row out of 5 coin 'flips. ' The calculated answer is 1/16 or 0.0625. ' COPY 10000 rptCount REPEAT 1000 REPEAT rptCount GENERATE 5 0,1 flips RUNS flips = 4 runFound IF runFound = 1 SUM flips runSum IF runSum = 4 SCORE runFound scrboard END END END SUM scrboard successes DIVIDE successes rptCount prob SCORE prob probs CLEAR scrboard 'Make ready for next round. END HISTOGRAM probs MEAN probs mean PRINT mean