Creating tables to show bootstrapping results

Hello,

After discovering the bootstrapping feature in Igor, I have tried to replicate the bootstrap example on the WaveMetrics website. The first part went well, but also after reading the manual I don't see as yet how I might make a table, which shows descriptive statistics as rows and iterations (runs) as columns. I managed to make the attached table. Problem with the table is that it is hard to figure out what the numbers represent.

Also I would like know some way to show all of the 100 values from every sample (run) in a column.

In terms of code I did the following:

Make/O/N=50 data1=30+poissonNoise(5)
StatsResample/N=100 /ws=2/ITER=5 data1
Edit M_WaveStatsSamples.id

Hope that someone is able to guide me through this bootstrap example. Thanks.

Eduard Kas



You can get the row dimension labels to display on the left if you use the following Edit command instead:
Edit M_WaveStatsSamples.ld

That's a lowercase L.
Thank you for the reply. Now the table turns up as expected. Is there anyone who can guide me on my second question about ways to show the 100 values from every sample (run) in a column?

Eduard
Hello Eduard,

If you specify more than 1 iteration or if you use the /K flag, the wave W_Resampled is not saved. If you need the re-sampled data for some analysis other than what's provided by the operation, you should iteratively call StatsResample and move the contents of W_Resampled somewhere.

A.G.
WaveMetrics, Inc.
Thank you A.G. The problem was indeed that W_Resampled was not visible. Following your recommendation I have tried to create a Bootstrapping function (see attachment). However, I am still uncertain about how to define my output wave. Is it possible to define my output in such a way that the output wave can be updated for each iteration; for example by using the value of i, so that for 50 iterations (samples), the W_Resampled is being transferred to the waves wave1 up to and including wave50? I have the idea that strings might bring the solution, but don't see how. Any suggestions are welcome.

Eduard
Bootstrapping Function.jpg (35.82 KB)
Hello Eduard,

I think you would be better off using something similar to the following code:
// The following function creates 2 2D output waves.  One contains a column
// for every "resampling" and the other contains a column for the corresponding wavestats
// results.  Note that M_WaveStats has dimension labels that define the quantities stored
// in each row.  Use Edit M_WaveStats.ld to display in a table with dimension labels.

Function makeSamples(inWave,numWaves,numSamplesPerWave)
    Wave inWave
    Variable numWaves,numSamplesPerWave
   
    Variable i
    Make/O/N=(numSamplesPerWave,numWaves) M_Resampled
        // now create a wave with correct dimension labels for wavestats:
    WaveStats/W/Q inWave   
    Wave M_WaveStats
    Duplicate/O M_WaveStats,M_ResampledStats
    Redimension/N=(-1,numWaves) M_ResampledStats
   
    for(i=0;i<numWaves;i+=1)
        StatsResample /N=(numSamplesPerWave) inWave   // only performing the resampling.  
        Wave W_Resampled
        M_Resampled[][i]=W_Resampled[p]    // store the resampled data
        WaveStats/Q/M=2/W W_Resampled    // compute wavestats
        M_ResampledStats[][i]=M_WaveStats[p]  // store the stats.
    endfor
End


I hope this helps,

A.G.
WaveMetrics, Inc.