StatsResample

Hi,

I need to calculate the SD computed from 10,000 replicates of a bootstrap resampling from a column of data (N=25, wave0). I'm stuck after entering

StatsResample /N=25 /ITER=10000 /SQ=0 /WS=1 /Z wave0

How do I get the value for the standard deviation and the mean from the 10,000 iterations?

Thanks,
Gerry



Hello Gerry,

Assuming that by "SD" you mean "Standard Deviation", you should look for V_sdev or sdev in the various results that the operation produces. The Standard Deviation is not a first order moment so /WS=1 is not a good idea. I suggest /WS=2.

Now, if you use:
StatsResample/N=25/Iter=100000/WS=2 wave0

You will find (see in the Data Browser) a wave called M_WaveStatsSamples that contains the WaveStats results in one column per iteration. The wave includes dimension labels for all rows so that you can use, for example,
print M_WaveStatsSamples[%sdev][10]


To print the sdev of the 11th iteration (the first iteration is in column zero).

I hope this helps,

A.G.
WaveMetrics, Inc.

Thank you. Your suggestions were very helpful. Could you also suggest a way to compute the average standard deviation from all of the 10,000 iterations?

I tried WaveStats M_WaveStatsSamples[%sdev] but that does not work.
I tired to figure out how to transpose one selected row (line 4 of WaveStatsSamples) into a column then run wavestats, but no luck so far.

Any suggestions?

Thanks,
Gerry
Try

Make /N=10000 wSDEV   //Make N = number of columns you need to extract
wSDEV[] = M_WaveStatsSamples[4][p]
WaveStats wSDEV
Thanks for the suggestion, but that did not work. wSDEV has the correct dimensions but does not the right numbers in it.


Does anyone have any more suggestions on how to make a new wave from the 4th row only of M_WaveStatsSamples in order to calculate the average standard deviation from all bootstrap resamplings?

Thanks,
Gerry
gerry wrote:

I tried WaveStats M_WaveStatsSamples[%sdev] but that does not work.

The expression "does not work" provides zero useful information to help us help you: Which part did not work? What error message did you get? Did you make sure the appropriate waves were created in the current data folder? Did you make sure that you, in fact, have a wave called wave0 in the current data folder?

Quote:
I tired to figure out how to transpose one selected row (line 4 of WaveStatsSamples) into a column then run wavestats, but no luck so far.

Any suggestions?


That in fact hints at the possibility that StatsResample actually executed correctly. I'm afraid the indications are that you are having difficulties with basic IGOR operations. I would like to make sure that you have gone through the getting started tutorial and that you are comfortable working with waves. When that is the case I'd proceed with executing the command exactly as I indicated above. In fact, I suggest that you copy the following lines and execute them in a new experiment just to illustrate the point:
make/n=25 wave0=enoise(10)
StatsResample/N=25/Iter=100000/WS=2 wave0
print M_WaveStatsSamples[%sdev][10]


If you are getting any error here please report it to support@wavemetrics.com.

Once your resolve the other issues, you can extract any row using MatrixOP's row() function, e.g.,
MatrixOP/O row10=row(M_WaveStatsSamples,10)


To combine the extraction and transpose in one line (for the sdev case):
matrixop/o row4=row(M_WaveStatsSamples,4)^t


At this point, if you only need the mean value execute:
print mean(row4)

Or if you want the complete wave stats for this wave:
WaveStats row4




I hope this helps,

AG
Many thanks A.G.! I'm familiar with most of Igor commands, put I tend to stick to 1D waves instead of matrix operations. Your code produces the values I need and I will try to learn more about matrix operations for future calculations.

Thanks,
Gerry
gerry wrote:
Thanks for the suggestion, but that did not work. wSDEV has the correct dimensions but does not the right numbers in it.


I went back and actually tried the suggestion that I made and found that it worked. Below is a combination of AG's code for generating the resampling output (the number of iterations is decreased from 100,000 to 10,000) with the simple wave manipulation that I had previously suggested. You might try copying the following into the command line and executing it from there.

make/n=25 wave0=enoise(10)
StatsResample/N=25/Iter=10000/WS=2 wave0
Make /N=10000 wSDEV   //Make N = number of columns you need to extract
wSDEV[] = M_WaveStatsSamples[4][p]
WaveStats wSDEV


You should find that wSDEV is the same as row four in M_WaveStatsSamples. Perhaps M_WaveStatsSamples was not in the current directory when you tried my suggestion?
Thank you jtigor!! I apologize for my earlier incorrect statement. Your code does produce the correct values!! I must have executed another command in between your suggestions. Thanks again!

Sincerely,
Gerry