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

R语言 zoo包 zooreg()函数中文帮助文档(中英文对照)

[复制链接]
发表于 2012-10-2 07:54:44 | 显示全部楼层 |阅读模式
zooreg(zoo)
zooreg()所属R语言包:zoo

                                        Regular zoo Series
                                         定期动物园系列

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

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

zooreg is the creator for the S3 class "zooreg" for regular "zoo" series. It inherits from "zoo" and is the analogue to ts.
zooreg是的S3类"zooreg"定期"zoo"系列的创造者。它继承了"zoo"和是模拟到ts。


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


zooreg(data, start = 1, end = numeric(), frequency = 1,
  deltat = 1, ts.eps = getOption("ts.eps"), order.by = NULL)



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

参数:data
a numeric vector, matrix or a factor.
一个数值向量,矩阵或一个因素。


参数:start
the time of the first observation.  Either a single number or a vector of two integers, which specify a natural time unit and a (1-based) number of samples into the time unit.
的第一观察的时间。无论是单一的数或两个整数,它指定一个自然时间到的时间单元的单元和(基于1)样品数量的向量。


参数:end
the time of the last observation, specified in the same way as start.
的时间指定的最后的观察,在相同的方式start。


参数:frequency
the number of observations per unit of time.
的数目,每单位时间的观测。


参数:deltat
the fraction of the sampling period between successive observations; e.g., 1/12 for monthly data.  Only one of frequency or deltat should be provided.
分数的采样周期之间的连续观察,例如,月度数据的1/12。只有一个frequency或deltat应提供。


参数:ts.eps
time series comparison tolerance.  Frequencies are considered equal if their absolute difference is less than ts.eps.
时间序列比较宽容。频率被认为是平等的,如果他们的绝对差小于ts.eps。


参数:order.by
a vector by which the observations in x are ordered. If this is specified the arguments start and end are ignored and zoo(data, order.by, frequency) is called. See zoo for more information.
向量的意见x是有序的。如果这是指定的参数start和end被忽略,并且zoo(data, order.by, frequency)被称为。见zoo更多信息。


Details

详细信息----------Details----------

Strictly regular series are those whose time points are equally spaced. Weakly regular series are strictly regular time series in which some of the points may have been removed but still have the original underlying frequency associated with them. "zooreg" is a subclass of "zoo" that is used to represent both weakly and strictly regular series. Internally, it is the same as "zoo" except  it also has a "frequency" attribute. Its index class is more restricted  than "zoo". The index: 1. must be numeric or a class which can be coerced via as.numeric (such as yearmon, yearqtr, Date, POSIXct, tis,  xts, etc.).  2. when converted to numeric must be expressible as multiples of 1/frequency. 3. group generic functions Ops should be defined, i.e., adding/subtracting a numeric to/from the index class should produce the correct value of the index class again.
严格的定期系列的时间点是等间距的。弱定期一系列严格的定时时间系列中的一些观点可能已被删除,但仍然有原来的基本频率与他们。 "zooreg"是"zoo"这是用来表示弱和严格的定期系列的一个子类。在内部,它"zoo"但它也有一个"frequency"属性是一样的。它的指数类是限制比"zoo"。指标:1。必须是数字或一个类,可以强制通过as.numeric(如yearmon,yearqtr,Date,POSIXct,tis, xts,等)。 2。转换为数字时,必须表达的倍数的频率的倒数。 3。组通用的功能Ops应该被定义,即,加/减一个数字到/从索引类应该产生正确的值的索引类。

zooreg is the zoo analogue to ts. The arguments are almost identical, only in the case where order.by is specified, zoo is called with zoo(data, order.by, frequency). It creates a regular series of class "zooreg" which inherits from "zoo". It is essentially a "zoo" series with an additional "frequency" attribute. In the creation of "zooreg" objects (via zoo, zooreg, or coercion functions) it is always check whether the index specified complies with the frequency specified.
zooreg是zoo模拟到ts的。的参数几乎是相同的,只有在order.by指定的情况下,zoo被称为zoo(data, order.by, frequency)。它创建类"zooreg"继承自"zoo"一连串有规律的。它本质上是一个"zoo"一系列额外的"frequency"属性。它总是在创建的"zooreg"对象(通过zoo,zooreg,或强迫的功能)检查指定的索引是否符合指定的频率。

The class "zooreg" offers two advantages over code "ts": 1. The index does not have to be plain numeric (although that is the default), it just must be coercible to numeric, thus printing and plotting can be customized. 2. This class can not only represent strictly regular series, but also series with an underlying regularity, i.e., where some observations from a regular grid are omitted.
类"zooreg"提供了两个优势代码"ts":1。该指数并不一定是纯数字(尽管这是默认值),它只是必须转换成数字,从而可以自定义打印和绘图。 2。这个类不仅可以代表一系列严格的定期,而且也是系列的一个基本规律,即从一个普通的电网省略一些意见。

