D1D2(sfsmisc)
D1D2()所属R语言包:sfsmisc
Numerical Derivatives of (x,y) Data via Smoothing Splines
(X,Y)的数值衍生工具的数据通过平滑样条曲线
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Compute numerical derivatives of f() given observations (x,y), using cubic smoothing splines with GCV, see smooth.spline. In other words, estimate f'() and/or f''() for the model
计算数值衍生物f()给定的观察(x,y),采用三次样条GCV,请参阅smooth.spline。换句话说,估计f'()和/或f''()的模型
用法----------Usage----------
D1D2(x, y, xout = x, spar.offset = 0.1384, deriv = 1:2, spl.spar = NULL)
参数----------Arguments----------
参数:x,y
numeric vectors of same length, supposedly from a model y ~ f(x).
数字向量的长度相同,,据说从模型y ~ f(x)。
参数:xout
abscissa values at which to evaluate the derivatives.
横坐标值,以评估衍生工具。
参数:spar.offset
numeric fudge added to the smoothing parameter, see spl.par below.
数字软糖添加平滑参数,请参阅spl.par下面。
参数:deriv
integer in 1:2 indicating which derivatives are to be computed.
整数1:2场外衍生产品的计算。
参数:spl.spar
direct smoothing parameter 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, see smooth.spline.
直接平滑参数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) than for the function itself. spar.offset is really just a fudge offset added to the smoothing parameter. Note that in R's implementation of smooth.spline, spar is really on the \logλ scale.
这是众所周知的,衍生的估计,最优平滑参数较大(较平滑)比为函数本身。 spar.offset是真的只是一个忽悠抵消增加的平滑参数。需要注意的是R的实施smooth.spline,spar是真的\logλ规模。
When deriv = 1:2 (as per default), both derivatives are estimated with the same smoothing parameter which is suboptimal for the single functions individually. Another possibility is to call D1D2(*, deriv = k) twice with k = 1 and k = 2 and use a larger smoothing parameter for the second derivative.
当deriv = 1:2(根据默认的),无论是衍生工具,估计是最理想的个别单功能相同的平滑参数。另一种可能性是调用“D1D2(*, deriv = k)两次k = 1和k = 2,并使用一个较大的平滑参数的二阶导数。
值----------Value----------
a list with several components,
有几个组件的列表,
参数:x
the abscissae values at which the derivative(s) are evaluated.
横坐标值,在该值的衍生物(s)是评价。
参数:D1
if deriv contains 1, estimated values of f'(x_i) where x_i are the values from xout.
如果deriv包含1,估计值的f'(x_i)其中x_i值xout。
参数:D2
if deriv contains 2, estimated values of f''(x_i).
如果deriv包含2个,估计值f''(x_i)。
参数:spar
the smoothing parameter used in the (final) smooth.spline call.
(最终)smooth.spline呼叫中所用的平滑参数。
参数:df
the equivalent degrees of freedom in that smooth.spline call.
相当程度的自由,那smooth.spline调用。
(作者)----------Author(s)----------
Martin Maechler, in 1992 (for S).
参见----------See Also----------
D2ss which calls smooth.spline twice, first on y, then on the f'(x_i) values; smooth.spline on which it relies completely.
D2ss调用smooth.spline两次,第一次y,然后在f'(x_i)值的,“smooth.spline,这完全依赖。
实例----------Examples----------
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")])
if(is.R()) plot(cos, 0, 10, ylim = c(-1.5,1.5), lwd=2) else { # Splus[S-PLUS]
xx <- seq(0,10, len=201); plot(xx, cos(xx), type = 'l', ylim = c(-1.5,1.5))
}
title(expression("Estimating f'() : " * frac(d,dx) * sin(x) == cos(x)))
offs <- c(-0.1, 0, 0.1, 0.2, 0.3)
i <- 1
for(off in offs) {
d12 <- D1D2(x,y, spar.offset = off)
lines(d12$x, d12$D1, col = i <- i+1)
}
legend(2,1.6, c("true cos()",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:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|