找回密码
 注册
查看: 491|回复: 0

R语言 wavethresh包 makewpstRO()函数中文帮助文档(中英文对照)

[复制链接]
发表于 2012-10-1 17:26:00 | 显示全部楼层 |阅读模式
makewpstRO(wavethresh)
makewpstRO()所属R语言包:wavethresh

                                        Make a wavelet packet regression object from a dependent and independent time series variable.
                                         小波包的依赖和独立的时间序列变量的回归对象。

                                         译者:生物统计家园网 机器人LoveR

描述----------Description----------

The idea here is to try and build facilities to enable a transfer function model along the lines of that described by Nason and Sapatinas 2002 in Statistics and Computing. The idea is to turn the timeseries variable into a set of nondecimated wavelet packets which are already pre-selected to have some semblance of relationship to the response time series. The function does not actually perform any regression, in contrast to the related makewpstDO but returns a data frame which the user can use to build their own models.
这里的想法是尝试建立设施,使沿线所描述由2002年利晨和Sapatinas的在统计和计算的传递函数模型。这个想法是把timeseries变量,已经预先选择有一些关系的response时间序列的外表nondecimated小波包成一组。实际上,该函数不执行任何回归,而相比之下,相关makewpstDO但返回一个数据框,用户可以用它来建立自己的模型。


用法----------Usage----------


makewpstRO(timeseries, response, filter.number = 10, family = "DaubExPhase", trans = logabs, percentage = 10)



参数----------Arguments----------

参数:timeseries
The dependent variable time series. This series is decomposed using the wpst function into nondecimated wavelet packets, need to be a power of two length.
因变量的时间序列。该系列产品使用wpst功能到nondecimated的小波包分解,需要两个长度的电源。


参数:response
The independent or response time series.
独立或响应时间序列。


参数:filter.number
The type of wavelet used within family, see filter.select.
形式的小波内使用family,请参阅filter.select。


参数:family
The family of wavelet, see filter.select
小波的家庭,看到filter.select


参数:trans
A transform to apply to the nondecimated wavelet packet coefficients before any selection
一个转换申请的nondecimated的小波包系数之前的任何选择


参数:percentage
The top percentage of nondecimated wavelet packets that correlated best with the response series will be preselected.
顶部percentage nondecimated小波包的相关性最好的response系列预选。


Details

详细信息----------Details----------

The idea behind this methodology is that a response time series might not be directly related to the dependent timeseries time series, but it might be related to the nondecimated wavelet packets of the timeseries, these packets can pick out various features of the timeseries including certain delays, oscillations and others.
这种方法背后的理念是,一个response时间序列可能不直接相关的依赖timeseries时间序列,但它可能是相关的小波包timeseries,这些nondecimated数据包可以挑选出timeseries包括一定的延迟,振荡和其他的各种功能。

The best packets (the number if controlled by percentage), those that correlate best with response are selected and returned. The response and the best nondecimated wavelet packets are returned in a data frame object and then any convenient form of statistical modeling can be used to build a model of the response in terms of the packet variables.
最好的数据包(控制数percentage),相关的最好的response的选择,并返回。 response和最好的nondecimated的小波包都返回一个数据框的对象,然后建立一个模型的response中的包变量的统计模型,可以使用任何方便的形式。

Once a model has been built it can be interpreted in the usual way, but with respect to nondecimated wavelet packets.
一旦模型已经建成,它可以在通常的方式解释,但就nondecimated小波包。

Note that nondecimated wavelet packets are essential, as they are all of the same length as the original response series. If a decimated wavelet packet algorithm had been used then it is not clear what to do with the "gaps"!
请注意,nondecimated小波包是必不可少的,因为它们都具有相同的长度的原始响应系列。如果抽取的小波包算法已被使用,那么它是不明确做什么用的“差距”!

