John,
I don't know what to say. I hope I'm making another beginner's mistake - but I can't find it. I've used the debugger extensively this time, and no matter which way I try, I always end up with the same conclusion. I have been observing my samples "jumping from one bin to another" when I plot the histograms on a graph (straight lines become broken)...but only in certain very rare cases. It is hard to reproduce, but I have hard-coded one sequence that produces the error often, and this time rounding is taken into account properly.
Please run the code below a few times (output varies), and observe the last line of output. The contents of bin 7.59 should never increase after step 2...yet it does...sometimes (only), especially if "15" is replaced by "50" at the initialization. The reason why it increases is clear: some samples from bins 7.59, 7.60 and 7.65 (step 2) are discarded when bin 7.58 is filled at step 3. What is left of bins 7.59 and 7.60 is then ADDED and counted as being in bin 7.59. This result is wrong - data at 7.59 and 7.60 cannot be counted in the same bin if BinSize=0.01.....unless the exact width between fence-posts is more than 0.01, which seems to happen in this case
----------------------
DATA (7.60 7.59 7.58) Var-1-List
DATA ( 6 7 8 ) Var-2-List
DATA 15#7.65 Var-3-List 'replace 15 (50% error) by 50 (increase probability of error to 99%)
DATA 0 Explain 'set to 0 to see formatted output, set 1 for raw output
FOREACH Index 1,3
SHUFFLE Var-3-List Var-3-List
TAKE Var-1-List Index Var-1
TAKE Var-2-List Index Var-2
PUT Var-2#Var-1 1,Var-2 Var-3-List 'Multi-variable replacement procedure, with a random factor due to previous SHUFFLE
HISTOGRAMDATA Binsize 0.01 Var-3-List BinNumbersVec BinAStartsVec BinCentersVec BinFrequenciesVec
PRINT Index
PRINT Var-1
PRINT Var-2
IF Explain = 0
WRITE WINDOW ROWS BinAStartsVec%0.3F
WRITE WINDOW ROWS BinCentersVec%0.3F
WRITE WINDOW ROWS BinFrequenciesVec%0.3F
ELSE
WRITE WINDOW ROWS BinAStartsVec
WRITE WINDOW ROWS BinCentersVec
WRITE WINDOW ROWS BinFrequenciesVec
END
END
-----------------------------------
Please...help?
Gus