Creating tables to show bootstrapping results
Eduard Kas
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
That's a lowercase L.
December 8, 2011 at 06:35 am - Permalink
Eduard
December 9, 2011 at 02:45 pm - Permalink
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.
December 9, 2011 at 03:49 pm - Permalink
Eduard
December 12, 2011 at 12:37 pm - Permalink
I think you would be better off using something similar to the following code:
// 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.
December 12, 2011 at 02:08 pm - Permalink
Eduard
December 13, 2011 at 06:12 am - Permalink