Title: | Estimate the Correlation Between Two Irregular Time Series |
---|---|
Description: | Estimate the correlation between two irregular time series that are not necessarily sampled on identical time points. This program is also applicable to the situation of two evenly spaced time series that are not on the same time grid. 'BINCOR' is based on a novel estimation approach proposed by Mudelsee (2010, 2014) to estimate the correlation between two climate time series with different timescales. The idea is that autocorrelation (AR1 process) allows to correlate values obtained on different time points. 'BINCOR' contains four functions: bin_cor() (the main function to build the binned time series), plot_ts() (to plot and compare the irregular and binned time series, cor_ts() (to estimate the correlation between the binned time series) and ccf_ts() (to estimate the cross-correlation between the binned time series). |
Authors: | Josué M. Polanco-Martínez [aut, cph, cre], Mikko Korpela [ctb, trl], Aalto University [cph], Manfred Mudelsee [ctb] |
Maintainer: | Josué M. Polanco-Martínez <[email protected]> |
License: | GPL (>= 2) |
Version: | 0.2.0 |
Built: | 2024-11-21 03:03:31 UTC |
Source: | https://github.com/cran/BINCOR |
'BINCOR' estimate the correlation between two irregular
time series that are not necessarily sampled on identical time points.
This program is also applicable to the situation of two evenly spaced
time series that are not on the same time grid. 'BINCOR' is based on
a novel estimation approach proposed by Mudelsee (2010, 2014) to
estimate the correlation between two climate time series with different
timescales. The idea is that autocorrelation (AR1 process) allows to
correlate values obtained on different time points. The outputs (plots)
can be displayed in the screen or can be saved as PNG, JPG or PDF formats.
The 'BINCOR' package also provides two examples with real data: instrumental
(ENSO.dat
and NHSST.dat
data sets) and
paleoclimatic (ID31.dat
and ID32.dat
data sets)
time series to exemplify its use.
Package: | BINCOR |
Type: | Package |
Version: | 0.2 |
Date: | 2018-05-18 |
License: | GPL (>= 2) |
LazyLoad: | yes |
BINCOR package contains four functions: the bin_cor
(the
main function to build the binned time series), the plot_ts
(to plot and compare the irregular and binned time series, the
cor_ts
(to estimate the correlation between the binned
time series) and the ccf_ts
(to estimate the
cross-correlation between the binned time series).
Dependencies: dplR and pracma.
Josué M. Polanco-Martí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: [email protected]
Acknowledgement:
JMPM was funded by a Basque Government post-doctoral fellowship.
Borchers, H. W. (2015). pracma: Practical Numerical Math Functions. R
package version 1.8.8.
URL https://CRAN.R-project.org/package=pracma
Bunn, A., Korpela, M., Biondi, F., Campelo, F., Mérian, P., Qeadan, F.,
Zang, C., Buras, A., Cecile, J., Mudelsee, M., Schulz, M. (2015). Den-
drochronology Program Library in R. R package version 1.6.3.
URL https://CRAN.R-project.org/package=dplR
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ínez, J.M., Medina-Elizalde, M.A., Sánchez Goñ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).
The bin_cor
function convert an irregular time series to
a binned one and its parameters are described in the following lines.
bin_cor(ts1, ts2, FLAGTAU=3, ofilename)
bin_cor(ts1, ts2, FLAGTAU=3, ofilename)
ts1 , ts2
|
ts1 and ts2 are the unevenly spaced time series. |
FLAGTAU |
FLAGTAU defines the method used to estimate the persistence or memory of
the unevenly spaced time series. Options (by default is 3): |
ofilename |
The output filename (ASCII format) containing the binned time series. |
The bin_cor
function convert an irregular times series to
a binned time series and depends on the R dplR package to carry
out this task. dplR (redfitTauest function) estimate the
persistence contained in the irregular climate time series by means of
the method of Mudelsee (2002).
A list of 16 elements:
Binned_time_series |
An object containing the binned time series. |
Auto._cor._coef._ts1 |
The autocorrelation for the binned time series number 1. |
Persistence_ts1 |
The persistence or memory for the binned time series number 1. |
Auto._cor._coef._ts2 |
The autocorrelation for the binned time series number 2. |
Persistence_ts2 |
The persistence or memory for the binned time series number 2. |
bin width |
The bin width. |
Number_of_bins |
The number of bins. |
Average spacing |
The mean value of the times for the binned time series. |
VAR. ts1 |
Variance of ts1 |
VAR. bin ts1 |
Variance of the binned ts1. |
VAR. ts2 |
Variance for ts2. |
VAR. bin ts2 |
Variance of the binned ts2. |
VAR. ts1 - VAR bints1 |
Variance of ts1 minus variance of the binned ts1. |
VAR. ts2 - VAR bints2 |
Variance of ts2 minus variance of the binned ts2. |
% of VAR. lost ts1 |
Percentage of variance lost for ts1. |
% of VAR. lost ts2 |
Percentage of variance lost for ts2. |
Needs dplR (redfitTauest function) to estimate the persistence contained in the irregular time series by means of the method of Mudelsee (2002). Please, look at the code tauest_dplR.R in the directory R of our BINCOR package.
Josué M. Polanco-Martí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: [email protected]
Bunn, A., Korpela, M., Biondi, F., Campelo, F., Mérian, P., Qeadan, F.,
Zang, C., Buras, A., Cecile, J., Mudelsee, M., Schulz, M. (2015).
Dendrochronology Program Library in R. R package version 1.6.3.
URL https://CRAN.R-project.org/package=dplR.
Mudelsee, M. (2002). TAUEST: A computer program for estimating persistence
in unevenly spaced weather/climate time series. Computers & Geosciences 28
(1), 69–72.
URL http://www.climate-risk-analysis.com/software/.
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ínez, J.M., Medina-Elizalde, M.A., Sánchez Goñ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).
##################################################################### #:: Figure 1 D (Polanco-Martínez et al. (2018), (mimeo)). ##################################################################### library("BINCOR") ##################################################################### #:: Loading the time series under analysis: example 1 (ENSO vs. NHSST) ##################################################################### data(ENSO) data(NHSST) ##################################################################### # Testing our bin_cor function ##################################################################### bincor.tmp <- bin_cor(ENSO.dat, NHSST.dat, FLAGTAU=3, "output_ENSO_NHSST.tmp") binnedts <- bincor.tmp$Binned_time_series
##################################################################### #:: Figure 1 D (Polanco-Martínez et al. (2018), (mimeo)). ##################################################################### library("BINCOR") ##################################################################### #:: Loading the time series under analysis: example 1 (ENSO vs. NHSST) ##################################################################### data(ENSO) data(NHSST) ##################################################################### # Testing our bin_cor function ##################################################################### bincor.tmp <- bin_cor(ENSO.dat, NHSST.dat, FLAGTAU=3, "output_ENSO_NHSST.tmp") binnedts <- bincor.tmp$Binned_time_series
The ccf_ts
function estimates and plots the cross-correlation
between the binned time series. ccf_ts
has an
option to remove the linear trend of the time series under analysis (other
pre-processing methods could be used) and contains several parameters that are
described in the following lines.
ccf_ts(bints1, bints2, lagmax=NULL, ylima=-1, ylimb=1, rmltrd="N", RedL=T, device="screen", Hfig, Wfig, Hpdf, Wpdf, resfig, ofilename)
ccf_ts(bints1, bints2, lagmax=NULL, ylima=-1, ylimb=1, rmltrd="N", RedL=T, device="screen", Hfig, Wfig, Hpdf, Wpdf, resfig, ofilename)
bints1 , bints2
|
The bints1 and bints2 are the binned time series. |
lagmax |
This parameter indicates the maximum lag for which the cross-correlation is calculated (its value depends on the length of the data set). |
ylima , ylimb
|
This parameters define the extremes of the range in which the CCF will be plotted. |
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”). |
RedL |
RedL plots a right red line to highlight the correlation coefficient at the lag-0 (the default option is TRUE). |
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 of the binned time series. |
Hfig |
The height for the CCF plot in “jpg” or “png” format. |
Wfig |
The width for the CCF plot in “jpg” or “png”format. |
Hpdf |
The height for the CCF plot in “pdf” format. |
Wpdf |
The width for the CCF plot in “pdf” format. |
resfig |
resfig is the plot resolution in “ppi” (by default R does not record a resolution in the image file, except for BMP) for the CCF plot (“jpg” or “png” formats), an adequate value could be 150 ppi. |
ofilename |
The output filename (CCF plot) for the CCF estimated of the binned time series. |
The ccf_ts
estimate the cross-correlation between two binned
time series by means of the R native function ccf (package:stats).
Output: an object of the form ccf containing the correlation coefficients for the defined number of lags (lagmax) and the statistical significance.
Josué M. Polanco-Martí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: [email protected]
Polanco-Martínez, J.M., Medina-Elizalde, M.A., Sánchez Goñ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).
##################################################################### #:: Figure 5 (Polanco-Martínez et al. (2018), (mimeo)). ##################################################################### library("BINCOR") library("pracma") ##################################################################### #:: Loading the time series under analysis: example 2 (pollen ACER) ##################################################################### data(MD04_2845_siteID31) data(MD95_2039_siteID32) ##################################################################### # Computing the binned time series though our bin_cor function ##################################################################### bincor.tmp <- bin_cor(ID31.dat, ID32.dat, FLAGTAU=3, "salida_ACER_ABRUPT.tmp") binnedts <- bincor.tmp$Binned_time_series # To avoid NA's values bin_ts1 <- na.omit(bincor.tmp$Binned_time_series[,1:2]) bin_ts2 <- na.omit(bincor.tmp$Binned_time_series[,c(1,3)]) ##################################################################### # Testing our ccf_ts function ##################################################################### # Screen ccf_ts(bin_ts1, bin_ts2, RedL=TRUE, rmltrd="y") # PDF format ccf_ts(bin_ts1, bin_ts2, RedL=TRUE, rmltrd="y", device="pdf", Hpdf=6, Wpdf=9, resfig=300, ofilename="ccf_ID31_ID32_res") # JPG format ccf_ts(bin_ts1, bin_ts2, RedL=TRUE, rmltrd="y", device="jpg", Hfig=900, Wfig=1200, resfig=150, ofilename="ccf_ID31_ID32_res")
##################################################################### #:: Figure 5 (Polanco-Martínez et al. (2018), (mimeo)). ##################################################################### library("BINCOR") library("pracma") ##################################################################### #:: Loading the time series under analysis: example 2 (pollen ACER) ##################################################################### data(MD04_2845_siteID31) data(MD95_2039_siteID32) ##################################################################### # Computing the binned time series though our bin_cor function ##################################################################### bincor.tmp <- bin_cor(ID31.dat, ID32.dat, FLAGTAU=3, "salida_ACER_ABRUPT.tmp") binnedts <- bincor.tmp$Binned_time_series # To avoid NA's values bin_ts1 <- na.omit(bincor.tmp$Binned_time_series[,1:2]) bin_ts2 <- na.omit(bincor.tmp$Binned_time_series[,c(1,3)]) ##################################################################### # Testing our ccf_ts function ##################################################################### # Screen ccf_ts(bin_ts1, bin_ts2, RedL=TRUE, rmltrd="y") # PDF format ccf_ts(bin_ts1, bin_ts2, RedL=TRUE, rmltrd="y", device="pdf", Hpdf=6, Wpdf=9, resfig=300, ofilename="ccf_ID31_ID32_res") # JPG format ccf_ts(bin_ts1, bin_ts2, RedL=TRUE, rmltrd="y", device="jpg", Hfig=900, Wfig=1200, resfig=150, ofilename="ccf_ID31_ID32_res")
The cor_ts
function estimates the correlation between the
binned time series. cor_ts
estimates three types of correlation
coefficients: Pearson’s correlation, Spearman’s and Kendall’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.
cor_ts(bints1, bints2, varnamets1="NULL", varnamets2="NULL", KoCM, rmltrd="N", device="screen", Hfig, Wfig, Hpdf, Wpdf, resfig, ofilename)
cor_ts(bints1, bints2, varnamets1="NULL", varnamets2="NULL", KoCM, rmltrd="N", device="screen", Hfig, Wfig, Hpdf, Wpdf, resfig, ofilename)
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é M. Polanco-Martí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: [email protected]
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ínez, J.M., Medina-Elizalde, M.A., Sánchez Goñ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).
##################################################################### #:: Figure 2 (Polanco-Martí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")
##################################################################### #:: Figure 2 (Polanco-Martí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")
The data set ENSO.dat
contains an irregular time series (ENSO)
with 125 data points and an average temporal spacing of 1.24 years covering
the time interval 1850-2006. The ENSO data set come from Mann et al. (2009).
The data sets can be obtained from the following URL http://www.meteo.psu.edu/holocene/public_html/supplements/MultiproxySpatial09/results/
(NINO3 full).
data(ENSO)
data(ENSO)
One file in ASCII format containing 125 elements and two variables (time and ENSO)
http://www.meteo.psu.edu/holocene/public_html/supplements/MultiproxySpatial09/results/
Mann, M. E., Zhang, Z., Rutherford, S., Bradley, R. S., Hughes, M. K., Shindell, D., Ammann, C., Faluvegi, G., Ni, F. (2009). Global signatures and dynamical origins of the Little Ice Age and Medieval Climate Anomaly. Science 326 (5957), 1256–1260.
The data set ID31.dat
contains one paleoclimate
(pollen percentages) time series spanning a time interval between 73,000
and 15,000 years before present (BP), thus covering the last glacial period
(LGP). This data set come from a global pollen and charcoal database
(Sánchez Goñi et al., 2017) developed in the framework of the INQUA
International Focus Group ACER (Abrupt Climate Changes and Environmental
Responses). The paleoclimate time series come from the site MD04-2845 and contains
77 elements (Sánchez Goñi et al., 2008, 2017).
data(MD04_2845_siteID31)
data(MD04_2845_siteID31)
One file in ASCII format containing 77 elements and two variables (time and pollen percentages).
https://doi.pangaea.de/10.1594/PANGAEA.870867
Sánchez Goñi, M. F., Landais, A., Fletcher, W. J., Naughton, F., Desprat, S.,
Duprat, J. (2008). Contrasting impacts of Dansgaard-Oeschger events over
a western European latitudinal transect modulated by orbital parameters.
Quaternary Science Reviews 27 (11), 1136–1151.
Sánchez Goñi, M. F., Desprat, S., Daniau, A.L., Bassinot, F. C.,
Polanco Martínez, J. M., Harrison, S. P., Allen, J. R., Anderson, R. S., Behling,
H., Bonnefille, R., et al. (2017). The ACER pollen and charcoal database: a
global resource to document vegetation and fire response to abrupt climate
changes during the last glacial period. Earth System Science Data 9 (2), 679.
URL https://www.earth-syst-sci-data.net/9/679/2017/.
The data set ID32.dat
contains a paleoclimate
(pollen percentages) time series spanning a time interval between 73,000
and 15,000 years before present (BP), thus covering the last glacial period
(LGP). This data set come from a global pollen and charcoal database
(Sánchez Goñi et al., 2017) developed in the framework of the INQUA
International Focus Group ACER (Abrupt Climate Changes and Environmental
Responses). The time series come from the site MD95-2039 and contains 141
elements (Roucoux et al., 2005; Sánchez Goñi et al., 2017).
data(MD95_2039_siteID32)
data(MD95_2039_siteID32)
One file in ASCII format containing and 141 elements and two variables (time and pollen percentages).
https://doi.pangaea.de/10.1594/PANGAEA.870867
Roucoux, K., De Abreu, L., Shackleton, N., Tzedakis, P. (2005). The response
of NW Iberian vegetation to North Atlantic climate oscillations during the
last 65 kyr. Quaternary Science Reviews 24 (14), 1637–1653.
Sánchez Goñi, M. F., Desprat, S., Daniau, A.L., Bassinot, F. C.,
Polanco Martínez, J. M., Harrison, S. P., Allen, J. R., Anderson, R. S., Behling,
H., Bonnefille, R., et al. (2017). The ACER pollen and charcoal database: a
global resource to document vegetation and fire response to abrupt climate
changes during the last glacial period. Earth System Science Data 9 (2), 679.
URL https://www.earth-syst-sci-data.net/9/679/2017/.
The data set NHSST.dat
contains an irregular time series (NH-SST)
with 125 data points and an average temporal spacing of 1.24 years covering
the time interval 1850-2006. The NH-SST data set come from HadCRUT3 (Brohan et
al., 2006). The data sets can be obtained from the following URL http://www.meteo.psu.edu/holocene/public_html/supplements/MultiproxySpatial09/results/
(Northern Hemisphere full).
data(NHSST)
data(NHSST)
One file in ASCII format containing 125 elements and two variables (time and NHSST)
http://www.meteo.psu.edu/holocene/public_html/supplements/MultiproxySpatial09/results/
Brohan, P., Kennedy, J. J., Harris, I., Tett, S. F., Jones, P. D. (2006). Uncertainty estimates in regional and global observed temperature changes: A new data set from 1850. Journal of Geophysical Research: Atmospheres 111 (D12).
The plot_ts
function plot and compare the irregular
and the binned time series. plot_ts
has
several parameters that are described in the following lines.
plot_ts(ts1, ts2, bints1, bints2, varnamets1="", varnamets2="", colts1=1, colts2=1, colbints1=2, colbints2=2, ltyts1=1, ltyts2=1, ltybints1=2, ltybints2=2, device="screen", Hfig, Wfig, Hpdf, Wpdf, resfig, ofilename)
plot_ts(ts1, ts2, bints1, bints2, varnamets1="", varnamets2="", colts1=1, colts2=1, colbints1=2, colbints2=2, ltyts1=1, ltyts2=1, ltybints1=2, ltybints2=2, device="screen", Hfig, Wfig, Hpdf, Wpdf, resfig, ofilename)
ts1 , ts2
|
ts1 and ts2 are the unevenly spaced time series. |
bints1 , bints2
|
The bints1 and bints2 are the binned time series. |
varnamets1 , varnamets2
|
varnamets[1][2] are the names of the variables under study. |
colts1 , colts2
|
colts[1][2] are the colours for the time series (irregular) under study (by default both curves are in black). |
colbints1 , colbints2
|
colbints[1][2] are the colours of the binned time series (by default both curves are in red). |
ltyts1 , ltyts2
|
ltyts[1][2] are the type of lines to be plotted for the irregular time series (by default is 1, i.e., solid). 1 = solid, 2 = dashed, 3 = dotted, 4 = dot-dashed, 5 = long-dashed, 6 = double-dashed. |
ltybints1 , ltybints2
|
ltybints[1][2] are the type of lines to be plotted for the binned time series (by default is 2, i.e., dashed). 1 = solid, 2 = dashed, 3 = dotted, 4 = dot-dashed, 5 = long-dashed, 6 = double-dashed. |
device |
The type of the output device (by default the option is “screen”, and the other options are “jpg”, “png” and “pdf”). |
Hfig |
The height for the plot in “jpg” or “png” format. |
Wfig |
The width for the plot in “jpg” or “png” format. |
Hpdf |
The height for the plot in “pdf” format. |
Wpdf |
The width for the plot in “pdf” format. |
resfig |
resfig is the plot resolution in 'ppi' (by default R does not record a resolution in the image file, except for BMP), an adequate value could be 150 ppi. |
ofilename |
The output filename for the plot. |
The plot_ts
function is used to plot the irregular vs.
the binned time series and this function uses the native R function “plot”
(package:graphics).
Output:
Output plot: screen or 'ofilename + .png, .jpg or .pdf'.
Josué M. Polanco-Martí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: [email protected]
Polanco-Martínez, J.M., Medina-Elizalde, M.A., Sánchez Goñi, M.F., M. Mudelsee. (2018). BINCOR: an R package to estimate the correlation between two unevenly spaced series. Ms. under review (second round).
##################################################################### #:: Figure 1 (Polanco-Martínez et al. (2018), (mimeo)). ##################################################################### library("BINCOR") ##################################################################### #:: 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.R ##################################################################### bincor.tmp <- bin_cor(ENSO.dat, NHSST.dat, FLAGTAU=3, "output_ENSO_NHSST.tmp") binnedts <- bincor.tmp$Binned_time_series ##################################################################### # Testing our plot_ts function ##################################################################### # "Screen" plot_ts(ENSO.dat, NHSST.dat, binnedts[,1:2], binnedts[,c(1,3)], "ENSO-Nino3", "SST NH Mean", colts1=1, colts2=2, colbints1=3, colbints2=4, device="screen") # PDF format plot_ts(ENSO.dat, NHSST.dat, binnedts[,1:2], binnedts[,c(1,3)], "ENSO-Nino3", "SST NH Mean", colts1=1, colts2=2, colbints1=3, colbints2=4, device="pdf", Hpdf=6, Wpdf=9, resfig=300, ofilename="plot_ts_RAW_BIN_enso_sst") # PNG format plot_ts(ENSO.dat, NHSST.dat, binnedts[,1:2], binnedts[,c(1,3)], "ENSO-Nino3", "SST NH Mean", colts1=1, colts2=2, colbints1=3, colbints2=4, device="png", Hfig=900, Wfig=1200, resfig=150, ofilename="plot_ts_RAW_BIN_enso_sst") ##################################################################### #:: Figure 4 (Polanco-Martínez et al. (2017), (mimeo)). ##################################################################### ##################################################################### #:: Loading the time series under analysis: example 2 (pollen ACER) ##################################################################### data(MD04_2845_siteID31) data(MD95_2039_siteID32) ##################################################################### # Computing the binned time series though our bin_cor function ##################################################################### bincor.tmp <- bin_cor(ID31.dat, ID32.dat, FLAGTAU=3, "salida_ACER_ABRUPT.tmp") binnedts <- bincor.tmp$Binned_time_series # To avoid NA's values bin_ts1 <- na.omit(bincor.tmp$Binned_time_series[,1:2]) bin_ts2 <- na.omit(bincor.tmp$Binned_time_series[,c(1,3)]) ##################################################################### # Testing our plot_ts function: plot_ts.R ##################################################################### # "Screen" plot_ts(ID31.dat, ID32.dat, bin_ts1, bin_ts2, "MD04-2845 (Temp. forest)", "MD95-2039 (Temp. forest )", colts1=1, colts2=2, colbints1=3, colbints2=4, device="screen") # PDF format plot_ts(ID31.dat, ID32.dat, bin_ts1, bin_ts2, "MD04-2845 (Temp. forest)", "MD95-2039 (Temp. forest )", colts1=1, colts2=2, colbints1=3, colbints2=4, device="pdf", Hpdf=6, Wpdf=9, resfig=300, ofilename="ts_ACER_ABRUPT") # PNG format plot_ts(ID31.dat, ID32.dat, bin_ts1, bin_ts2, "MD04-2845 (Temp. forest)", "MD95-2039 (Temp. forest )", colts1=1, colts2=2, colbints1=3, colbints2=4, device="png", Hfig=900, Wfig=1200, resfig=150, ofilename="ts_ACER_ABRUPT")
##################################################################### #:: Figure 1 (Polanco-Martínez et al. (2018), (mimeo)). ##################################################################### library("BINCOR") ##################################################################### #:: 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.R ##################################################################### bincor.tmp <- bin_cor(ENSO.dat, NHSST.dat, FLAGTAU=3, "output_ENSO_NHSST.tmp") binnedts <- bincor.tmp$Binned_time_series ##################################################################### # Testing our plot_ts function ##################################################################### # "Screen" plot_ts(ENSO.dat, NHSST.dat, binnedts[,1:2], binnedts[,c(1,3)], "ENSO-Nino3", "SST NH Mean", colts1=1, colts2=2, colbints1=3, colbints2=4, device="screen") # PDF format plot_ts(ENSO.dat, NHSST.dat, binnedts[,1:2], binnedts[,c(1,3)], "ENSO-Nino3", "SST NH Mean", colts1=1, colts2=2, colbints1=3, colbints2=4, device="pdf", Hpdf=6, Wpdf=9, resfig=300, ofilename="plot_ts_RAW_BIN_enso_sst") # PNG format plot_ts(ENSO.dat, NHSST.dat, binnedts[,1:2], binnedts[,c(1,3)], "ENSO-Nino3", "SST NH Mean", colts1=1, colts2=2, colbints1=3, colbints2=4, device="png", Hfig=900, Wfig=1200, resfig=150, ofilename="plot_ts_RAW_BIN_enso_sst") ##################################################################### #:: Figure 4 (Polanco-Martínez et al. (2017), (mimeo)). ##################################################################### ##################################################################### #:: Loading the time series under analysis: example 2 (pollen ACER) ##################################################################### data(MD04_2845_siteID31) data(MD95_2039_siteID32) ##################################################################### # Computing the binned time series though our bin_cor function ##################################################################### bincor.tmp <- bin_cor(ID31.dat, ID32.dat, FLAGTAU=3, "salida_ACER_ABRUPT.tmp") binnedts <- bincor.tmp$Binned_time_series # To avoid NA's values bin_ts1 <- na.omit(bincor.tmp$Binned_time_series[,1:2]) bin_ts2 <- na.omit(bincor.tmp$Binned_time_series[,c(1,3)]) ##################################################################### # Testing our plot_ts function: plot_ts.R ##################################################################### # "Screen" plot_ts(ID31.dat, ID32.dat, bin_ts1, bin_ts2, "MD04-2845 (Temp. forest)", "MD95-2039 (Temp. forest )", colts1=1, colts2=2, colbints1=3, colbints2=4, device="screen") # PDF format plot_ts(ID31.dat, ID32.dat, bin_ts1, bin_ts2, "MD04-2845 (Temp. forest)", "MD95-2039 (Temp. forest )", colts1=1, colts2=2, colbints1=3, colbints2=4, device="pdf", Hpdf=6, Wpdf=9, resfig=300, ofilename="ts_ACER_ABRUPT") # PNG format plot_ts(ID31.dat, ID32.dat, bin_ts1, bin_ts2, "MD04-2845 (Temp. forest)", "MD95-2039 (Temp. forest )", colts1=1, colts2=2, colbints1=3, colbints2=4, device="png", Hfig=900, Wfig=1200, resfig=150, ofilename="ts_ACER_ABRUPT")
The redfitMinls
function is used by the redfitTauest
function to calculate the persistence for unevenly spaced climate time
series under study. redfitTauest
is included in the
redfit function of the R dplR package (Bunn et al. 2015).
redfitMinls(t, x)
redfitMinls(t, x)
t , x
|
t and x are the times and the variables for an unevenly spaced time series. |
The redfitMinls
function minimize (optimize) by least
squares to obtain some parameters of the AR1 model used to estimate
the persistence through the method of Mudelsee (2002). More information
about redfitMinls
function can be found in Bunn et al.
(2015) and Mudelsee (2002).
Needs dplR to estimate the persistence contained in the irregular time series by means of the method of Mudelsee (2002). Please, for more details look at the code tauest_dplR.R in the directory R of our BINCOR package.
Mikko Korpela.
2013-2015 Aalto University, FINLAND.
Web: https://github.com/mvkorpel.
Email: [email protected]
Bunn, A., Korpela, M., Biondi, F., Campelo, F., Mérian, P., Qeadan, F.,
Zang, C., Buras, A., Cecile, J., Mudelsee, M., Schulz, M. (2015).
Dendrochronology Program Library in R. R package version 1.6.3.
URL https://CRAN.R-project.org/package=dplR.
Mudelsee, M. (2002). TAUEST: A computer program for estimating persistence
in unevenly spaced weather/climate time series. Computers & Geosciences 28
(1), 69–72.
URL http://www.climate-risk-analysis.com/software/.
Schulz, M., Mudelsee M. (2002). REDFIT: estimating red-noise spectra directly
from unevenly spaced paleoclimatic time series. Computers & Geosciences 28(3),
421–426.
URL https://www.marum.de/Michael-Schulz/Michael-Schulz-Software.html.
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.
The redfitTauest
function is used by bin_cor
function to calculate the persistence for irregular climate time
series under study. redfitTauest
is included in the
redfit function that come from the R dplR package
(Bunn et al. 2015).
redfitTauest(t, x)
redfitTauest(t, x)
t , x
|
t and x are the times and the variables for an unevenly spaced time series. |
The redfitTauest
function estimate the persistence of an
irregular times series through the method of Mudelsee (2002).
redfitTauest
function is used by the dplR package
to estimate the persistence contained in irregular climate time
series. More information about redfitTauest
function can
be found in Bunn et al. (2015) and Mudelsee (2002).
Needs dplR to estimate the persistence contained in the irregular time series by means of the method of Mudelsee (2002). Please, look at the code tauest_dplR.R in the directory R of our BINCOR package.
Mikko Korpela .
2013-2015 Aalto University, FINLAND.
Web: https://github.com/mvkorpel.
Email: [email protected]
Bunn, A., Korpela, M., Biondi, F., Campelo, F., Mérian, P., Qeadan, F.,
Zang, C., Buras, A., Cecile, J., Mudelsee, M., Schulz, M. (2015).
Dendrochronology Program Library in R. R package version 1.6.3.
URL https://CRAN.R-project.org/package=dplR.
Mudelsee, M. (2002). TAUEST: A computer program for estimating persistence
in unevenly spaced weather/climate time series. Computers & Geosciences 28
(1), 69–72.
URL http://www.climate-risk-analysis.com/software/.
Schulz, M., Mudelsee M. (2002). REDFIT: estimating red-noise spectra directly
from unevenly spaced paleoclimatic time series. Computers & Geosciences 28(3),
421–426.
URL https://www.marum.de/Michael-Schulz/Michael-Schulz-Software.html.
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.