If new timeseries data comes along the wpstREGR function can be used to extract the identical packets as the ones produced by this function (as the result of this function stores the identities of these packets). Then the statistical modelling that build the model from the output of this function, can be used to predict future values of the response time series from future values of the timeseries series.
如果新的timeseries数据来自沿wpstREGR函数可以用于提取相同的数据包作为此函数所产生的(作为该函数的结果存储这些数据包的身份)。然后从这个函数的输出,建立模型,统计模型可以用来预测未来的值的response时间序列从timeseries系列的未来价值。


值----------Value----------

An object of class wpstRO containing the following items <table summary="R valueblock"> <tr valign="top"><td>df</td> <td> A data frame containing the response time series and a number of columns/variables/packets that correlated with response series. These are all entitled "Xn" where n is some integer</td></tr>  <tr valign="top"><td>ixvec</td> <td> A packet index vector. After taking the nondecimated wavelet packet transform, all the packets are stored in a matrix. This vector indicates those that were preselected</td></tr> <tr valign="top"><td>level</td> <td> The original level from which the preselected vectors came from</td></tr> <tr valign="top"><td>pktix</td> <td> Another index vector, this time referring to the original wavelet packet object, not the matrix in which they subsequently got stored</td></tr> <tr valign="top"><td>nlevels</td> <td> The number of resolution levels in the original wavelet packet object</td></tr> <tr valign="top"><td>cv</td> <td> The correlation vector. These are the values of the correlations of the packets with the response, then sorted in terms of decreasing absolute correlation</td></tr> <tr valign="top"><td>filter</td> <td> The wavelet filter details</td></tr> <tr valign="top"><td>trans</td> <td> The transformation function actually used</td></tr> </table>
类的一个对象wpstRO包含以下项目表summary="R valueblock"> <tr valign="top"> <TD>df </ TD> <td>一个数据框包含response的时间序列和数目的列/变量/响应序列与相关的数据包。这些都是题为“XN”,其中n为某个整数</ TD> </ TR> <tr valign="top"> <TD>ixvec </ TD> <td>一个包索引向量。服用后所nondecimated的小波包变换,所有的数据包存储在一个矩阵。这个向量表示,预选</ TD> </ TR> <tr valign="top"> <TD> level </ TD> <td>在原来的水平预选向量来自</ TD> </ TR> <tr valign="top"> <TD> pktix</ TD> <TD>的另一个指标向量,这个时间指的是原来的小波包的对象,而不是矩阵,其中,他们随后得到存储</ TD> </ TR> <tr valign="top"> <TD>nlevels</ TD> <TD>分辨率级别的数量在原来的小波包对象</ TD> </ TR> <tr valign="top"> <TD> cv</ TD> <TD>相关矢量。这些值的报文的响应的相关性,然后排序递减的绝对相关性</ TD> </ TR> <tr valign="top"> <TD> filter</ TD> <TD>小波滤波器的细节</ TD> </ TR> <tr valign="top"> <TD> trans</ TD> <TD>变换函数实际使用</ TD> </ TR > </ TABLE>


(作者)----------Author(s)----------



G P Nason




参考文献----------References----------

Nason, G.P. and Sapatinas, T. (2002) Wavelet packet transfer function modeling of nonstationary time series. Statistics and Computing, 12, 45-56.

参见----------See Also----------


实例----------Examples----------


