嗯。有很多方法可以改变那个宏。
您所说的问题的原因是 Statistics 的 Variance 子命令将结果存储在整列中,覆盖了内容。如果您真的想将 200 个单独的子样本存储在单独的列中,那么应该这样做:
GMACRO #Starts the global macro
Resample #Names the macro
Name c202 "Variance" # no need to name this column 200 times!
DO K1=2:201
Sample 16 'Data' CK1;
Replace. #Resampling
Statistics CK1; # Calculate S^2
Variance C203. # into row 1 of temporary column C203
Stack 'Variance' C203 'Variance' # append to end of Variance
ENDDO
erase K1 c203 # clean up
ENDMACRO #Ends the macro
如果您想存储子样本但很乐意将它们存储在两列中,那么这更简洁:
GMACRO #Starts the global macro
Resample #Names the macro
Name C2 'Sample number' c3 'Sample data'
set 'Sample number' # populate Sample number
(1:200)16
end
DO K1=1:200
Sample 16 'Data' c4;
Replace. #Resampling
Stack C4 'Sample data' 'Sample data' # append to Sample data
ENDDO
Name c4 "Variance"
Statistics 'Sample data';
By 'Sample number';
Variance 'Variance'.
ENDMACRO #Ends the macro
当然,带替换的 200 x 16 样本与带替换的 3200 个样本相同,因此更整洁 - 更快 - 将是:
GMACRO #Starts the global macro
Resample #Names the macro
Name C2 'Sample number' c3 'Sample data'
set 'Sample number' # populate Sample number
(1:200)16
end
Sample 3200 'Data' 'Sample data';
replace.
Name c4 "Variance"
Statistics 'Sample data';
By 'Sample number';
Variance 'Variance'.
ENDMACRO #Ends the macro