StatsResample
gerry
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
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:
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,
To print the sdev of the 11th iteration (the first iteration is in column zero).
I hope this helps,
A.G.
WaveMetrics, Inc.
February 11, 2013 at 02:54 pm - Permalink
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
February 11, 2013 at 03:44 pm - Permalink
wSDEV[] = M_WaveStatsSamples[4][p]
WaveStats wSDEV
February 12, 2013 at 05:12 am - Permalink
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
February 12, 2013 at 09:42 am - Permalink
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?
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:
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.,
To combine the extraction and transpose in one line (for the sdev case):
At this point, if you only need the mean value execute:
Or if you want the complete wave stats for this wave:
I hope this helps,
AG
February 12, 2013 at 10:00 am - Permalink
Thanks,
Gerry
February 12, 2013 at 10:12 am - Permalink
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.
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?
February 12, 2013 at 10:41 am - Permalink
Sincerely,
Gerry
February 12, 2013 at 11:03 am - Permalink