D2ss(sfsmisc)
D2ss()所属R语言包:sfsmisc
Numerical Derivatives of (x,y) Data (via Smoothing Splines)
数值(X,Y)数据的衍生工具(通过平滑样条)
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Compute the numerical first or 2nd derivatives of f() given observations (x[i], y ~= f(x[i])).
计算的数值第一或第二的衍生工具的f()给定的观察(x[i], y ~= f(x[i]))。
D1tr is the trivial discrete first derivative using simple difference ratios, whereas D1ss and D2ss use cubic smoothing splines (see smooth.spline) to estimate first or second derivatives, respectively.
D1tr是微不足道的离散一阶导数,用简单的差之比,而D1ss和D2ss使用三次平滑样条曲线(见smooth.spline),估计第一或第二的衍生物,分别为。
D2ss first uses smooth.spline for the first derivative f'() and then applies the same to the predicted values f'^(t[i]) (where t[i] are the values of xout) to find f''^(t[i]).
D2ss第一次使用smooth.spline的一阶导数f'()“,然后采用相同的预测值f'^(t[i])(t[i]值xout的)来发现f''^(t[i])。
用法----------Usage----------
D1tr(y, x = 1)
D1ss(x, y, xout = x, spar.offset = 0.1384, spl.spar=NULL)
D2ss(x, y, xout = x, spar.offset = 0.1384, spl.spar=NULL)
参数----------Arguments----------
参数:x,y
numeric vectors of same length, supposedly from a model y ~ f(x). For D1tr(), x can have length one and then gets the meaning of h = Δ x.
数字向量的长度相同,,据说从模型y ~ f(x)。对于D1tr(),x可以有一个长度,然后获取的意义h = Δ x。
参数:xout
abscissa values at which to evaluate the derivatives.
横坐标值,以评估衍生工具。
参数:spar.offset
numeric fudge added to the smoothing parameter(s), see spl.par below. Note that the current default is there for historical reasons only, and we often would recommend to use spar.offset = 0 instead.
数字软糖添加到平滑参数(s),请参阅spl.par下面。请注意,目前默认是由于历史的原因,我们通常会建议使用spar.offset = 0代替。
参数:spl.spar
direct smoothing parameter(s) for smooth.spline. If it is NULL (as per default), the smoothing parameter used will be spar.offset + sp$spar, where sp$spar is the GCV estimated smoothing parameter for both smooths, see smooth.spline.
直接平滑参数(S)smooth.spline。如果是NULL(根据默认的),所用的平滑参数spar.offset + sp$spar,其中sp$spar是GCV估计的平滑参数为平滑,看到smooth.spline。
Details
详细信息----------Details----------
It is well known that for derivative estimation, the optimal smoothing parameter is larger (more smoothing needed) than for the function itself. spar.offset is really just a fudge offset added to the smoothing parameters. Note that in R's implementation of smooth.spline, spar is really on the \logλ scale.
这是众所周知的,衍生的估计,最优平滑参数是较大的(更平滑需要)比函数本身。 spar.offset是真的只是一个忽悠抵消增加的平滑参数。需要注意的是R的实施smooth.spline,spar是真的\logλ规模。
值----------Value----------
D1tr() and D1ss() return a numeric vector of the length of y or xout, respectively.
D1tr()和D1ss()返回一个数值向量的长度y或xout,分别。
D2ss() returns a list with components
D2ss()返回一个列表的组件
参数:x
the abscissae values (= xout) at which the derivative(s) are evaluated.
横坐标值(=xout)在该衍生物(s)的评价。
参数:y
estimated values of f''(x_i).
估计值f''(x_i)。
参数:spl.spar
numeric vector of length 2, contain the spar arguments to the two smooth.spline calls.
数字矢量长度为2,包含spar两个smooth.spline调用的参数。
参数:spar.offset
as specified on input (maybe rep()eated to length 2).
指定的输入(也许代表()eated的长度为2)。
(作者)----------Author(s)----------
Martin Maechler, in 1992 (for S).
参见----------See Also----------
D1D2 which directly uses the 2nd derivative of the smoothing spline; smooth.spline.
D1D2直接使用平滑曲线的二阶导数,“smooth.spline。
实例----------Examples----------
## First Derivative --- spar.off = 0 ok "asymptotically" (?)[#一阶导数--- spar.off = 0 OK“渐进”(?)]
set.seed(330)
mult.fig(12)
for(i in 1:12) {
x <- runif(500, 0,10); y <- sin(x) + rnorm(500)/4
f1 <- D1ss(x=x,y=y, spar.off=0.0)
plot(x,f1, ylim = range(c(-1,1,f1)))
curve(cos(x), col=3, add= TRUE)
}
set.seed(8840)
x <- runif(100, 0,10)
y <- sin(x) + rnorm(100)/4
op <- par(mfrow = c(2,1))
plot(x,y)
lines(ss <- smooth.spline(x,y), col = 4)
str(ss[c("df", "spar")])
xx <- seq(0,10, len=201)
plot(xx, -sin(xx), type = 'l', ylim = c(-1.5,1.5))
title(expression("Estimating f''() : " * frac(d^2,dx^2) * sin(x) == -sin(x)))
offs <- c(0.05, 0.1, 0.1348, 0.2)
i <- 1
for(off in offs) {
d12 <- D2ss(x,y, spar.offset = off)
lines(d12, col = i <- i+1)
}
legend(2,1.6, c("true : -sin(x)",paste("sp.off. = ", format(offs))), lwd=1,
col = 1 1+length(offs)), cex = 0.8, bg = NA)
par(op)
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|