vsmooth.spline(VGAM)
vsmooth.spline()所属R语言包:VGAM
Vector cubic smoothing spline
矢量三次样条函数
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Fits a vector cubic smoothing spline.
适合的矢量三次样条函数。
用法----------Usage----------
vsmooth.spline(x, y, w = NULL, df = rep(5, M), spar = NULL, all.knots = FALSE,
iconstraint = diag(M), xconstraint = diag(M),
constraints = list("(Intercepts)" = diag(M), x = diag(M)),
var.arg = FALSE, scale.w = TRUE, nk = NULL,
control.spar = list())
参数----------Arguments----------
参数:x
A vector, matrix or a list. If a list, the x component is used. If a matrix, the first column is used. x may also be a complex vector, in which case the real part is used, and the imaginary part is used for the response. In this help file, n is the number of unique values of x.
一个向量,矩阵或列表。如果列表中,x组件。如果一个矩阵中,第一列被使用。 x也可能是一个复向量,在这种情况下,使用的实部,虚部用于响应。在此帮助文件中,n是独特的价值x的数量。
参数:y
A vector, matrix or a list. If a list, the y component is used. If a matrix, all but the first column is used. In this help file, M is the number of columns of y if there are no constraints on the functions.
一个向量,矩阵或列表。如果列表中,y组件。如果一个矩阵,所有的第一列被使用。在此帮助文件中,M的列数y如果没有任何限制的功能。
参数:w
The weight matrices or the number of observations. If the weight matrices, then this must be a n-row matrix with the elements in matrix-band form (see iam). If a vector, then these are the number of observations. By default, w is the M by M identity matrix, denoted by matrix(1, n, M).
权重矩阵的若干意见。如果权重矩阵,那么这必须是一个n行矩阵带状矩阵中的元素(见iam)。如果一个向量,那么这些都是若干意见。默认情况下,w是M矩阵,M的matrix(1, n, M)表示。
参数:df
Numerical vector containing the degrees of freedom for each component function (smooth). If necessary, the vector is recycled to have length equal to the number of component functions to be estimated (M if there are no constraints), which equals the number of columns of the x-constraint matrix. A value of 2 means a linear fit, and each element of df should lie between 2 and n. The larger the values of df the more wiggly the smooths.
数值向量的自由度,每个组件的功能(平滑)。如果有必要,该矢量被再循环到具有长度相等的数量的组件的功能以进行估计(M如果没有任何限制),它等于x-约束矩阵的列数。值2表示的线性拟合,每个元素的df应介于2和n。 df波浪的平滑的值越大。
参数:spar
Numerical vector containing the non-negative smoothing parameters for each component function (smooth). If necessary, the vector is recycled to have length equal to the number of component functions to be estimated (M if there are no constraints), which equals the number of columns of the x-constraint matrix. A value of zero means the smooth goes through the data and hence is wiggly. A value of Inf may be assigned, meaning the smooth will be linear. By default, the NULL value of spar means df is used to determine the smoothing parameters.
数值向量含有的非负的平滑化参数,每个组件的功能(平滑)。如果有必要,该矢量被再循环到具有长度相等的数量的组件的功能以进行估计(M如果没有任何限制),它等于x-约束矩阵的列数。零值意味着顺利通过数据,因此是波动的。 Inf值可以分配,这意味着顺利将是线性的。默认情况下,NULLspar是指df被用来确定平滑参数。
参数:all.knots
Logical. If TRUE then each distinct value of x will be a knot. By default, only a subset of the unique values of x are used; typically, the number of knots is O(n^0.25) for n large, but if n <= 40 then all the unique values of x are used.
逻辑。如果TRUE然后x每个不同的值将是一个结。默认情况下,只有一小部分的独特价值x中使用,通常情况下,节点数是O(n^0.25)的n大,但如果n <= 40然后所有的独特值x使用。
参数:iconstraint
A M-row constraint matrix for the intercepts. It must be of full column rank. By default, the constraint matrix for the intercepts is the M by M identity matrix, meaning no constraints.
AM行约束矩阵的拦截。它必须是列满秩。默认情况下,约束矩阵的拦截是MM的的身份矩阵,这意味着没有任何限制。
参数:xconstraint
A M-row constraint matrix for x. It must be of full column rank. By default, the constraint matrix for the intercepts is the M by M identity matrix, meaning no constraints.
AM行约束矩阵x。它必须是列满秩。默认情况下,约束矩阵的拦截是MM的的身份矩阵,这意味着没有任何限制。
参数:constraints
An alternative to specifying iconstraint and xconstraint, this is a list with two components corresponding to the intercept and x respectively. They must both be a M-row constraint matrix with full column rank.
一种替代方法指定iconstraint和xconstraint,这是的截距和x分别对应于两个组件的列表。他们都必须是一个M行约束矩阵列满秩。
参数:var.arg
Logical: return the pointwise variances of the fit? Currently, this corresponds only to the nonlinear part of the fit, and may be wrong.
逻辑:返回的逐点差异的契合吗?目前,这对应于只拟合的非线性部分,并可能是错误的。
参数:scale.w
Logical. By default, the weights w are scaled so that the diagonal elements have mean 1.
逻辑。默认情况下,权重w缩放的对角线元素平均1。
参数:nk
Number of knots. If used, this argument overrides all.knots, and must lie between 6 and n+2 inclusive.
节点数。如果使用此参数将覆盖all.knots,必须介于和n +2包容性。
参数:control.spar
See smooth.spline.
见smooth.spline。
Details
详细信息----------Details----------
The algorithm implemented is detailed in Yee (2000). It involves decomposing the component functions into a linear and nonlinear part, and using B-splines. The cost of the computation is O(n M^3).
实现该算法的详细说明中怡康(2000)。它涉及到组件的功能分解成一个线性和非线性部分,并利用B样条。计算的成本是O(n M^3)。
The argument spar contains scaled smoothing parameters.
参数spar包含扩展的平滑参数。
值----------Value----------
An object of class "vsmooth.spline" (see vsmooth.spline-class).
类的一个对象"vsmooth.spline"(见vsmooth.spline-class)。
注意----------Note----------
This function is quite similar to smooth.spline but offers less functionality. For example, cross validation is not implemented here. For M = 1, the results will be generally different, mainly due to the different way the knots are selected.
此功能是非常相似smooth.spline,但提供的功能较少。例如,交叉验证没有在这里实现。对于M = 1,结果将是一般是不同的,主要是由于不同的方式选择疙瘩。
The vector cubic smoothing spline which s() represents is computationally demanding for large M. The cost is approximately O(M^3).
这s()代表的矢量三次样条计算要求苛刻的大M。成本是约O(M^3)的。
Yet to be done: return the unscaled smoothing parameters.
然而,做返回的不成比例的平滑参数。
(作者)----------Author(s)----------
Thomas W. Yee
参考文献----------References----------
Vector Splines and Other Vector Smoothers. Pages 529–534. In: Bethlehem, J. G. and van der Heijde, P. G. M. Proceedings in Computational Statistics COMPSTAT 2000. Heidelberg: Physica-Verlag.
参见----------See Also----------
vsmooth.spline-class, plot.vsmooth.spline, predict.vsmooth.spline, iam, s, smooth.spline.
vsmooth.spline-class,plot.vsmooth.spline,predict.vsmooth.spline,iam,s,smooth.spline。
实例----------Examples----------
nn = 20; x = 2 + 5*(nn:1)/nn
x[2:4] = x[5:7] # Allow duplication[允许重复]
y1 = sin(x) + rnorm(nn, sd = 0.13)
y2 = cos(x) + rnorm(nn, sd = 0.13)
y3 = 1 + sin(x) + rnorm(nn, sd = 0.13) # Run this for constraints[运行的约束]
y = cbind(y1, y2, y3)
ww = cbind(rep(3,nn), 4, (1:nn)/nn)
(fit = vsmooth.spline(x, y, w = ww, df = 5))
## Not run: [#不运行:]
plot(fit) # The 1st and 3rd functions do not differ by a constant[第一和第三个功能相差不恒定的]
## End(Not run)[#(不执行)]
mat = matrix(c(1,0,1, 0,1,0), 3, 2)
(fit2 = vsmooth.spline(x, y, w = ww, df = 5, iconstr = mat, xconstr = mat))
# The 1st and 3rd functions do differ by a constant:[第一和第三个功能不同的一个常数:]
mycols = c("orange", "blue", "orange")
## Not run: plot(fit2, lcol = mycols, pcol = mycols, las = 1) [#不运行图(FIT2,LCOL = mycols,PCOL = mycols,LAS = 1)]
p = predict(fit, x = fit@x, deriv = 0)
max(abs(fit@y - with(p, y))) # Should be zero[应该是零]
par(mfrow = c(3, 1))
ux = seq(1, 8, len = 100)
for(d in 1:3) {
p = predict(fit, x = ux, deriv = d)
## Not run: with(p, matplot(x, y, type = "l", main = paste("deriv =", d),[#不运行:(P,matplot(X,Y,类型为“L”,主要=粘贴(“微分”,D),]
lwd = 2, ylab = "", cex.axis = 1.5,
cex.lab = 1.5, cex.main = 1.5))
## End(Not run)[#(不执行)]
}
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|