Description Usage Arguments Details Value Author(s) References Examples
The cor_ts
function estimates the correlation between the
binned time series. cor_ts
estimates three types of correlation
coefficients: Pearson<e2><80><99>s correlation, Spearman<e2><80><99>s and Kendall<e2><80><99>s rank correlations
by means of the R native function cor.test (package:stats). The cor_ts
function has an option to remove the linear trend of the time series under analysis
(other pre-processing methods could be used) and its parameters are
described in the following lines.
1 2 |
bints1, bints2 |
The bints1 and bints2 are the binned time series. |
varnamets1, varnamets2 |
varnamets[1][2] are the names of the variables under study. |
KoCM |
KoCM indicates the correlation estimator: pearson for Pearson (the option by default), spearman for Spearman and kendall for Kendall. |
rmltrd |
This is the option used to remove the linear trend in the time series under study (by default the linear trend is not removed, but it can be activated with the option “Y” or “y”). |
device |
The type of the output device (by default the option is “screen”, and the other options are “jpg”, “png” and “pdf”) for the scatter plot for the binned time series. |
Hfig |
The height for the scatter plot in “jpg” or “png” format. |
Wfig |
The width for the scatter plot in “jpg” or “png” format. |
Hpdf |
The height for the scatter plot in “pdf” format. |
Wpdf |
The width for the scatter plot in “pdf” format. |
resfig |
resfig is the resolution in “ppi” (by default R does not record a resolution in the image file, except for BMP) for the scatter plot (“jpg” or “png” formats), an adequate value could be 150 ppi. |
ofilename |
The output filename for the scatter plot of the binned time series. |
The cor_ts
estimate the correlation between two binned
time series by means of the R native function cor.test (package:stats).
Output: an object of the form cor.test containing the correlation
coefficient and the statistical significance.
Output plot: screen or 'ofilename + .png, .jpg or .pdf'.
Josu<c3><a9> M. Polanco-Mart<c3><ad>nez (a.k.a. jomopo).
BC3 - Basque Centre for Climate Change, Bilbao, SPAIN.
EPOC UMR CNRS 5805 - U. de Bordeaux, Pessac, FRANCE.
Web1: https://scholar.google.es/citations?user=8djLIhcAAAAJ&hl=en.
Web2: http://www.researchgate.net/profile/Josue_Polanco-Martinez.
Email: josue.m.polanco@gmail.com
Mudelsee, M. (2010). Climate Time Series Analysis: Classical Statistical and
Bootstrap Methods. Springer.
Mudelsee, M. (2014). Climate Time Series Analysis: Classical Statistical and
Bootstrap Methods, Second Edition. Springer.
Polanco-Mart<c3><ad>nez, J.M., Medina-Elizalde, M.A., S<c3><a1>nchez Go<c3><b1>i, M.F., M. Mudelsee. (2018). BINCOR: an R package to estimate the correlation between two unevenly spaced time series. Ms. under review (second round).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | #####################################################################
#:: Figure 2 (Polanco-Mart<c3><ad>nez et al. (2018), (mimeo)).
#####################################################################
library("BINCOR")
library("pracma")
#####################################################################
#:: Loading the time series under analysis: example 1 (ENSO vs. NHSST)
#####################################################################
data(ENSO)
data(NHSST)
#####################################################################
# Computing the binned time series though our bin_cor function
#####################################################################
bincor.tmp <- bin_cor(ENSO.dat, NHSST.dat, FLAGTAU=3, "output_ENSO_NHSST.tmp")
binnedts <- bincor.tmp$Binned_time_series
#####################################################################
# Testing our cor_ts function: cor_ts.R
#####################################################################
# screen (scatterplot) and Pearson
cor_ts(binnedts[,1:2], binnedts[,c(1,3)], "ENSO-Nino3", "SST NH Mean",
KoCM="pearson", rmltrd="y")
# PDF format (scatterplot) and Kendall
cor_ts(binnedts[,1:2], binnedts[,c(1,3)], "ENSO-Nino3", "SST NH Mean",
KoCM="kendall", rmltrd="y", device="pdf", Hpdf=6, Wpdf=9, resfig=300,
ofilename="scatterplot_ENSO_SST")
# JPG format (scatterplot) and Spearman
cor_ts( binnedts[,1:2], binnedts[,c(1,3)], "ENSO-Nino3", "SST NH Mean",
KoCM="spearman", rmltrd="y", device="jpg", Hfig=900, Wfig=1200,
resfig=150, ofilename="scatterplot_ENSO_SST")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.