s(VGAM)
s()所属R语言包:VGAM
Defining smooths in VGAM formulae
VGAM公式定义平滑
译者:生物统计家园网 机器人LoveR
描述----------Description----------
s is used in the definition of (vector) smooth terms within vgam formulae.
svgam式(矢量)光滑条款内的定义中使用。
用法----------Usage----------
s(x, df = 4, spar = 0, ...)
参数----------Arguments----------
参数:x
covariate (abscissae) to be smoothed. Note that x must be a single variable and not a function of a variable. For example, s(x) is fine but s(log(x)) will fail. In this case, let logx <- log(x), say, and then use s(logx). At this stage bivariate smoothers (x would be a two-column matrix) are not implemented.
协变量(横坐标)进行平滑处理。注意x必须是一个单一的变量,而不是一个变量的函数。例如,s(x)是不错,但s(log(x))会失败。在这种情况下,我们logx <- log(x),说,然后使用s(logx)。在这个阶段,二元平滑(x将是一个两列的矩阵)还没有实现。
参数:df
numerical vector of length r. Effective degrees of freedom: must lie between 1 (linear fit) and n (interpolation). Thus one could say that df-1 is the nonlinear degrees of freedom of the smooth. Recycling of values will be used if df is not of length r.
数值向量的长度r。有效自由度:必须介于1(线性拟合)和n(插值)。因此,我们可以说这df-1是非线性的顺利程度的自由。 df如果是不是长r的值将被用来回收。
参数:spar
numerical vector of length r. Positive smoothing parameters (after scaling) . Larger values mean more smoothing so that the solution approaches a linear fit for that component function. A zero value means that df is used. Recycling of values will be used if spar is not of length r.
数值向量的长度r。正平滑参数(缩放后)。值越大,意味着更平滑的解决方案,使接近线性拟合该组件的功能。零值意味着df使用。 spar如果是不是长r的值将被用来回收。
参数:...
Ignored for now.
现在忽略。
Details
详细信息----------Details----------
In this help file M is the number of additive predictors and r is the number of component functions to be estimated (so that r is an element from the set {1,2,...,M}). Also, if n is the number of distinct abscissae, then s will fail if n < 7.
在此帮助文件M是添加剂的预测和r是要估计的数字组件功能(使r是一个元素的集合{1,2,。 。,M})。此外,如果n独特的横坐标是多少,然后s会失败,如果n < 7。
s, which is symbolic and does not perform any smoothing itself, only handles a single covariate. Note that s works in vgam only. It has no effect in vglm (actually, it is similar to the identity function I so that s(x2) is the same as x2 in the LM model matrix). It differs from the s of the gam and mgcv packages; they should not be mixed together. Also, terms involving s should be simple additive terms, and not involving interactions and nesting etc. For example, myfactor:s(x2) is not a good idea.
s,这是象征性的,并且不执行任何平滑本身,只处理一个单一的协变量。请注意s作品vgam只。它不会起任何作用vglm(实际上,它是类似的身份功能I“这样,s(x2)是一样x2LM模型矩阵)。它不同于s的gam和mgcv包,他们不应该混在一起。此外,条款涉及s应该是简单相加计算,不涉及的相互作用和嵌套等。例如,myfactor:s(x2)是不是一个好主意。
It also differs from the S-PLUS s which allows spar to be negative; VGAM does not allow this.
它也不同于S-PLUS sspar是负面的; VGAM不容许这种。
值----------Value----------
A vector with attributes that are (only) used by vgam.
一个矢量属性(只)使用vgam。
注意----------Note----------
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)的。
An alternative to using s with vgam is bs and/or ns with vglm. The latter implements half-stepping, which is helpful if convergence is difficult.
另一种使用svgam是bs和/或nsvglm。后者实现了半步,这是有帮助的,如果收敛困难。
(作者)----------Author(s)----------
Thomas W. Yee
参考文献----------References----------
Vector generalized additive models. Journal of the Royal Statistical Society, Series B, Methodological, 58, 481–493.
参见----------See Also----------
vgam, vsmooth.spline.
vgam,vsmooth.spline。
实例----------Examples----------
# Nonparametric logistic regression[非参数logistic回归]
fit = vgam(agaaus ~ s(altitude, df=2), binomialff, hunua)
## Not run: [#不运行:]
plot(fit, se=TRUE)
## End(Not run)[#(不执行)]
# Bivariate logistic model with artificial data[二元Logistic回归模型与人工数据]
nn = 300
mydf = data.frame(x1=runif(nn), x2=runif(nn))
mydf = transform(mydf,
y1 = rbinom(nn, size=1, prob=logit(sin(2*x2), inv=TRUE)),
y2 = rbinom(nn, size=1, prob=logit(sin(2*x2), inv=TRUE)))
fit = vgam(cbind(y1,y2) ~ x1 + s(x2, 3), trace=TRUE,
binom2.or(exchangeable = TRUE ~ s(x2,3)), data=mydf)
coef(fit, matrix=TRUE) # Hard to interpret[很难解释]
## Not run: [#不运行:]
plot(fit, se=TRUE, which.term= 2, scol="blue")
## End(Not run)[#(不执行)]
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|