[R] Help with wavCWTPeaks

mauede at alice.it mauede at alice.it
Fri Dec 5 18:15:22 CET 2008


I cannot understand the following error printed out when I try to get the extrema of my time series.
I would appreciate some suggestion as I really cannot interpret the error. I might not be using a proper
set of parameters in calling such functions. I am learning by doing ...

> aa.peak <- wavCWTPeaks (aa.tree)  
Error in `row.names<-.data.frame`(`*tmp*`, value = c("1", "0")) :
  invalid 'row.names' length

My data vector is as follows:
> aa
  [1] -0.852625404 -0.886941142 -0.920699269 -0.953858240 -0.986377090
  [6] -1.018215725 -1.049335086 -1.079697274 -1.109265628 -1.138004782
 [11] -1.165880733 -1.192860894 -1.218914146 -1.244010899 -1.268123116
 [16] -1.291224432 -1.313290096 -1.334297111 -1.354224193 -1.373051833
 [21] -1.390762317 -1.407339716 -1.422769965 -1.437040775 -1.450141701
 [26] -1.462064157 -1.472801336 -1.482348272 -1.490701780 -1.497860461
 [31] -1.503824640 -1.508596384 -1.512179425 -1.514579128 -1.515802478
 [36] -1.515858035 -1.514755845 -1.512507449 -1.509125815 -1.504625250
 [41] -1.499021421 -1.492331231 -1.484572809 -1.475765432 -1.465929450
 [46] -1.455086269 -1.443258266 -1.430468724 -1.416741774 -1.402102340
 [51] -1.386576077 -1.370189287 -1.352968891 -1.334942359 -1.316137624
 [56] -1.296583049 -1.276307350 -1.255339556 -1.233708931 -1.211444912
 [61] -1.188577082 -1.165135088 -1.141148591 -1.116647219 -1.091660532
 [66] -1.066217945 -1.040348675 -1.014081694 -0.987445689 -0.960469010
 [71] -0.933179631 -0.905605109 -0.877772541 -0.849708278 -0.821438088
 [76] -0.792987122 -0.764379898 -0.735640266 -0.706791393 -0.677855738
 [81] -0.648855033 -0.619810274 -0.590741693 -0.561668758 -0.532610156
 [86] -0.503583784 -0.474606745 -0.445695338 -0.416865062 -0.388130609
 [91] -0.359505865 -0.331003918 -0.302637056 -0.274416782 -0.246353810
 [96] -0.218458088 -0.190738802 -0.163204394 -0.135862573 -0.108720337
[101] -0.081783987 -0.055059152 -0.028550808 -0.002263304  0.023799613
[106]  0.049634774  0.075239551  0.100611836  0.125750005  0.150652886
[111]  0.175319722  0.199750141  0.223944116  0.247901927  0.271624125
[116]  0.295111492  0.318365000  0.341385774  0.364175049  0.386734130
[121]  0.409064353  0.431167045  0.453043480  0.474694850  0.496122212
[126]  0.517326465  0.538308303  0.559068185  0.579606300  0.599922532
[131]  0.620016432  0.639887183  0.659533578  0.678953988  0.698146340
[136]  0.716367156  0.734459833  0.752428741  0.770277372  0.788008310
[141]  0.805623188  0.823122667  0.840506396  0.857773019  0.874920094
[146]  0.891944162  0.908840641  0.925603903  0.942227205  0.958702728
[151]  0.975021541  0.991173645  1.007147946  1.022932278  1.038513449
[156]  1.053877190  1.069008243  1.083890313  1.098506181  1.112837647
[161]  1.126865608  1.140570088  1.153930270  1.166924526  1.179530477
[166]  1.191725035  1.203484451  1.214784382  1.225599912  1.235905642
[171]  1.245675755  1.254884072  1.263504095  1.271509107  1.278872248
[176]  1.285566555  1.291565077  1.296840902  1.301367293  1.305117743
[181]  1.308066011  1.310186290  1.311453212  1.311841963  1.311328350
[186]  1.309888930  1.307500999  1.304142758  1.299793348  1.294432925
[191]  1.288042752  1.280605267  1.272104143  1.262524364  1.251852272
[196]  1.240075658  1.227183764  1.213167403  1.198018950  1.181732402
[201]  1.164303440  1.145729407  1.126009401  1.105144212  1.083136426
[206]  1.059990384  1.035712188  1.010309729  0.983792617  0.956172242
[211]  0.927461713  0.897675875  0.866831225  0.834945955  0.802039881
[216]  0.768134393  0.733252445  0.697418506  0.660658502  0.622999781
[221]  0.584471057  0.545102363  0.504924994  0.463971453  0.422275398
[226]  0.379871580  0.336795792  0.293084805  0.248776314  0.203908880
[231]  0.158521870  0.112655403  0.066350293  0.019647991 -0.027409468
[236] -0.074779520 -0.122419124 -0.170284817 -0.218332766 -0.266518818
[241] -0.314798550

I convert it into a time series and then I get the CWT coefficients. Then I build the tree
that exhibits only 3 branches (see attached plot)

 aats <- ts (aa, deltat =1/30, start = 0.0)  
 aa.cwt <-  wavCWT(aats)                          
 aa.tree <- wavCWTTree (aa.cwt)  

I can get the data for each of the 3 branches:
> aa.tree[[1]]
$itime
 [1] 135 135 134 133 132 130 128 126 123 122 122 122 122 123 126

$iscale
 [1]  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15

$time
 [1] 4.466667 4.466667 4.433333 4.400000 4.366667 4.300000 4.233333 4.166667
 [9] 4.066667 4.033333 4.033333 4.033333 4.033333 4.066667 4.166667

