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

R语言:tsboot()函数中文帮助文档(中英文对照)

[复制链接]
发表于 2012-2-16 18:55:24 | 显示全部楼层 |阅读模式
tsboot(boot)
tsboot()所属R语言包:boot

                                         Bootstrapping of Time Series
                                         引导的时间系列

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

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

Generate R bootstrap replicates of a statistic applied to a time series.  The replicate time series can be generated using fixed or random block lengths or can be model based replicates.
生成R引导应用于时间序列的统计重复。可以使用固定或随机块长度或可以模型复制生成复制的时间序列。


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


tsboot(tseries, statistic, R, l = NULL, sim = "model",
       endcorr = TRUE, n.sim = NROW(tseries), orig.t = TRUE,
       ran.gen, ran.args = NULL, norm = TRUE, ...,
       parallel = c("no", "multicore", "snow"),
       ncpus = getOption("boot.ncpus", 1L), cl = NULL)



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

参数:tseries
A univariate or multivariate time series.  
一元或多元时间序列。


参数:statistic
A function which when applied to tseries returns a vector containing the statistic(s) of interest.  Each time statistic is called it is passed a time series of length n.sim which is of the same class as the original tseries.  Any other arguments which statistic takes must remain constant for each bootstrap replicate and should be supplied through the ... argument to tsboot.  
一个功能,当适用于tseries返回一个向量,包含利益的统计(S)。每次statistic被称为它是通过时间序列的长度为n.sim这是同一类的原tseries。这statistic需要的任何其他参数必须保持不变,为每个引导复制,并应通过提供... tsboot的参数。


参数:R
A positive integer giving the number of bootstrap replicates required.   
一个正整数,给予引导的数量复制。


参数:sim
The type of simulation required to generate the replicate time series.  The possible input values are "model" (model based resampling), "fixed" (block resampling with fixed block lengths of l), "geom" (block resampling with block lengths having a geometric distribution with mean l) or "scramble" (phase scrambling).  
模拟式要求生成复制的时间序列。可能的输入值是"model"(基于模型的重采样),"fixed"(块与固定块长度的重采样l)"geom"(重采样的几何块长度阻止分布平均l)或"scramble"(相扰)。


参数:l
If sim is "fixed" then l is the fixed block length used in generating the replicate time series.  If sim is "geom" then l is the mean of the geometric distribution used to generate the block lengths. l should be a positive integer less than the length of tseries.  This argument is not required when sim is "model" but it is required for all other simulation types.  
如果sim是"fixed"然后l是固定块长度用来产生复制的时间序列。 sim如果是"geom"然后l是用于生成块长度的几何分布的均值。 l应该是一个正整数比tseries长度。这种说法并不需要的时候sim"model"但它需要为所有其他的仿真类型。


参数:endcorr
A logical variable indicating whether end corrections are to be applied when sim is "fixed".  When sim is "geom", endcorr is automatically set to TRUE; endcorr is not used when sim is "model" or "scramble".  
一个逻辑变量,指示是否最终更正是被应用时sim是"fixed"。当sim是"geom",endcorr被自动设置为TRUEendcorr不使用时sim是"model"或 "scramble"。


参数:n.sim
The length of the simulated time series.  Typically this will be equal to the length of the original time series but there are situations when it will be larger.  One obvious situation is if prediction is required. Another situation in which n.sim is larger than the original length is if tseries is a residual time series from fitting some model to the original time series. In this case, n.sim would usually be the length of the original time series.  
模拟的时间序列的长度。通常,这将是平等的原始时间序列的长度,但也有情况时,它会更大。一个明显的情况是,如果需要预测。在n.sim大于原长度的另一种情况是,如果tseries是从一些模型来拟合原始时间序列的剩余时间系列。在这种情况下,n.sim通常是原始时间序列的长度。


参数:orig.t
A logical variable which indicates whether statistic should be applied to tseries itself as well as the bootstrap replicate series.  If statistic is expecting a longer time series than tseries or if applying statistic to tseries will not yield any useful information then orig.t should be set to FALSE.  
逻辑变量表示是否statistic应tseries本身以及引导复制系列。如果statistic预期更长的时间比tseries或如果申请系列statistictseries不会产生任何有用的信息,然后orig.t应设置为FALSE。


