找回密码
 注册
查看: 3353|回复: 0

R语言:ns()函数中文帮助文档(中英文对照)

[复制链接]
发表于 2012-2-16 18:24:16 | 显示全部楼层 |阅读模式
ns(splines)
ns()所属R语言包:splines

                                        Generate a Basis Matrix for Natural Cubic Splines
                                         产生自然三次样条的基础矩阵

                                         译者:生物统计家园网 机器人LoveR

描述----------Description----------

Generate the B-spline basis matrix for a natural cubic spline.
产生的自然三次样条B样条基矩阵。


用法----------Usage----------


ns(x, df = NULL, knots = NULL, intercept = FALSE,
   Boundary.knots = range(x))



参数----------Arguments----------

参数:x
the predictor variable.  Missing values are allowed.
预测变量。遗漏值是不允许的。


参数:df
degrees of freedom. One can supply df rather than knots; ns() then chooses df - 1 - intercept knots at suitably chosen quantiles of x (which will ignore missing values).
自由度。一个可以提供df而不是海里;ns()然后选择df - 1 - intercept的x(这将忽略缺失值)选择合适的位数节。


参数:knots
breakpoints that define the spline.  The default is no knots; together with the natural boundary conditions this results in a basis for linear regression on x.  Typical values are the mean or median for one knot, quantiles for more knots.  See also Boundary.knots.
定义样条曲线的断点。默认是没有结;加上自然边界条件,在此基础上x线性回归结果。典型值的均值或中位数为一个结,位数多海里。还可以看Boundary.knots。


参数:intercept
if TRUE, an intercept is included in the basis; default is FALSE.
如果TRUE截距包括在基础;默认是FALSE。


参数:Boundary.knots
boundary points at which to impose the natural boundary conditions and anchor the B-spline basis (default the range of the data).  If both knots and Boundary.knots are supplied, the basis parameters do not depend on x. Data can extend beyond Boundary.knots
边界点施加的自然边界条件和锚定的B样条的基础上(默认情况下,数据的范围)。如果这两个knots和Boundary.knots提供基础参数不依赖于x。数据可以延长超出Boundary.knots


值----------Value----------

A matrix of dimension length(x) * df where either df was supplied or if knots were supplied, df = length(knots) + 1 + intercept. Attributes are returned that correspond to the arguments to ns, and explicitly give the knots, Boundary.knots etc for use by predict.ns().
维矩阵length(x) * df或df提供或knots提供,df = length(knots) + 1 + intercept。返回的属性,对应的参数ns,并明确给knots,Boundary.knots等predict.ns()。

ns() is based on the function spline.des.  It generates a basis matrix for representing the family of piecewise-cubic splines with the specified sequence of interior knots, and the natural boundary conditions.  These enforce the constraint that the function is linear beyond the boundary knots, which can either be supplied, else default to the extremes of the data.  A primary use is in modeling formula to directly specify a natural spline term in a model.
ns()是基于功能spline.des。它产生一个代表家庭内部结指定的顺序分段三次样条的基础矩阵,自然边界条件。这些执行功能是超越边界的疙瘩,可以提供,否则默认的数据极端线性约束。一个主要用途是直接在模型中指定一个自然样条长期在建模公式。


参考文献----------References----------

Generalized additive models. Chapter 7 of Statistical Models in S eds J. M. Chambers and T. J. Hastie, Wadsworth & Brooks/Cole.

参见----------See Also----------

bs, predict.ns, SafePrediction
bs,predict.ns,SafePrediction


举例----------Examples----------


require(stats); require(graphics)
ns(women$height, df = 5)
summary(fm1 <- lm(weight ~ ns(height, df = 5), data = women))

## example of safe prediction[#例如安全预测]
plot(women, xlab = "Height (in)", ylab = "Weight (lb)")
ht <- seq(57, 73, length.out = 200)
lines(ht, predict(fm1, data.frame(height=ht)))

转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。


注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|小黑屋|生物统计家园 网站价格

GMT+8, 2025-1-23 15:13 , Processed in 0.021249 second(s), 15 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表