Displaying 20 results from an estimated 7000 matches similar to: "aggregate.ts (PR#376)"
2000 Apr 11
0
aggregate.ts (PR#514)
aggregate.ts does not behave in the same way as the equivalent
method aggregate.rts in S-PLUS. In particular it
- changes the start of the time series
- tends to have a length which is 1 shorter
For example:
R> x <- ts(1:10)
R> aggregate(x, nfreq=0.5, FUN=min)
Time Series:
Start = 2
End = 8
Frequency = 0.5
[1] 2 4 6 8
S> x <- rts(1:10)
S> aggregate(x, nf=0.5, fun = min)
[1]
2007 Jul 25
3
aggregate.ts
Consider the following scrap of code:
> x<- ts(1:50,start=c(1,11),freq=12)
> y <- aggregate(x,nfreq=4)
> c(y)
[1] 6 15 24 33 42 51 60 69 78 87 96 105 114 123 132 141
> y
Error in rep.int("", start.pad) : invalid number of copies in rep.int()
> tsp(y)
[1] 1.833333 5.583333 4.000000
So we can aggregate into quarters, but we cannot print it using
2007 Jul 25
3
aggregate.ts
Consider the following scrap of code:
> x<- ts(1:50,start=c(1,11),freq=12)
> y <- aggregate(x,nfreq=4)
> c(y)
[1] 6 15 24 33 42 51 60 69 78 87 96 105 114 123 132 141
> y
Error in rep.int("", start.pad) : invalid number of copies in rep.int()
> tsp(y)
[1] 1.833333 5.583333 4.000000
So we can aggregate into quarters, but we cannot print it using
2008 Jan 06
1
aggregate.ts help
Hi,
I have a ts object with a frequency of 4, i.e., quarterly data, and I would
like to calculate the mean for each quarter. So for example:
> ts.data=ts(1:20,start=c(1984,2),frequency=4)
> ts.data
Qtr1 Qtr2 Qtr3 Qtr4
1984 1 2 3
1985 4 5 6 7
1986 8 9 10 11
1987 12 13 14 15
1988 16 17 18 19
1989 20
If I do this manually, the mean
2005 Jan 31
2
changing the time base in a ts
I'm probably apporaching this all wrong to start but....
Suppose I have a monthly time series and I want to compute the mean of
months 6,7, and 8. I want to plot the original time series and the
seasonal time series, one above the other. When I do that as below the
time series don't line up for reasons that are obvious. How can I
change the base of the seasonal time series so I can make
2009 Aug 18
1
aggregating values at discreet irregular time intervals into hourly values
Hello R users,
I'm a newby to R (and programming software at large) and I would need some help to sum up event data at discreet time and irregular time interval into a hourly frequency.
Here is an example of my time series frame (irregular time-serie object - irts in the tseries package):
time value
2008-12-19 19:11:03 GMT 1
2008-12-19 19:12:00 GMT 0
2008-12-19
2004 Sep 22
5
block statistics with POSIX classes
I have a monthly price index series x, the related return series y = diff(log(x)) and a POSIXlt date-time variable dp. I would like to apply annual blocks to compute for example annual block maxima and mean of y.
When studying the POSIX classes, in the first stage of the learning curve, I computed the maximum drawdown of x:
> mdd <- maxdrawdown(x)
> max.dd <- mdd$maxdrawdown
> from
2008 Jun 12
3
Problem with Freq function {prettyR}
Dear list,
I have a problem with freq from prettyR.
Please have a look at my syntax with a litte example:
library(prettyR)
#Version 1
test.df<-data.frame(q1=sample(1:4,8,TRUE), gender=sample(c("f","m"),8,TRUE))
test.df
freq(test.df) #No error message
#Version 2
test.df<-data.frame(gender=sample(c("f","m"),8,TRUE), q1=sample(1:4,8,TRUE))
test.df
2005 May 16
1
Omitting NAs in aggregate.ts()
I have a time series vector (not necessarily ts class) that has NAs in
it.
How can I omit the NAs when using aggregate.ts() to compute a function
on each window? If there is at least one non-NA value in each window,
I'd like to proceed with evaluating the function; otherwise, I would
like NA returned. I'm not wedded to aggregate.ts and don't need ts
class if there is another fast,
2010 Apr 19
1
Issue with aggregate.ts and/or %\% on Windows
I've stumbled across an issue with aggregate.ts that either is due to a
misuse of %/% or something deeper relating to numerical precision on
Windows. The test code is
x <- rep(6:10, 1:5)
as.vector(aggregate(as.ts(x), FUN = mean, ndeltat = 5))
On Linux and Mac I get the correct answer
> x <- rep(6:10, 1:5)
> as.vector(aggregate(as.ts(x), FUN = mean, ndeltat = 5)
[1] 7.2 8.8
2011 Aug 10
0
Setting X-Axis labels in Lattice Barchart
Hello,
I'm attempting to plot out a series of bar charts of recency, frequency and monetary (RFM) scores using recency as a conditioning variable so we can see the details of the FM components. My dataset looks like this:
rfmCellPop{rfm_score, orecency, ofrequency, omonetary, cellpop}
Where rfm_score is the composite score (cellID),
oRecency, oFrequency and oMonetary are the respective
2010 Apr 20
1
bug in aggregate.ts
Hi,
I am getting unexpected behaviour from aggregate.ts(). The 'ndeltat'
argument is effectively being reduced by 1 in some cases, even when it
is an integer, with the result that the blocks to be aggregated are
not of the expected size, and also that the end() of the aggregated
series is much later than the end() of the original series.
rawts <- ts(rep(1:10, each = 5), start = 1)
##
2011 Jan 27
2
Extrapolating values from a glm fit
Dear R-help,
I have fitted a glm logistic function to dichotomous forced choices
responses varying according to time interval between two stimulus. x values
are time separation in miliseconds, and the y values are proportion
responses for one of the stimulus. Now I am trying to extrapolate x values
for the y value (proportion) at .25, .5, and .75. I have tried several
predict parameters, and they
2013 Jun 04
0
Conversión de objeto temporal (TS) a matriz (o data.frame)
Hola:
Ante todo, gracias por las respuestas.
El 03/06/13 01:23, Oscar Perpiñán Lamigueiro escribió:
>
> Hola,
>
> Si no te entiendo mal, necesitas la conversión a matriz como paso
> intermedio para agregar por meses (o cualquier unidad temporal).
¡Hum! No estoy seguro de que agregar sea lo que quiero hacer.
> Si es
> así, te aconsejo que uses el paquete zoo y el método
2004 May 26
0
aggregate.formula
This relates to a message from Christophe Pallier to r-help some time ago.
Like myself, he finds aggregate very useful, but the interface a little
cumbersome. I've implemented a more compact formula interface, found at
the bottom of this message:
data(ToothGrowth)
# I used to aggregate like this:
aggregate(list(len=ToothGrowth$len),
2011 Jan 11
2
aggregate.formula implicitly removes rows containing NA
The documentation for `aggregate` makes it sound like aggregate.formula should behave identically to aggregate.data.frame (apart from the way the parameters are passed). But it looks like aggregate.formula is quietly removing rows where any of the "output" variables (those on the LHS of the formula) are NA. This differs from how aggregate.data.frame works. Is this expected behavior?
2002 May 17
0
aggregate() classing var. def.
Dear all,
I want to aggregate() my data based of the classes of a factors, just as in the
help file, but how do I define the "Region varable" in the ?aggregate example?
Now, the column is just like any other in my data matrix. As I understand it
from ?(state), state contains a matrix with the columns Pop, Income etc., but
Region is somehow separated. I noted below that as.list() is
2011 Sep 15
1
Problems with aggregate() function in stats package
Hi,
I'm having some problems with the aggregate() function in the {stats}
package, and the documentation doesn't address them.
1) Why would the first line work, but the second not? According to the
help file, it accepts a "data=" argument.
> with(tsrc, aggregate(x=DistRatio, by=list(Condition), FUN=mean))
Group.1 x
1 Congruent 1.741789
2 Mismatch 1.771425
2003 Jan 02
1
aggregate: "sum" not meaningful for factors
Dear all,
I try to summarise my data per category using aggregate, but for some
reason I get the error message "sum" not meaningful for factors even though
my vector is numeric. The data set is shown below.
Could someone please give a hint.
Thanks in advance!
Sincerely,
Tord
> names(test)
[1] "ObjektID" "tallstubbyta"
> is.factor(test$ObjektID);
2010 Feb 11
1
aggregate function / custom column names?
This question is about column names returned by the aggregate function. Consider the following example
df <- data.frame(
id = c(rep('11',30),rep('22',30),rep('33',30)),
value = c(rnorm(30,2,0.5), rnorm(30,3,0.5), rnorm(30,6,0.5))
)
aggregate(df[,c("value"),drop=FALSE], by=list(id=df$id), max)
output:
id value
1 11 2.693528
2 22 3.868400
3 33