参数:ran.gen
This is a function of three arguments.  The first argument is a time series.  If sim is "model" then it will always be tseries that is passed.  For other simulation types it is the result of selecting n.sim observations from tseries by some scheme and converting the result back into a time series of the same form as tseries (although of length n.sim).  The second argument to ran.gen is always the value n.sim, and the third argument is ran.args, which is used to supply any other objects needed by ran.gen.  If sim is "model" then the generation of the replicate time series will be done in ran.gen (for example through use of arima.sim). For the other simulation types ran.gen is used for "post-blackening".  The default is that the function simply returns the time series passed to it.  
这是三个参数的功能。第一个参数是一个时间序列。如果sim是"model"然后它会永远是tseries传递。对于其他类型的模拟,它是选择n.simtseries一些计划的意见和结果转换成一个相同的形式为tseries时间序列的结果(虽然长度n.sim)。的第二个参数ran.gen值n.sim,第三个参数是ran.args,提供ran.gen需要的任何其他对象,这是用来。 sim如果是"model"然后复制的时间序列的产生将完成(例如,通过使用ran.gen)arima.sim。对于其他的仿真类型ran.gen用于“后发黑”。默认的是该函数简单地返回传递给它的时间序列。


参数:ran.args
This will be supplied to ran.gen each time it is called.  If ran.gen needs any extra arguments then they should be supplied as components of ran.args. Multiple arguments may be passed by making ran.args a list.  If ran.args is NULL then it should not be used within ran.gen but note that ran.gen must still have its third argument.  
这将提供ran.gen每次它被称为。如果ran.gen需要任何额外的参数,那么就应该提供作为ran.args组件。可以传递多个参数使ran.args列表。 ran.args如果是NULL那么它不应该被用来在ran.gen但要注意,那ran.gen还必须有它的第三个参数。


参数:norm
A logical argument indicating whether normal margins should be used for phase scrambling.  If norm is FALSE then margins corresponding to the exact empirical margins are used.  
逻辑参数指示是否正常的利润率应使用相扰。如果normFALSE然后确切的实证利润率利润率相应的使用。


参数:...
Extra named arguments to statistic may be supplied here. Beware of partial matching to the arguments of tsboot listed above.  
额外的命名参数statistic可以在这里提供。谨防部分匹配tsboot上面列出的论据。


参数:parallel, ncpus, cl
See the help for boot.  
见帮助boot。


Details

详情----------Details----------

If sim is "fixed" then each replicate time series is found by taking blocks of length l, from the original time series and putting them end-to-end until a new series of length n.sim is created.  When sim is "geom" a similar approach is taken except that now the block lengths are generated from a geometric distribution with mean l.  Post-blackening can be carried out on these replicate time series by including the function ran.gen in the call to tsboot and having tseries as a time series of residuals.
如果sim是"fixed"然后每个复制的时间序列长度l块,从原来的时间序列和一系列新的长度,直到把他们月底至年底n.sim创建。当sim是"geom",现在块长度从几何分布与平均l采取类似的做法,除非。后发黑,可以进行这些复制的时间序列,包括功能ran.gen在调用tsboot和tseries作为一个时间序列的残差。

Model based resampling is very similar to the parametric bootstrap and all simulation must be in one of the user specified functions.  This avoids the complicated problem of choosing the block length but relies on an accurate model choice being made.
基于模型的重采样是非常类似的参数引导,必须在所有模拟用户指定的功能之一。这样就避免了复杂的问题,选择块的长度,但依靠一个准确的模型所作出的选择。

Phase scrambling is described in Section 8.2.4 of Davison and Hinkley (1997).  The types of statistic for which this method produces reasonable results is very limited and the other methods seem to do better in most situations.  Other types of resampling in the frequency domain can be accomplished using the function boot with the argument sim = "parametric".
戴维森和欣克利(1997)8.2.4条中所述相扰。统计的类型,这种方法产生合理的结果是非常有限的,和其他方法似乎在大多数情况下做的更好。其他类型的重采样在频域可以完成使用功能boot参数sim = "parametric"。


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

An object of class "boot" with the following components.
类"boot"以下组件的对象。


参数:t0
If orig.t is TRUE then t0 is the result of statistic(tseries,...{}) otherwise it is NULL.  
如果orig.t是TRUE然后t0是结果statistic(tseries,...{})否则它是NULL。


参数:t
The results of applying statistic to the replicate time series.   
申请statistic复制的时间序列的结果。


参数:R
The value of R as supplied to tsboot.  
的R值作为tsboot提供。


参数:tseries
The original time series.  
原来的时间序列。


参数:statistic
The function statistic as supplied.  
功能statistic作为提供。


参数:sim
The simulation type used in generating the replicates.  
产生重复使用的模拟类型。


参数:endcorr
The value of endcorr used.  The value is meaningful only when sim is "fixed"; it is ignored for model based simulation or phase scrambling and is always set to TRUE if sim is "geom".  
价值endcorr使用。该值是有意义的,只有当sim是"fixed",它会被忽略,基于模型的模拟或扰相总是被设置为TRUE如果sim是"geom" 。


