如何在R中实现小波变换?

问题描述

我是小波变换的新手,我想将这种技术应用于流时间序列的分解。我已经阅读了一些使用 Daubechies 母小波应用离散小波变换的论文。我的想法是使用 dwt 将我的流动时间序列分解为类似于下图的内容

enter image description here

我面临的第一个问题是我的数据在大多数情况下没有 2 的长度幂,因此,我得到了一个错误。为了避免这个错误,我所做的是将我的流时间序列减少到例如 64 条记录(2 的幂)。还有其他方法可以解决这个问题吗?

我的第二个问题是如何解释结果。我已经阅读了关于函数和系数(C 和 D 输出向量)的 R 文档,但我仍然有严重的问题来解释它。

这是我使用的代码

tis <- ts(listDF_Ann[[1]]$Qmean[1:64],frequency=1,start=listDF_Ann[[1]]$year[1],end=listDF_Ann[[1]]$year[64])
#wd function requires a time series
tis_wd <- wd(tis,filter.number=4,family="DaubLeAsymm",type="wavelet",bc="periodic",verbose=FALSE,min.scale=0,precond=TRUE)

这是我的输出

> str(tis_wd)
List of 8
 $ C       : num [1:127] 80.7 64.2 68.7 132.9 337.3 ...
 $ D       : num [1:63] -44.3 -47 -33.9 187.5 83.9 ...
 $ nlevels : int 6
 $ fl.dbase:List of 4
  ..$ first.last.c: num [1:7,1:3] 0 0 0 0 0 0 0 0 1 3 ...
  .. ..- attr(*,"dimnames")=List of 2
  .. .. ..$ : NULL
  .. .. ..$ : chr [1:3] "First" "Last" "Offset"
  ..$ ntotal      : num 127
  ..$ first.last.d: num [1:6,1:3] 0 0 0 0 0 0 0 1 3 7 ...
  .. ..- attr(*,"dimnames")=List of 2
  .. .. ..$ : NULL
  .. .. ..$ : chr [1:3] "First" "Last" "Offset"
  ..$ ntotal.d    : num 63
 $ filter  :List of 5
  ..$ H            : num [1:8] -0.0758 -0.0296 0.4976 0.8037 0.2979 ...
  ..$ G            : NULL
  ..$ name         : chr "Daub cmpct on least asymm N=4"
  ..$ family       : chr "DaubLeAsymm"
  ..$ filter.number: num 4
 $ type    : chr "wavelet"
 $ bc      : chr "periodic"
 $ date    : chr "Mon Mar 08 20:30:04 2021"
 - attr(*,"class")= chr "wd"

如何解释 C 和 D 向量?

> tis_wd$fl.dbase$first.last.c
     First Last Offset
[1,]     0    0    126
[2,]     0    1    124
[3,]     0    3    120
[4,]     0    7    112
[5,]     0   15     96
[6,]     0   31     64
[7,]     0   63      0
> tis_wd$fl.dbase$first.last.d
     First Last Offset
[1,]     0    0     62
[2,]     0    1     60
[3,]     0    3     56
[4,]     0    7     48
[5,]     0   15     32
[6,]     0   31      0

任何帮助我解释的想法都将受到欢迎!!

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)