data(BabyECG)
baseseries <- BabyECG[1:256]
#[]
# Make up a FICTITIOUS response series![一个虚构的响应序列!]
#[]
response <- BabyECG[6:261]*3+52
#[]
# Do the modeling[做造型]
#[]
BabeModel <- makewpstRO(timeseries=baseseries, response=response)
#Level: 0  ..........[等级:0 ..........]
#1  ..........[1 ..........]
#2  ..........[2 ..........]
#3  ..........[3 ..........]
#4  ................[4 ................]
#5  [5]
#6  [6]
#7  [7]
#[]
#Contains SWP coefficients[包含SWP系数]
#Original time series length:  256 [原始时间序列长度:256]
#Number of bases:  25 [碱基:25]
#Some basis selection performed[进行一些基础选择]
#       Level Pkt Index Orig Index      Score[等级为Pkt1指数原价指数得分]
#[1,]     5         0        497  0.6729833[[1] 5 0 497 0.6729833]
#[2,]     4         0        481  0.6120771[[2] 4 0 481 0.6120771]
#[3,]     6         0        505  0.4550616[[3] 6 0 505 0.4550616]
#[4,]     3         0        449  0.4309924[[4] 3 0 449 0.4309924]
#[5,]     7         0        509  0.3779385[[5] 7 0 509 0.3779385]
#[6,]     1        53        310  0.3275428[[6] 1 53 310 0.3275428]
#[7,]     2        32        417 -0.3274858[[7] 2 32 417 -0.3274858]
#[8,]     2        59        444 -0.2912863[[8] 2 59 444 -0.2912863]
#[9,]     3        16        465 -0.2649679[[9] 3月16日465 -0.2649679]
#[10,]     1       110        367  0.2605178[[10] 1 110 367 0.2605178]
#etc. etc.[等等。]
#[]
#[]
# Let's look at the data frame component[让我们来看看数据框的组成部分]
#[]
names(BabeModel$df)
# [1] "response" "X1"       "X2"       "X3"       "X4"       "X5"      [[1]“响应”“X1”,“X 2”,“X3”“X4”,“X5”]
# [7] "X6"       "X7"       "X8"       "X9"       "X10"      "X11"     [[7]“5233”“X7”,“X8”“X9”“X10”X11“]
#[13] "X12"      "X13"      "X14"      "X15"      "X16"      "X17"     [[13]“X12”X13“X14”X15“X16”X17“]
#[19] "X18"      "X19"      "X20"      "X21"      "X22"      "X23"     [[19]“X18”X19“X20”X21“X22”X23“]
#[25] "X24"      "X25"    [[25]“X24”X25“]
#[]
# Generate a formula including all of the X's (note we could use the .[生成包括所有X的(注意,我们可以使用一个公式。]
# argument, but we later want to be more flexible[的说法,但我们以后要更加灵活]
#[]
xnam <- paste("X", 1:25, sep="")
fmla1 <- as.formula(paste("response ~ ", paste(xnam, collapse= "+")))
#[]
# Now let's fit a linear model, the response on all the Xs[现在,让我们来符合线性模型,对所有的X的响应]
#[]
Babe.lm1 <- lm(fmla1, data=BabeModel$df)
#[]
# Do an ANOVA to see what's what[做一个ANOVA看到什么是什么]
#[]
anova(Babe.lm1)
#Analysis of Variance Table[方差分析表]
#[]
#Response: response[响应:响应]
#        Df Sum Sq Mean Sq  F value    Pr(&gt;F)    [DF森平方均方F值PR(> F)]
#X1          1 214356  214356 265.7656 &lt; 2.2e-16 ***[X1 1 214356 214356 265.7656 <2.2E-16 ***]
#X2          1  21188   21188  26.2701 6.289e-07 ***[X2 1 21188 21188 26.2701 6.289e-07 ***]
#X3          1  30534   30534  37.8565 3.347e-09 ***[X3 1 30534 30534 37.8565 3.347e-09 ***]
#X4          1    312     312   0.3871 0.5344439    [X4 1 312 312 0.3871 0.5344439]
#X5          1   9275    9275  11.4999 0.0008191 ***[X5 9275 9275 11.4999 0.0008191 ***]
#X6          1     35      35   0.0439 0.8343135    [5233 35 35 0.0439 0.8343135]
#X7          1    195     195   0.2417 0.6234435    [X7 1 195 195 0.2417 0.6234435]
#X8          1     94      94   0.1171 0.7324600    [X8 1 94 94 0.1171 0.7324600]
#X9          1    331     331   0.4103 0.5224746    [X9 1 331 331 0.4103 0.5224746]
#X10         1      0       0   0.0006 0.9810560    [X10 1 0 0 0.0006 0.9810560]
#X11         1    722     722   0.8952 0.3450597    [X11 1 722 722 0.8952 0.3450597]
#X12         1      0       0   0.0004 0.9850243    [X12 1 0 0 0.0004 0.9850243]
#X13         1     77      77   0.0959 0.7570769    [X13 1 77 77 0.0959 0.7570769]
#X14         1   2770    2770   3.4342 0.0651404 .  [X14 1 2770 2770 3.4342 0.0651404。]
#X15         1      6       6   0.0072 0.9326155   [X15 1 6 6 0.0072 0.9326155]
#X16         1    389     389   0.4821 0.4881649    [X16 1 389 389 0.4821 0.4881649]
#X17         1     44      44   0.0544 0.8157015    [X17 1 44 44 0.0544 0.8157015]
#X18         1     44      44   0.0547 0.8152640    [X18 1 44 44 0.0547 0.8152640]
#X19         1   4639    4639   5.7518 0.0172702 *  [X19 1 4639 4639 5.7518 0.0172702 *]
#X20         1    490     490   0.6077 0.4364469    [X20 1 490 490 0.6077 0.4364469]
#X21         1    389     389   0.4823 0.4880660    [X21 1 389 389 0.4823 0.4880660]
#X22         1     85      85   0.1048 0.7463860    [X22 1 85 85 0.1048 0.7463860]
#X23         1   1710    1710   2.1198 0.1467664    [X23 1 1710 1710 2.1198 0.1467664]
#X24         1     12      12   0.0148 0.9033427    [X24 1 12 12 0.0148 0.9033427]
#X25         1     82      82   0.1019 0.7498804    [X25 1 82 82 0.1019 0.7498804]
#Residuals 230 185509     807                       [残差230 185509 807]
#---[---]
#Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 [显。代码:0***0.001**0.01*0.05。 0.1]
#[]
# Looks like X1, X2, X3, X5, X14 and X19 are "significant". Also throw in[看起来像X1,X2,X3,X5,X14和X19是“显著”。同时投入]
# X4 as it was a highly ranked preselected variable, and refit[X4,因为它是一个高排名的预选变量,并重新安装]
#[]
fmla2 <- response ~ X1 + X2 + X3 + X4 + X5 + X14 + X19
Babe.lm2 <- lm(fmla2, data=BabeModel$df)
#[]
# Let's see the ANOVA table for this[让我们来看看方差分析表]
#[]
anova(Babe.lm2)
#Analysis of Variance Table[方差分析表]
#[]
#Response: response[响应:响应]
#        Df Sum Sq Mean Sq  F value    Pr(&gt;F)    [DF森平方均方F值PR(> F)]
#X1          1 214356  214356 279.8073 &lt; 2.2e-16 ***[X1 1 214356 214356 279.8073 <2.2E-16 ***]
#X2          1  21188   21188  27.6581 3.128e-07 ***[X2 1 21188 21188 27.6581 3.128e-07 ***]
#X3          1  30534   30534  39.8567 1.252e-09 ***[X3 1 30534 30534 39.8567 1.252e-09 ***]
#X4          1    312     312   0.4076 0.5238034    [X4 1 312 312 0.4076 0.5238034]
#X5          1   9275    9275  12.1075 0.0005931 ***[X5 9275 9275 12.1075 0.0005931 ***]
#X14         1   3095    3095   4.0405 0.0455030 *  [X14 1 3095 3095 4.0405 0.0455030 *]
#X19         1   4540    4540   5.9259 0.0156263 *  [X19 1 4540 4540 5.9259 0.0156263 *]
#Residuals 248 189989     766                       [残差248 189989 766]
#---[---]
#Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 [显。代码:0***0.001**0.01*0.05。 0.1]
#[]
# So, let's drop X4, refit, and then do ANOVA[所以,让我们下降X4,改装,然后做ANOVA]
#[]
Babe.lm3 <- update(Babe.lm2, . ~ . -X4)
anova(Babe.lm3)
#[]
# After viewing this, drop X14[查看此之后,下降X14]
#[]
Babe.lm4 <- update(Babe.lm3, . ~ . -X14)
anova(Babe.lm4)
#[]
# Let's plot the original series, and the "fitted" one[让我们来绘制原始的系列,而“装”]
#[]
## Not run: ts.plot(BabeModel$df[["response"]])[#不运行:ts.plot(BabeModel DF [“响应”]])]
## Not run: lines(fitted(Babe.lm4), col=2)[#不运行线(装“(Babe.lm4),列= 2)]
#[]
# Let's plot the wavelet packet basis functions associated with the model[让我们绘制与模型相关联的小波包基函数]
#[]
## Not run: oldpar &lt;- par(mfrow=c(2,2))[#不运行:oldpar  -  PAR(mfrow = C(2,2))]
## Not run: z &lt;- rep(0, 256)[#不运行:Z  - 代表(0,256)]
## Not run: zwp &lt;- wp(z, filter.number=BabeModel$filter$filter.number, family=BabeModel$filter$family)[#不运行:ZWP  -  WP(Z,filter.number = BabeModel过滤器$ filter.number,家庭BabeModel $过滤器系列)]
## Not run: draw(zwp, level=BabeModel$level[1], index=BabeModel$pktix[1], main="", sub="")[#不运行:画(ZWP,水平= BabeModel水平[1],指数= BabeModel $ pktix [1],主要=“”,子=“”)]
## Not run: draw(zwp, level=BabeModel$level[2], index=BabeModel$pktix[2], main="", sub="")[#不运行:画(ZWP,等级= BabeModel水平[2]指数= BabeModel pktix [2],主要=“”,子=“”)]
## Not run: draw(zwp, level=BabeModel$level[3], index=BabeModel$pktix[3], main="", sub="")[#不运行:画(ZWP,等级= BabeModel水平[3]指数= BabeModel pktix [3],主要=“”,子=“”)]
## Not run: draw(zwp, level=BabeModel$level[5], index=BabeModel$pktix[5], main="", sub="") [#不运行:画(ZWP,等级= BabeModel水平[5]指数= BabeModel $ pktix [1],主要=“”,子=“”)]
## Not run: par(oldpar)[#不执行:PAR(oldpar的)]
#[]
# Now let's do some prediction of future values of the response, given[现在,让我们做一些预测未来价值的响应,]
# future values of the baseseries[未来的baseseries值]
#[]
newseries <- BabyECG[257:512]
#[]
# Get the new data frame[获取新的数据框]
#[]
newdfinfo <- wpstREGR(newTS = newseries, wpstRO=BabeModel)
#[]
# Now use the best model (Babe.lm4) with the new data frame (newdfinfo)[现在使用的最佳模式(Babe.lm4)的新的数据框(newdfinfo)]
# to predict new values of response[预测新的响应值]
#[]
newresponse <- predict(object=Babe.lm4, newdata=newdfinfo)
#[]
# What is the "true" response, well we made up a response earlier, so let's[什么是“真”的回应,我们响应,让我们]
# construct the true response for this future data (in your case you'll[构建真实反应为今后的数据(你的情况,你会]
# have a separate genuine response variable)[有一个单独的真正响应变量)]
#[]
trucfictresponse <- BabyECG[262:517]*3+52
#[]
# Let's see them plotted on the same plot[让我们来看看它们绘制在同一块]
#[]
## Not run: ts.plot(trucfictresponse)[#不运行:ts.plot(trucfictresponse)]
## Not run: lines(newresponse, col=2)[#不运行:行(newresponse,列= 2)]
#[]
# On my plot they look tolerably close![在我的图,他们看起来过得去!]
#[]

转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。


注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|小黑屋|生物统计家园 网站价格

GMT+8, 2024-11-25 15:19 , Processed in 0.024927 second(s), 16 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表