[R-sig-eco] correlating three time-series in R
Bob O'Hara
bohara at senckenberg.de
Wed Jul 26 11:51:38 CEST 2017
You can pass the columns to ccf() directly:
df <- data.frame(x=rnorm(6), y=rnorm(6))
ccf(df$x, df$y)
print(ccf(df$x, df$y))
You should probably also check the time series task view:
<https://cran.r-project.org/web/views/TimeSeries.html>, in particular
the zoo package, to see what can be done with irregular time series.
But with 6 data points I'd be surprised if you have the power to detect
anything that doesn't jump out when you simply plot the data.
Bob
On 26/07/17 11:07, Tania Bird wrote:
> I have three data sets of abundances through time for plants, insects and
> reptiles.
> There are 6 samples over a ten year period (all taxa sampled at the same
> time).
> I recognise this is a small data set for time series.
>
> I would like to correlate the time series to see if
> a) increases in abundance of one taxon are correlated to another, and
> b) to see if the correlation between plants:insects is greater than
> plants:reptiles.
>
> I thought to use the cross-correlation function in R
> e.g. ccf(insects, reptiles)
>
> Currently the data is in one dataframe with time as one column and
> abundance of each taxa is the next three columns.
>
> How do I convert the data to a time.series format as given in the R
> example?
>
> How can I compare the two ccf outputs?
>
> Thanks
>
> Tania
>
>
> Tania Bird MSc
> *"There is a sufficiency in the world for man's need but not for man's
> greed" ~ Mahatma Gandhi*
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-ecology mailing list
> R-sig-ecology at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
>
--
Bob O'Hara
NOTE: this email will die at some point, so please update you records to
bob.ohara at ntnu.no
Institutt for matematiske fag
NTNU
7491 Trondheim
Norway
Mobile: +49 1515 888 5440
Journal of Negative Results - EEB: www.jnr-eeb.org
More information about the R-sig-ecology
mailing list