smooth(stats)
smooth()所属R语言包:stats
Tukey's (Running Median) Smoothing
Tukey的平滑(运行中位数)
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Tukey's smoothers, 3RS3R, 3RSS, 3R, etc.
Tukey的平滑,3RS3R,3RSS,3R等。
用法----------Usage----------
smooth(x, kind = c("3RS3R", "3RSS", "3RSR", "3R", "3", "S"),
twiceit = FALSE, endrule = "Tukey", do.ends = FALSE)
参数----------Arguments----------
参数:x
a vector or time series
一个向量或时间序列
参数:kind
a character string indicating the kind of smoother required; defaults to "3RS3R".
"3RS3R"表明顺畅所需的字符串;默认。
参数:twiceit
logical, indicating if the result should be "twiced". Twicing a smoother S(y) means S(y) + S(y - S(y)), i.e., adding smoothed residuals to the smoothed values. This decreases bias (increasing variance).
逻辑,表示如果结果应该是twiced“。 Twicing顺畅S(y)指S(y) + S(y - S(y)),即加入平滑残差平滑值。这将减少偏差(增加方差)。
参数:endrule
a character string indicating the rule for smoothing at the boundary. Either "Tukey" (default) or "copy".
一个字符串,表示在边界平滑的规则。要么"Tukey"(默认)或"copy"。
参数:do.ends
logical, indicating if the 3-splitting of ties should also happen at the boundaries (ends). This is only used for kind = "S".
逻辑,表示如果3分钱的关系也应该发生在边界(完)。这是只用了kind = "S"。
Details
详情----------Details----------
3 is Tukey's short notation for running medians of length 3, <br> 3R stands for Repeated 3 until convergence, and <br> S for Splitting of horizontal stretches of length 2 or 3.
3是Tukey的运行median的长度为3,参考3R的的短符号代表重复3直到收敛,并参考S分裂绵延水平长度为2或3。
Hence, 3RS3R is a concatenation of 3R, S and 3R, 3RSS similarly, whereas 3RSR means first 3R and then (S and 3) Repeated until convergence – which can be bad.
因此,3RS3R是3R的串联,S和3R,3RSS类似,而3RSR首先意味着3R“然后(S and 3)反复进行,直到收敛 - 这可不好。
值----------Value----------
An object of class "tukeysmooth" (which has print and summary methods) and is a vector or time series containing the smoothed values with additional attributes.
一个类的对象"tukeysmooth"(print和summary方法),是一个向量或含附加属性的平滑值的时间序列。
注意----------Note----------
S and S-PLUS use a different (somewhat better) Tukey smoother in smooth(*). Note that there are other smoothing methods which provide rather better results. These were designed for hand calculations and may be used mainly for didactical purposes.
S和S-PLUS的使用不同的(稍好)杜克顺畅smooth(*)。请注意,有其他平滑方法提供,而更好的结果。这些手工计算和设计,主要可用于教育方法的目的。
Since R version 1.2, smooth does really implement Tukey's end-point rule correctly (see argument endrule).
由于R版本1.2,smooth没有真正落实正确Tukey的终点规则(见参数endrule)。
kind = "3RSR" has been the default till R-1.1, but it can have very bad properties, see the examples.
,kind = "3RSR"一直到的R-1.1的默认,但它可以有很糟糕的属性,看到的例子。
Note that repeated application of smooth(*) does smooth more, for the "3RS*" kinds.
请注意,重复申请smooth(*)不顺利更"3RS*"种。
参考文献----------References----------
Exploratory Data Analysis, Reading Massachusetts: Addison-Wesley.
参见----------See Also----------
lowess; loess, supsmu and smooth.spline.
lowess;loess,supsmu和smooth.spline。
举例----------Examples----------
require(graphics)
## see also demo(smooth) ![#又见演示(顺利)!]
x1 <- c(4, 1, 3, 6, 6, 4, 1, 6, 2, 4, 2) # very artificial[很做作]
(x3R <- smooth(x1, "3R")) # 2 iterations of "3"[2迭代的“3”]
smooth(x3R, kind = "S")
sm.3RS <- function(x, ...)
smooth(smooth(x, "3R", ...), "S", ...)
y <- c(1,1, 19:1)
plot(y, main = "misbehaviour of \"3RSR\"", col.main = 3)
lines(sm.3RS(y))
lines(smooth(y))
lines(smooth(y, "3RSR"), col = 3, lwd = 2)# the horror[恐怖]
x <- c(8:10,10, 0,0, 9,9)
plot(x, main = "breakdown of 3R and S and hence 3RSS")
matlines(cbind(smooth(x,"3R"),smooth(x,"S"), smooth(x,"3RSS"),smooth(x)))
presidents[is.na(presidents)] <- 0 # silly[愚蠢]
summary(sm3 <- smooth(presidents, "3R"))
summary(sm2 <- smooth(presidents,"3RSS"))
summary(sm <- smooth(presidents))
all.equal(c(sm2),c(smooth(smooth(sm3, "S"), "S"))) # 3RSS === 3R S S[3RSS === 3R!]
all.equal(c(sm), c(smooth(smooth(sm3, "S"), "3R")))# 3RS3R === 3R S 3R[3RS3R === 3R小号3R]
plot(presidents, main = "smooth(presidents0, *) : 3R and default 3RS3R")
lines(sm3,col = 3, lwd = 1.5)
lines(sm, col = 2, lwd = 1.25)
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|