Hence, "zooreg" is a bridge between "ts" and "zoo" and can be employed to coerce back and forth between the two classes. The coercion function as.zoo.ts returns therefore an object of class "zooreg" inheriting from "zoo". Coercion between "zooreg" and "zoo" is also available and drops or tries to add a frequency respectively.
因此,"zooreg"之间的桥梁"ts"和"zoo"和可以用来逼迫两个类之间来回。转换函数as.zoo.ts返回类"zooreg"继承"zoo"的对象。胁迫之"zooreg"和"zoo"也可下降或试图添加的频率分别。

For checking whether a series is strictly regular or does have an underlying regularity the generic function is.regular can be used.
了一系列检查是否是严格规范的,还是有一个基本的规律性的通用函数is.regular可以使用。

Methods to standard generics for regular series such as frequency, deltat and cycle are available for both "zooreg" and "zoo" objects. In the latter case, it is checked first (in a data-driven way) whether the series is in fact regular or not.
定期等系列标准的仿制药的方法frequency,deltat和cycle都"zooreg"和"zoo"对象。在后者的情况下,它首先检查(在数据驱动的方式),该系列是否实际上是定期或不。

as.zooreg.tis has a class argument whose value represents the class of the index of the zooreg object into which the tis object is converted.  The default value is "ti".  Note that the  frequency of the zooreg object will not necessarily be the same as the frequency of the tis object that it is converted from.  
as.zooreg.tis有一个class参数,其值代表zooreg到对象tis的对象转换的索引之类的。默认值是"ti"。请注意,zooreg对象的频率并不一定是相同tis对象的频率,它被转换从。


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

An object of class "zooreg" which inherits from "zoo". It is essentially a "zoo" series with a "frequency" attribute.
对象的类"zooreg"继承"zoo"。它本质上是一个"zoo"系列一个"frequency"属性。


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

zoo, is.regular
zoo,is.regular


实例----------Examples----------


## equivalent specifications of a quarterly series[#同等规格的一季报系列]
## starting in the second quarter of 1959.[#在1959年第二季度开始。]
zooreg(1:10, frequency = 4, start = c(1959, 2))
as.zoo(ts(1:10, frequency = 4, start = c(1959, 2)))
zoo(1:10, seq(1959.25, 1961.5, by = 0.25), frequency = 4)

## use yearqtr class for indexing the same series[#使用yearqtr的类同一系列的索引]
z <- zoo(1:10, yearqtr(seq(1959.25, 1961.5, by = 0.25)), frequency = 4)
z
z[-(3:4)]

## create a regular series with a "Date" index[#创建一个普通的“日期”指数系列]
zooreg(1:5, start = as.Date("2000-01-01"))
## or with "yearmon" index[#或与“yearmon”指数的]
zooreg(1:5, end = yearmon(2000))

## lag and diff (as diff is defined in terms of lag)[#滞后性和差异(差异是指在滞后)]
## act differently on zoo and zooreg objects![采取不同的上动物园和zooreg对象!]
## lag.zoo moves a point to the adjacent time whereas[#lag.zoo移动一个点到相邻的时间,而]
## lag.zooreg moves a point by deltat[#lag.zooreg移动一个点,由DeltaT]
x <- c(1, 2, 3, 6)
zz <- zoo(x, x)
zr <- as.zooreg(zz)
lag(zz, k = -1)
lag(zr, k = -1)
diff(zz)
diff(zr)

## lag.zooreg wihtout and with na.pad[#lag.zooreg wihtout和na.pad]
lag(zr, k = -1)
lag(zr, k = -1, na.pad = TRUE)

## standard methods available for regular series[#标准方法可用于常规系列]
frequency(z)
deltat(z)
cycle(z)
cycle(z[-(3:4)])

zz  <-  zoo(1:6, as.Date(c("1960-01-29", "1960-02-29", "1960-03-31", "1960-04-29", "1960-05-31", "1960-06-30")))
# this converts zz to "zooreg" and then to "ts" expanding it to a daily[这将ZZ“zooreg”,然后将它扩大到每天的“TS”]
# series which is 154 elements long, most with NAs.[系列的长度是154的元素,最有NAS。]
## Not run: [#不运行:]
length(as.ts(zz)) # 154[154]

## End(Not run)[#(不执行)]
# probably a monthly "ts" series rather than a daily one was wanted.[可能是每月一次的“TS”系列,而不是每天被通缉。]
# This variation of the last line gives a result only 6 elements long.[最后一行给出了这种变化的结果只有6元素长。]
length(as.ts(aggregate(zz, as.yearmon, c))) # 6[6]

zzr <- as.zooreg(zz)

dd <- as.Date(c("2000-01-01", "2000-02-01", "2000-03-01", "2000-04-01"))
zrd <- as.zooreg(zoo(1:4, dd))


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


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-11-24 01:11 , Processed in 0.025922 second(s), 15 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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