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

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

[复制链接]
发表于 2012-2-17 10:09:24 | 显示全部楼层 |阅读模式
ts(stats)
ts()所属R语言包:stats

                                        Time-Series Objects
                                         时间序列对象

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

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

The function ts is used to create time-series objects.
的功能ts用于创建时间序列对象。

as.ts and is.ts coerce an object to a time-series and test whether an object is a time series.
as.ts和is.ts胁迫时间序列和测试一个对象是否是一个时间序列的对象。


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


ts(data = NA, start = 1, end = numeric(0), frequency = 1,
   deltat = 1, ts.eps = getOption("ts.eps"), class = , names = )
as.ts(x, ...)
is.ts(x)



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

参数:data
a numeric vector or matrix of the observed time-series values. A data frame will be coerced to a numeric matrix via data.matrix.
时间序列的观测值的一个数值向量或矩阵。一个数据框将被强制通过data.matrix数字矩阵。


参数: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.  See the examples for the use of the second form.
首次观察到的时间。无论是单数或两个整数,指定单位时间内的一个自然单位时间(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少。


参数:class
class to be given to the result, or none if NULL or "none".  The default is "ts" for a single series, c("mts", "ts") for multiple series.
如果NULL或"none"类必须考虑到的结果,或没有。默认是"ts"一个系列,c("mts", "ts")多个系列。


参数:names
a character vector of names for the series in a multiple series: defaults to the colnames of data, or Series 1, Series 2, ....
一个系列多个系列的名称特征向量:默认的colnames data或Series 1,Series 2....


参数:x
an arbitrary R object.
任意一个R对象。


参数:...
arguments passed to methods (unused for the default method).
参数传递给方法(未使用的默认方法)。


Details

详情----------Details----------

The function ts is used to create time-series objects.  These are vector or matrices with class of "ts" (and additional attributes) which represent data which has been sampled at equispaced points in time.  In the matrix case, each column of the matrix data is assumed to contain a single (univariate) time series. Time series must have at least one observation, and although they need not be numeric there is very limited support for non-numeric series.
的功能ts用于创建时间序列对象。这是向量或矩阵"ts"(附加属性)类代表已在时间均布点采样数据。矩阵中的情况下,每列的矩阵data假设包含一个(单因素)的时间序列。时间序列必须至少有一个观察,虽然他们不需要是数字非数字系列是非常有限的支持。

Class "ts" has a number of methods.  In particular arithmetic will attempt to align time axes, and subsetting to extract subsets of series can be used (e.g., EuStockMarkets[, "DAX"]).  However, subsetting the first (or only) dimension will return a matrix or vector, as will matrix subsetting.  Subassignment can be used to replace values but not to extend a series (see window). There is a method for t that transposes the series as a matrix (a one-column matrix if a vector) and hence returns a result that does not inherit from class "ts".
"ts"类有许多方法。尤其是算术将尝试调整时间轴,子集可用于提取一系列的子集(例如,EuStockMarkets[, "DAX"])。然而,第一(或唯一)维子集将返回一个矩阵或向量,将矩阵的子集。 subassignment可用于替换值,但不延长系列(见window)。有一个方法t,调换矩阵系列(一列的矩阵如果一个向量),因此不继承类"ts"返回一个结果。

The value of argument frequency is used when the series is sampled an integral number of times in each unit time interval.  For example, one could use a value of 7 for frequency when the data are sampled daily, and the natural time period is a week, or 12 when the data are sampled monthly and the natural time period is a year.  Values of 4 and 12 are assumed in (e.g.) print methods to imply a quarterly and monthly series respectively.
值参数frequency系列采样时,在每个单位的时间间隔的整数次。例如,人们可以使用的价值7frequency时,数据采样每日,自然时间是一个星期,或12时的数据进行采样,并每月定期天然一段时间是一年。值4和12(如)print的方法假设分别意味着一季度和月度系列。

as.ts is generic.  Its default method will use the tsp attribute of the object if it has one to set the start and end times and frequency.
as.ts是通用的。其默认的方法,将使用tsp对象属性,如果它有一个设置开始和结束的时间和频率。

is.ts tests if an object is a time series.  It is generic: you can write methods to handle specific classes of objects, see InternalMethods.
is.ts测试,如果对象是一个时间序列。它是通用的:你可以写的方法来处理特定的类的对象,看到InternalMethods“。


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

The New S Language. Wadsworth & Brooks/Cole.

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

tsp, frequency, start, end, time, window; print.ts, the print method for time series objects; plot.ts, the plot method for time series objects.
tsp,frequency,start,end,time,window;print.ts,时间序列对象的打印方法; plot.ts图法,时间序列对象。


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


require(graphics)

ts(1:10, frequency = 4, start = c(1959, 2)) # 2nd Quarter of 1959[1959年第二季]
print( ts(1:10, frequency = 7, start = c(12, 2)), calendar = TRUE)
# print.ts(.)[print.ts()。]
## Using July 1954 as start date:[#1954年7月开始日期:]
gnp <- ts(cumsum(1 + round(rnorm(100), 2)),
          start = c(1954, 7), frequency = 12)
plot(gnp) # using 'plot.ts' for time-series plot[使用时间序列图“plot.ts]

## Multivariate[#多元]
z <- ts(matrix(rnorm(300), 100, 3), start=c(1961, 1), frequency=12)
class(z)
plot(z)
plot(z, plot.type="single", lty=1:3)

## A phase plot:[#A相图:]
plot(nhtemp, c(nhtemp[-1], NA), cex = .8, col="blue",
     main = "Lag plot of New Haven temperatures")
## a clearer way to do this would be[#更清晰的方式做,这将是]
## Not run: [#无法运行:]
plot(nhtemp, lag(nhtemp, 1), cex = .8, col="blue",
     main = "Lag plot of New Haven temperatures")


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


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-1-23 01:08 , Processed in 0.020518 second(s), 15 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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