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

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

[复制链接]
发表于 2012-2-16 19:46:12 | 显示全部楼层 |阅读模式
stepfun(stats)
stepfun()所属R语言包:stats

                                        Step Function Class
                                         阶跃函数类

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

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

Given the vectors (x[1], …, x[n]) and (y[0], y[1], …, y[n]) (one value more!), stepfun(x,y,...) returns an interpolating "step" function, say fn. I.e., fn(t) =     c[i] (constant) for t in (     x[i], x[i+1]) and at the abscissa values, if (by default) right = FALSE, fn(x[i]) = y[i] and for right = TRUE, fn(x[i]) = y[i-1], for i=1, …, n.
鉴于向量(x[1], …, x[n])和(y[0], y[1], …, y[n])(一个值!),stepfun(x,y,...)返回插值的步骤“功能,说fn。即fn(t) =     c“[i](常量)t in (     x[i], x[i+1])”在横坐标值(默认),如果right = FALSE,fn(x[i]) = y[i]和right = TRUE fn(x[i]) = y[i-1],i=1, …, n。

The value of the constant c[i] above depends on the "continuity" parameter f. For the default, right = FALSE, f = 0, fn is a cadlag function, i.e., continuous at right, limit ("the point") at left. In general, c[i] is interpolated in between the neighbouring y values, c[i] = (1-f)*y[i] + f*y[i+1]. Therefore, for non-0 values of f, fn may no longer be a proper step function, since it can be discontinuous from both sides, unless right = TRUE, f = 1 which is right-continuous.
不断c[i]以上的价值取决于“连续性”参数f。默认情况下,right = FALSE, f = 0,fn cadlag功能,即连续在右边,在左边的限制(“点”)。在一般情况下,c[i]插在邻近y值之间,c[i] = (1-f)*y[i] + f*y[i+1]。因此,非0值f,fn可能不再是一个正确的步骤功能,因为它可以从双方的不连续的,除非right = TRUE, f = 1这是右连续。


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


stepfun(x, y, f = as.numeric(right), ties = "ordered",
        right = FALSE)

is.stepfun(x)
knots(Fn, ...)
as.stepfun(x, ...)

## S3 method for class 'stepfun'
print(x, digits = getOption("digits") - 2, ...)

## S3 method for class 'stepfun'
summary(object, ...)



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

参数:x
numeric vector giving the knots or jump locations of the step function for stepfun().  For the other functions, x is as object below.
数字矢量疙瘩或stepfun()跳步功能的位置。对于其他功能,x是object下面。


参数:y
numeric vector one longer than x, giving the heights of the function values between the x values.
提供数字矢量一个较长的比x,x值之间的函数值的高度。


参数:f
a number between 0 and 1, indicating how interpolation outside the given x values should happen.  See approxfun.
0和1之间的数,表示外界给定的x值的插值应发生。看到approxfun。


参数:ties
Handling of tied x values. Either a function or the string "ordered".  See  approxfun.
绑x值的处理。无论是功能或字符串"ordered"。看到approxfun。


参数:right
logical, indicating if the intervals should be closed on the right (and open on the left) or vice versa.
逻辑,表示如果时间间隔应关闭右侧(左侧开)或反之亦然。


参数:Fn, object
an R object inheriting from "stepfun".
从"stepfun"R对象继承。


参数:digits
number of significant digits to use, see print.
有效位数的号码使用,请参阅print。


参数:...
potentially further arguments (required by the generic).
(通用要求)可能进一步的论据。


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

A function of class "stepfun", say fn.
一个功能的类"stepfun"说fn。

There are methods available for summarizing ("summary(.)"), representing ("print(.)") and plotting  ("plot(.)", see plot.stepfun) "stepfun" objects.
有方法可用于汇总("summary(.)"),占("print(.)")和绘图("plot(.)",看到plot.stepfun)"stepfun"对象。

The environment of fn contains all the information needed;
environmentfn包含所需的所有信息;


参数:"x","y"
the original arguments
原来的参数


参数:"n"
number of knots (x values)
节数(X值)


参数:"f"
continuity parameter
连续性参数


参数:"yleft", "yright"
the function values outside the knots
函数值外结


参数:"method"
(always == "constant", from approxfun(.)).
(总是== "constant",approxfun(.))。

The knots are also available via knots(fn).
也可通过knots(fn)疙瘩。


作者(S)----------Author(s)----------



Martin Maechler, <a href="mailto:maechler@stat.math.ethz.ch">maechler@stat.math.ethz.ch</a> with some basic
code from Thomas Lumley.




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

ecdf for empirical distribution functions as special step functions and plot.stepfun for plotting step functions.
ecdf特步功能和plot.stepfun绘制步骤职能的经验分布函数。

approxfun and splinefun.
approxfun和splinefun。


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


y0 <- c(1.,2.,4.,3.)
sfun0  <- stepfun(1:3, y0, f = 0)
sfun.2 <- stepfun(1:3, y0, f = .2)
sfun1  <- stepfun(1:3, y0, f = 1)
sfun1c &lt;- stepfun(1:3, y0, right=TRUE)# hence f=1[因此f = 1]
sfun0
summary(sfun0)
summary(sfun.2)

## look at the internal structure:[#看看内部结构:]
unclass(sfun0)
ls(envir = environment(sfun0))

x0 <- seq(0.5,3.5, by = 0.25)
rbind(x=x0, f.f0 = sfun0(x0), f.f02= sfun.2(x0),
      f.f1 = sfun1(x0), f.f1c = sfun1c(x0))
## Identities :[#身份:]
stopifnot(identical(y0[-1], sfun0 (1:3)),# right = FALSE[右为FALSE]
          identical(y0[-4], sfun1c(1:3)))# right = TRUE[右= TRUE,]

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


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-1-24 21:14 , Processed in 0.020968 second(s), 16 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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