aggregatets(RTAQ)
aggregatets()所属R语言包:RTAQ
Aggregate a time series
总时间序列
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Function returns aggregated time series as xts object. It can handle irregularly spaced timeseries and returns a regularly spaced one. Use univariate timeseries as input for this function, and check out aggregateTrades and aggregateQuotes to aggregate Trade or Quote data objects.
函数返回聚集的时间序列作为XTS对象。它可以处理不规则的时间序列,并返回一个定期间隔。这个函数的输入,使用单变量时间序列,并检查了aggregateTrades和aggregateQuotes总贸易或引用的数据对象。
用法----------Usage----------
aggregatets(ts, FUN="previoustick", on="minutes", k=1, weights=NULL,
dropna=FALSE)
参数----------Arguments----------
参数:ts
xts object to aggregate.
XTS聚集。
参数:FUN
function to apply over each interval. By default, previous tick aggregation is done. Alternatively one can set e.g. FUN="mean". In case weights are supplied, this argument is ignored and a weighted average is taken.
功能适用于在每个时间间隔。默认情况下,前面打勾聚合完成。另一种方法是,例如可以设置FUN =“意思”。提供的情况下,权重,此参数将被忽略,而加权平均。
参数:on
character, indicating the time scale in which "k" is expressed. Possible values are: "secs", "seconds", "mins", "minutes","hours", "days", "weeks".
字符,表示的时间尺度,其中“k”被表示。可能的值有:“秒”,“秒”,“分”,“分钟”,“小时”,“天”,“周”。
参数:k
positive integer, indicating the number of periods to aggregate over. E.g. to aggregate a xts object to the 5 minute frequency set k=5 and on="minutes".
的正整数,表示周期数的合计超过已。例如聚合XTS对象,在5分钟的频率设定k = 5 =“分钟”。
参数:weights
By default, no weighting scheme is used. When you assign an xts object with wheights to this argument, a weighted mean is taken over each interval. Of course, the weights should have the same timestamps as the supplied time series.
缺省情况下,权重方案。当您指定一个XTS对象这一说法与wheights,被接管的加权平均每间隔。当然,作为所提供的时间序列的权重,应该具有相同的时间戳。
参数:dropna
boolean, which determines whether empty intervals should be dropped. By default, an NA is returned in case an interval is empty, except when the user opts for previous tick aggregation, by setting FUN="previoustick" (default).
布尔值,它确定是否为空的时间间隔应该被丢弃。默认情况下,不适用的情况下返回的时间间隔是空的,除非用户选择前面打勾聚集,通过设置FUN =“previoustick”(默认值)。
值----------Value----------
An xts object containing the aggregated time series.
一个XTS反对,包含聚集的时间序列。
Details
详细信息----------Details----------
The timestamps of the new time series are the closing times and/or days of the intervals. E.g. for a weekly aggregation the new timestamp is the last day in that particular week (namely sunday).
新的时间序列的时间戳截止时间和/或数天的时间间隔。例如每周聚集新的时间戳,尤其是本周的最后一天(即星期日)。
In case of previous tick aggregation, for on="seconds"/"minutes"/"hours", the element of the returned series with e.g. timestamp 09:35:00 contains the last observation up to that point, excluding the value at 09:35:00 itself.
=“秒”/“会议纪要”/“小时”,元素返回的一系列在前面打勾聚集的情况下,例如时间戳9时35分〇〇秒包含了最后一次观察到这一点,不包括在9点35分零零秒自身的价值。
(作者)----------Author(s)----------
Jonathan Cornelissen and Kris Boudt
实例----------Examples----------
#load sample price data[加载样品价格数据]
data("sample_tdata");
ts = sample_tdata$PRICE;
#Previous tick aggregation to the 5-minute sampling frequency:[前面打勾聚集到5分钟的采样频率:]
tsagg5min = aggregatets(ts,on="minutes",k=5);
head(tsagg5min);
#Previous tick aggregation to the 30-second sampling frequency:[的前面打勾聚集到30秒的采样频率:]
tsagg30sec = aggregatets(ts,on="seconds",k=30);
tail(tsagg30sec);
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|