$scale
 [1] 0.03333333 0.06666667 0.10000000 0.13333333 0.16666667 0.20000000
 [7] 0.23333333 0.26666667 0.30000000 0.33333333 0.36666667 0.40000000
[13] 0.43333333 0.46666667 0.50000000

$extrema
 [1] 0.001143350 0.004153357 0.009778222 0.018315375 0.030294895 0.046225772
 [7] 0.066645451 0.092064228 0.122788334 0.158757578 0.199797960 0.245925327
[13] 0.297235272 0.354056031 0.417519487

> aa.tree[[2]]
$itime
 [1] 202 202 202 202 202 202 202 202 202 202 205

$iscale
 [1]  1  2  3  4  5  6  7  8  9 10 11

$time
 [1] 6.7 6.7 6.7 6.7 6.7 6.7 6.7 6.7 6.7 6.7 6.8

$scale
 [1] 0.03333333 0.06666667 0.10000000 0.13333333 0.16666667 0.20000000
 [7] 0.23333333 0.26666667 0.30000000 0.33333333 0.36666667

$extrema
 [1] 0.002490402 0.014052846 0.038579099 0.078779561 0.136699962 0.213884238
 [7] 0.311455206 0.430189008 0.570761962 0.734351009 0.924577986

> aa.tree[[3]]
$itime
 [1] 240 239 238 237 236 235 233 232 230 228 225 222 219 216 212 210 208 206
[19] 205 204 202 201 199 198 197 195 194 191 189 187 185 182 180 178 176 175
[37] 173 172 171 170 169 169 169 169 168 168 168 168 168 168 168 168 168 168
[55] 168 168 168 168 168 168 168 168 168 168 168

$iscale
 [1]  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
[25] 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
[49] 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65

$time
 [1] 7.966667 7.933333 7.900000 7.866667 7.833333 7.800000 7.733333 7.700000
 [9] 7.633333 7.566667 7.466667 7.366667 7.266667 7.166667 7.033333 6.966667
[17] 6.900000 6.833333 6.800000 6.766667 6.700000 6.666667 6.600000 6.566667
[25] 6.533333 6.466667 6.433333 6.333333 6.266667 6.200000 6.133333 6.033333
[33] 5.966667 5.900000 5.833333 5.800000 5.733333 5.700000 5.666667 5.633333
[41] 5.600000 5.600000 5.600000 5.600000 5.566667 5.566667 5.566667 5.566667
[49] 5.566667 5.566667 5.566667 5.566667 5.566667 5.566667 5.566667 5.566667
[57] 5.566667 5.566667 5.566667 5.566667 5.566667 5.566667 5.566667 5.566667
[65] 5.566667

$scale
 [1] 0.03333333 0.06666667 0.10000000 0.13333333 0.16666667 0.20000000
 [7] 0.23333333 0.26666667 0.30000000 0.33333333 0.36666667 0.40000000
[13] 0.43333333 0.46666667 0.50000000 0.53333333 0.56666667 0.60000000
[19] 0.63333333 0.66666667 0.70000000 0.73333333 0.80000000 0.83333333
[25] 0.86666667 0.93333333 0.96666667 1.00000000 1.10000000 1.16666667
[31] 1.23333333 1.30000000 1.36666667 1.43333333 1.53333333 1.60000000
[37] 1.70000000 1.80000000 1.90000000 2.00000000 2.13333333 2.23333333
[43] 2.36666667 2.50000000 2.66666667 2.80000000 2.96666667 3.13333333
[49] 3.30000000 3.50000000 3.70000000 3.90000000 4.10000000 4.36666667
[55] 4.60000000 4.86666667 5.16666667 5.46666667 5.76666667 6.10000000
[61] 6.43333333 6.80000000 7.20000000 7.60000000 8.03333333

$extrema
 [1] 2.112717e-01 3.394113e-01 4.169413e-01 4.778086e-01 5.320947e-01
 [6] 5.855642e-01 6.505954e-01 7.254532e-01 8.219651e-01 9.412408e-01
[11] 1.091710e+00 1.275782e+00 1.497830e+00 1.756278e+00 2.045967e+00
[16] 2.359591e+00 2.690719e+00 3.035522e+00 3.392502e+00 3.757973e+00
[21] 4.130551e+00 4.509703e+00 5.280292e+00 5.670084e+00 6.062074e+00
[26] 6.851106e+00 7.247628e+00 8.045326e+00 8.846766e+00 9.649727e+00
[31] 1.045085e+01 1.124541e+01 1.202478e+01 1.277755e+01 1.383239e+01
[36] 1.446487e+01 1.528176e+01 1.590892e+01 1.632802e+01 1.653015e+01
[41] 1.646514e+01 1.618348e+01 1.553216e+01 1.461983e+01 1.320993e+01
[46] 1.194458e+01 1.028845e+01 8.643199e+00 7.088004e+00 5.416952e+00
[51] 4.006859e+00 2.871097e+00 1.871285e+00 1.170313e+00 7.029019e-01
[56] 3.738840e-01 1.729185e-01 7.505307e-02 3.059919e-02 1.050205e-02
[61] 3.342503e-03 8.703506e-04 1.810757e-04 3.389703e-05 4.903014e-06


Best regards,
-- 
Maura

Alice Messenger ;-) chatti anche con gli amici di Windows Live Messenger e tutti i telefonini TIM!
Vai su http://maileservizi.alice.it/alice_messenger/index.html?pmk=footer


More information about the R-help mailing list