参数:n.sim
The value of n.sim used.  
价值n.sim使用。


参数:l
The value of l used for block based resampling.  This will be NULL if block based resampling was not used.  
价值l用于基于块重采样。这将是NULL如果不使用基于块的重采样,。


参数:ran.gen
The ran.gen function used for generating the series or for "post-blackening".  
ran.gen功能产生系列或“后发黑”。


参数:ran.args
The extra arguments passed to ran.gen.  
额外的参数传递到ran.gen。


参数:call
The original call to tsboot.  
tsboot原来的呼叫。


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

Bootstrap Methods and Their Application. Cambridge University Press.
observations. Annals of Statistics, 17, 1217–1241.
Journal of the American Statistical Association, 89, 1303–1313.

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

boot, arima.sim
boot,arima.sim


举例----------Examples----------


lynx.fun <- function(tsb) {
     ar.fit <- ar(tsb, order.max = 25)
     c(ar.fit$order, mean(tsb), tsb)
}

# the stationary bootstrap with mean block length 20[平均20块长度的固定引导]
lynx.1 <- tsboot(log(lynx), lynx.fun, R = 99, l = 20, sim = "geom")

# the fixed block bootstrap with length 20[固定长度为20块引导]
lynx.2 <- tsboot(log(lynx), lynx.fun, R = 99, l = 20, sim = "fixed")

# Now for model based resampling we need the original model[基于模型的重采样,我们现在需要的原始模型]
# Note that for all of the bootstraps which use the residuals as their[请注意,所有的白手起家,因为他们使用的残差]
# data, we set orig.t to FALSE since the function applied to the residual[数据,我们设置orig.t虚假的,因为该功能适用于残留]
# time series will be meaningless.[时间序列将变得毫无意义。]
lynx.ar <- ar(log(lynx))
lynx.model <- list(order = c(lynx.ar$order, 0, 0), ar = lynx.ar$ar)
lynx.res <- lynx.ar$resid[!is.na(lynx.ar$resid)]
lynx.res <- lynx.res - mean(lynx.res)

lynx.sim <- function(res,n.sim, ran.args) {
     # random generation of replicate series using arima.sim [随机生成的复制系列使用arima.sim]
     rg1 <- function(n, res) sample(res, n, replace = TRUE)
     ts.orig <- ran.args$ts
     ts.mod <- ran.args$model
     mean(ts.orig)+ts(arima.sim(model = ts.mod, n = n.sim,
                      rand.gen = rg1, res = as.vector(res)))
}

lynx.3 <- tsboot(lynx.res, lynx.fun, R = 99, sim = "model", n.sim = 114,
                 orig.t = FALSE, ran.gen = lynx.sim,
                 ran.args = list(ts = log(lynx), model = lynx.model))

#  For "post-blackening" we need to define another function[对于“后发黑”我们需要定义其他功能]
lynx.black <- function(res, n.sim, ran.args) {
     ts.orig <- ran.args$ts
     ts.mod <- ran.args$model
     mean(ts.orig) + ts(arima.sim(model = ts.mod,n = n.sim,innov = res))
}

# Now we can run apply the two types of block resampling again but this[现在我们可以运行再次申请块重采样两种类型,但这]
# time applying post-blackening.[申请后发黑时间。]
lynx.1b <- tsboot(lynx.res, lynx.fun, R = 99, l = 20, sim = "fixed",
                  n.sim = 114, orig.t = FALSE, ran.gen = lynx.black,
                  ran.args = list(ts = log(lynx), model = lynx.model))

lynx.2b <- tsboot(lynx.res, lynx.fun, R = 99, l = 20, sim = "geom",
                  n.sim = 114, orig.t = FALSE, ran.gen = lynx.black,
                  ran.args = list(ts = log(lynx), model = lynx.model))

# To compare the observed order of the bootstrap replicates we[来比较,引导观察的顺序复制我们]
# proceed as follows.[进行如下操作。]
table(lynx.1$t[, 1])
table(lynx.1b$t[, 1])
table(lynx.2$t[, 1])
table(lynx.2b$t[, 1])
table(lynx.3$t[, 1])
# Notice that the post-blackened and model-based bootstraps preserve[请注意,后变黑和基于模型的白手起家保留]
# the true order of the model (11) in many more cases than the others.[该模型的真实秩序(11),比别人有更多的情况。]

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


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-5-4 23:36 , Processed in 0.022479 second(s), 16 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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