library(WaveletComp)
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(zoo)
##
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
##
## as.Date, as.Date.numeric
library(ggplot2)
##
## Attaching package: 'ggplot2'
## The following object is masked from 'package:WaveletComp':
##
## arrow
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ forcats 1.0.0 ✔ stringr 1.5.1
## ✔ lubridate 1.9.3 ✔ tibble 3.2.1
## ✔ purrr 1.0.2 ✔ tidyr 1.3.1
## ✔ readr 2.1.5
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ ggplot2::arrow() masks WaveletComp::arrow()
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(forecast)
## Registered S3 method overwritten by 'quantmod':
## method from
## as.zoo.data.frame zoo
library(tidyr)
library(pracma)
##
## Attaching package: 'pracma'
##
## The following object is masked from 'package:purrr':
##
## cross
trim_fun = function(x){
x = x[!is.na(x)] # remove NA
if(length(x) <= 2){
return(NA)
}else{
x1 = sort(x)
x1 = x1[2:(length(x1)-1)] # Remove max values and min values
return(mean(x1))
}
}
Read the dataset containing wastewater data from all ww scan plants across California. We filter the dataset to include only the cities that we are analyzing.
df_all<- read.csv("../output/data_ww_geodata_CA_scan.csv") # Read the dataset
cities = c("Merced","Los Banos", "Modesto", "Turlock", "Davis", "Esparto", "Winters", "Woodland", "Oakland","San Francisco","San Francisco, CA" ) # Define the cities to include in the analysis
df <- df_all %>% filter(City %in% cities)
unique(df$Plant)
## [1] "Winters - East Street Pump Station"
## [2] "City of Davis Wastewater Treatment Plant"
## [3] "Southeast San Francisco"
## [4] "Woodland Water Pollution Control Facility"
## [5] "Esparto Wastewater Treatment Facility"
## [6] "Merced Wastewater Treatment Plant"
## [7] "Turlock Regional Water Quality Control Facility"
## [8] "Los Banos Wastewater Treatment Plant"
## [9] "Oceanside Water Pollution Control Plant"
## [10] "Modesto's Sutter Primary Treatment Facility"
## [11] "East Bay Municipal Utility District"
unique(df$City)
## [1] "Winters" "Davis" "San Francisco"
## [4] "Woodland" "Esparto" "Merced"
## [7] "Turlock" "Los Banos" "San Francisco, CA"
## [10] "Modesto" "Oakland"
In order to make sure that the wavelet function from the WaveletComp library works properly, we calculate the trimmed average of the data, which results in daily data. This is important because the wavelet function doesn’t work well with datasets that have missing data. We are using data from December 7, 2012, to December 1, 2023.
save_path <- "../output/"
df <- df %>% group_by(Plant) %>% mutate(SC2_N_out = tsclean(SC2_Norm, replace.missing=F), SC2_N_av10 = rollapply(SC2_N_out,width=10, mean, align="center",fill=NA, na.rm=T))
df <- df %>% filter(Date >= as.Date('2022-12-07') & Date <= as.Date('2023-12-01'))
df <- df %>% group_by(Plant) %>% mutate(SC2_N_av10 =coredata( na.approx(SC2_N_av10))) # replace NA values with interpolated values.
df$Date <- as.Date(df$Date)
ggplot(df, aes(x = Date, y = SC2_N_av10, color = City)) + geom_line() + labs(x = "Date", y = "SC2_Norm", title = "SC2_Norm by City")
We reshape the data to have each column representing a city, where the
data within each column corresponds to the 10-day moving average for
that city.
df <- df[, c("Date", "City", "SC2_N_av10")]
my.data <- df %>% pivot_wider(names_from = City, values_from = "SC2_N_av10")
days <- seq(from = as.Date( min(my.data$Date)), to = as.Date( max(my.data$Date)), by = "day")
#cities_ = c("Merced","Los_Banos", "Modesto", "Turlock", "Davis", "Esparto", "Winters", "Woodland", "Oakland","San_Francisco_south","San Francisco" )
plot_sel_city = function(city1, city2){
filtered_df <- df[df$City %in% c(city1, city2), ]
ggplot(filtered_df, aes(x = Date, y = SC2_N_av10, color = City)) +
geom_line() +
labs(x = "Date", y = "SC2_N_av10", title = "SC2_N_av10 by City")}
my.data
## # A tibble: 360 × 12
## Date Winters Davis `San Francisco` Woodland Esparto Merced Turlock
## <date> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 2022-12-07 0.000176 0.000329 0.000515 0.000233 1.11e-4 1.18e-4 3.19e-4
## 2 2022-12-08 0.000204 0.000308 0.000538 0.000233 1.11e-4 1.18e-4 3.19e-4
## 3 2022-12-09 0.000204 0.000298 0.000530 0.000200 1.13e-4 1.03e-4 3.26e-4
## 4 2022-12-10 0.000204 0.000305 0.000532 0.000221 1.02e-4 9.58e-5 3.02e-4
## 5 2022-12-11 0.000159 0.000292 0.000543 0.000181 1.04e-4 9.56e-5 2.75e-4
## 6 2022-12-12 0.000159 0.000301 0.000537 0.000166 1.15e-4 9.61e-5 2.58e-4
## 7 2022-12-13 0.000159 0.000296 0.000498 0.000166 1.15e-4 9.61e-5 2.58e-4
## 8 2022-12-14 0.000165 0.000283 0.000510 0.000134 1.81e-4 8.31e-5 1.90e-4
## 9 2022-12-15 0.000165 0.000274 0.000484 0.000134 1.81e-4 8.31e-5 1.90e-4
## 10 2022-12-16 0.000175 0.000284 0.000529 0.000137 1.69e-4 8.35e-5 2.09e-4
## # ℹ 350 more rows
## # ℹ 4 more variables: `Los Banos` <dbl>, `San Francisco, CA` <dbl>,
## # Modesto <dbl>, Oakland <dbl>
We compute the wavelet power spectrum for the cities in this study. The wavelet transform decomposes a time series into both time and frequency components. The wavelet power spectrum represents the energy distribution of a signal across different scales (or time periods). Peaks in the wavelet power spectrum indicate significant energy at specific scales (frequencies).
In the following example for San Francisco, CA, the visualization shows that the power spectrum is higher around the periods of approximately 128 and 70 days. Areas of higher spectrum power are depicted in red. This indicates that the wastewater data for this city exhibits periodic components, with notable patterns repeating approximately every 128 days and every 70 days.
# upperPeriod = 128
city= 'San Francisco, CA'
my.w <- analyze.wavelet(my.data, city, loess.span = 0, dt = 1, dj = 1/250, lowerPeriod = 16, upperPeriod = 256,
make.pval = TRUE, n.sim = 10)
## Starting wavelet transformation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave Phase Ampl Power Power.avg Power.pval Power.avg.pval Ridge Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
wt.image(my.w, color.key = "quantile", n.levels = 250, legend.params = list(lab = "wavelet power levels"),
periodlab = "periods (days)", show.date = TRUE, date.format = "%Y-%m-%d", timelab = "", main= city)
## Warning in wt.image(my.w, color.key = "quantile", n.levels = 250, legend.params = list(lab = "wavelet power levels"), :
## Please check your calendar dates, format and time zone: dates may not be in an unambiguous format or chronological. The default numerical axis was used instead.
# 1/250: In this case we are analyzing the periods from 2^4 to 2 ^7(i.e., from 16 to 128). Each octave ([16, 32], [32, 64], [64, 128]) is divided into 250 suboctaves.With dj = 1/250, there will be 250 suboctaves per octave. This results in very fine spacing between each period value.
plot(my.data$'San Francisco, CA')
my.rec <- reconstruct(my.w)
## Your input object class is 'analyze.wavelet'...
## Your time series 'San Francisco, CA' will be reconstructed...
## Starting the reconstruction process...
## Original (detrended) and reconstructed series are being plotted...
## Class attributes are accessible through following names:
## series rec.waves loess.span lvl only.coi only.sig siglvl only.ridge rnum.used rescale dt dj Period Scale nc nr axis.1 axis.2 date.format date.tz
We computed the wavelet power averaged spectrum for the cities in this study. This involves calculating the mean power over all periods, making it easier to compare the common periods shared by the cities and their average strengths. In the following plot, we can observe that most cities have significant periodicities around 90, 130, and 170 days.
plot_periods <- function() {
colors <- c("blue", "red", "green", "orange", "purple", "brown", "black", "magenta", "cyan", "yellow", "gray", "pink")
my.wx <- analyze.wavelet(my.data, cities[1], loess.span = 0, dt = 1, dj = 1/250,
lowerPeriod = 16, upperPeriod = 256,make.pval = TRUE, n.sim = 10)
# Adjust the plot margins to make space for the legend
par(mar = c(5, 4, 4, 8) + 0.1)
plot(my.wx$Period, my.wx$Power.avg, type = "l", col = "blue", xlab = "Period", ylab = "Wavelet Power",
main = "Wavelet Power Averaged over Scales", lwd = 2)
for (i in 2:length(cities)){
my.wy <- analyze.wavelet(my.data, cities[i], loess.span = 0, dt = 1, dj = 1/250, lowerPeriod = 16, upperPeriod = 256,
make.pval = TRUE, n.sim = 10)
lines(my.wy$Period, my.wy$Power.avg, col = colors[i], lwd = 2)
}
# Add the legend outside the plot area
par(xpd=TRUE)
legend("topright", inset = c(-0.2, 0), legend = cities[1:length(cities)],
lty = 1, lwd = 2, col = colors[1:length(cities)], cex = 0.7)
}
plot_periods()
## Starting wavelet transformation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave Phase Ampl Power Power.avg Power.pval Power.avg.pval Ridge Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Starting wavelet transformation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave Phase Ampl Power Power.avg Power.pval Power.avg.pval Ridge Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Starting wavelet transformation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave Phase Ampl Power Power.avg Power.pval Power.avg.pval Ridge Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Starting wavelet transformation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave Phase Ampl Power Power.avg Power.pval Power.avg.pval Ridge Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Starting wavelet transformation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave Phase Ampl Power Power.avg Power.pval Power.avg.pval Ridge Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Starting wavelet transformation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave Phase Ampl Power Power.avg Power.pval Power.avg.pval Ridge Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Starting wavelet transformation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave Phase Ampl Power Power.avg Power.pval Power.avg.pval Ridge Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Starting wavelet transformation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave Phase Ampl Power Power.avg Power.pval Power.avg.pval Ridge Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Starting wavelet transformation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave Phase Ampl Power Power.avg Power.pval Power.avg.pval Ridge Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Starting wavelet transformation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave Phase Ampl Power Power.avg Power.pval Power.avg.pval Ridge Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Starting wavelet transformation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave Phase Ampl Power Power.avg Power.pval Power.avg.pval Ridge Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
To identify the significant periods in each time series, we computed the peaks for each series and then sorted them. This allows us to determine which cities have comparable periodicities and identify the periods they share.
#Returns a matrix where each row represents one peak found. The first column gives the height, the second the position/index where the maximum is reached, the third and forth the indices of where the peak begins and ends --- in the sense of where the pattern starts and ends.
#find_peaks <- function() {
compute_peaks<- function(){
peaks_list <- list() # Create an empty list to store peaks data for each city
# Loop through cities
for (i in 1:length(cities)){
my.wx <- analyze.wavelet(my.data, cities[i], loess.span = 0, dt = 1, dj = 1/250,
lowerPeriod = 16, upperPeriod = 256, make.pval = TRUE, n.sim = 10)
# Find peaks for Power.avg
peaks <- findpeaks(my.wx$Power.avg, threshold = 0) # You may adjust the threshold as needed
#print(peaks[,2])
#print(my.wx$Period[peaks[,2]])
peaks_list[[cities[i]]] <- my.wx$Period[peaks[,2]]
#print(peaks[,2])
}
return(peaks_list)}
peaks_list=compute_peaks()
## Starting wavelet transformation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave Phase Ampl Power Power.avg Power.pval Power.avg.pval Ridge Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Starting wavelet transformation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave Phase Ampl Power Power.avg Power.pval Power.avg.pval Ridge Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Starting wavelet transformation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave Phase Ampl Power Power.avg Power.pval Power.avg.pval Ridge Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Starting wavelet transformation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave Phase Ampl Power Power.avg Power.pval Power.avg.pval Ridge Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Starting wavelet transformation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave Phase Ampl Power Power.avg Power.pval Power.avg.pval Ridge Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Starting wavelet transformation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave Phase Ampl Power Power.avg Power.pval Power.avg.pval Ridge Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Starting wavelet transformation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave Phase Ampl Power Power.avg Power.pval Power.avg.pval Ridge Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Starting wavelet transformation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave Phase Ampl Power Power.avg Power.pval Power.avg.pval Ridge Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Starting wavelet transformation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave Phase Ampl Power Power.avg Power.pval Power.avg.pval Ridge Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Starting wavelet transformation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave Phase Ampl Power Power.avg Power.pval Power.avg.pval Ridge Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Starting wavelet transformation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave Phase Ampl Power Power.avg Power.pval Power.avg.pval Ridge Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
lis=c(15,25,35, 45,55,65,75,85,95, 105, 115, 125, 175, 255)
peaks_list
## $Merced
## [1] 18.94835 32.99099 66.90305 99.18156 177.53996
##
## $`Los Banos`
## [1] 19.80784 31.29803 48.77263 117.13269
##
## $Modesto
## [1] 18.68748 28.72032 86.10350 130.87085 174.12747 255.29120
##
## $Turlock
## [1] 17.19599 45.00458 87.06373 126.93974 175.58186 255.29120
##
## $Davis
## [1] 32.62713 60.21287 129.06911
##
## $Esparto
## [1] 24.52192 52.12848 83.98152 126.58828
##
## $Winters
## [1] 32.62713 60.21287 70.52193 122.44584 175.58186
##
## $Woodland
## [1] 29.77439 82.82532 127.64560
##
## $Oakland
## [1] 18.73936 36.65657 63.29414 127.29218
##
## $`San Francisco`
## [1] 17.10090 27.85762 52.85617 82.36731 125.53971
##
## $`San Francisco, CA`
## [1] 21.28846 30.44218 83.98152 125.19212 173.64535 255.29120
The results are summarized in the following table, which lists the peaks for each city.
# Function to fill the result data frame
fill_peaks <- function(peaks) {
bin_edges<-c(10,25, 40,50,60,70,80,90, 120, 170, 255)
result <- data.frame(
City = names(peaks),
stringsAsFactors = FALSE)
for (i in seq_along(peaks)) {
city <- names(peaks)[i]
peak_values <- peaks[[i]]
for (j in seq_along(peak_values)) {
peak <- peak_values[j]
bin_index <- findInterval(peak, bin_edges)
# Create the column if it does not exist
col_name <- as.character(bin_index)
if (!col_name %in% colnames(result)) {
result[[col_name]] <- NA
}
result[i, col_name] <- peak
}
}
return(result) }
# Fill the result data frame
result <- fill_peaks(peaks_list)
# Order columns to ensure they are in the correct sequence
result <- result[, c("City", sort(as.numeric(setdiff(colnames(result), "City"))))]
# Print the result
print(result)
## City 1 2 3 4 5 6
## 1 Merced 18.94835 32.99099 NA NA 66.90305 NA
## 2 Los Banos 19.80784 31.29803 48.77263 NA NA NA
## 3 Modesto 18.68748 28.72032 NA NA NA NA
## 4 Turlock 17.19599 NA 45.00458 NA NA NA
## 5 Davis NA 32.62713 NA NA 60.21287 NA
## 6 Esparto 24.52192 NA NA 52.12848 NA NA
## 7 Winters NA 32.62713 NA NA 60.21287 70.52193
## 8 Woodland NA 29.77439 NA NA NA NA
## 9 Oakland 18.73936 36.65657 NA NA 63.29414 NA
## 10 San Francisco 17.10090 27.85762 NA 52.85617 NA NA
## 11 San Francisco, CA 21.28846 30.44218 NA NA NA NA
## 7 8 9 10 11
## 1 NA 99.18156 NA 177.5400 NA
## 2 NA 117.13269 NA NA NA
## 3 86.10350 NA 130.8709 174.1275 255.2912
## 4 87.06373 NA 126.9397 175.5819 255.2912
## 5 NA NA 129.0691 NA NA
## 6 83.98152 NA 126.5883 NA NA
## 7 NA NA 122.4458 175.5819 NA
## 8 82.82532 NA 127.6456 NA NA
## 9 NA NA 127.2922 NA NA
## 10 82.36731 NA 125.5397 NA NA
## 11 83.98152 NA 125.1921 173.6454 255.2912
#knitr::kable(result)
We compute the mean for column to have mean by similar periods
means <- colMeans(result[,-1], na.rm = TRUE)
# Print the means
means
## 1 2 3 4 5 6 7 8
## 19.53629 31.44382 46.88861 52.49233 62.65573 70.52193 84.38715 108.15713
## 9 10 11
## 126.84261 175.29530 255.29120
We will analyze periods around 80, 120, and 170 days because many cities exhibit these periods in their decomposition. We exclude periods around 30 days, despite their common occurrence across cities, as variations in shorter periods may not be related to the disease.
To analyze these selected periods, we filtered cities that exhibit periods close to them. Using these periods, we compared the cities and categorized them into three sets, each corresponding to one of the periods. We computed the mean period for each group and utilized it for phase difference analysis.
means <- colMeans(result[,-1], na.rm = TRUE)
# Print the means
print(means)
## 1 2 3 4 5 6 7 8
## 19.53629 31.44382 46.88861 52.49233 62.65573 70.52193 84.38715 108.15713
## 9 10 11
## 126.84261 175.29530 255.29120
#result <- rbind(result, c("Mean", means))
cities_1= result[!is.na(result$`7`), ]$City
cities_2= result[!is.na(result$`9`), ]$City
cities_3= result[!is.na(result$`10`), ]$City
per1 = means['7']
per2 = means['9']
per3= means['10']
cities_1
## [1] "Modesto" "Turlock" "Esparto"
## [4] "Woodland" "San Francisco" "San Francisco, CA"
We compute the cross-wavelet power spectrum in the time-period domain for each pair of cities. This plot helps us understand the correlation between the time series data of two cities in terms of periodic components.
#city1= "Esparto"
#city2= "Turlock"
# Computes coherence between two cities using wavelet analysis
compute_coherence <- function(city1, city2){
my.wc <- analyze.coherency(my.data, my.pair = c(city1, city2),
loess.span = 0,
dt = 1, dj = 1/100, lowerPeriod=10 , upperPeriod = 250,
make.pval = TRUE, n.sim = 10)
wc.image(my.wc, n.levels = 250,
legend.params = list(lab = "cross-wavelet power levels"),
periodlab = "period (days)",
show.date = TRUE,
date.format = "%Y-%m-%d", main = paste(city1, ' vs. ', city2))
# Uncomment below to visualize wavelet coherence levels
#wc.image(my.wc, which.image = "wc", color.key = "interval", n.levels = 250,
# siglvl.contour = 0.1, siglvl.arrow = 0.05,
# legend.params = list(lab = "wavelet coherence levels",main = paste(city1, ' vs. ', city2)),
# timelab = "", main = paste(city1, ' vs. ', city2))
return (my.wc)
}
# Computes coherence for all pairwise combinations of cities in cities_k
compute_coherence_by_group <- function(cities_k){
for ( i in 1:(length(cities_k)-1)){
for (j in (i + 1):length(cities_k)) {
city1 <- cities_k[i]
city2 <- cities_k[j]
print(paste(city1, '', city2))
compute_coherence(city1, city2)
}
}
}
compute_coherence_by_group(cities_1)
## [1] "Modesto Turlock"
## Starting wavelet transformation and coherency computation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave.xy Angle sWave.xy sAngle Power.xy Power.xy.avg Power.xy.pval Power.xy.avg.pval Coherency Coherence Coherence.avg Coherence.pval Coherence.avg.pval Wave.x Wave.y Phase.x Phase.y Ampl.x Ampl.y Power.x Power.y Power.x.avg Power.y.avg Power.x.pval Power.y.pval Power.x.avg.pval Power.y.avg.pval sPower.x sPower.y Ridge.xy Ridge.co Ridge.x Ridge.y Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Warning in wc.image(my.wc, n.levels = 250, legend.params = list(lab = "cross-wavelet power levels"), :
## Please check your calendar dates, format and time zone: dates may not be in an unambiguous format or chronological. The default numerical axis was used instead.
## [1] "Modesto Esparto"
## Starting wavelet transformation and coherency computation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave.xy Angle sWave.xy sAngle Power.xy Power.xy.avg Power.xy.pval Power.xy.avg.pval Coherency Coherence Coherence.avg Coherence.pval Coherence.avg.pval Wave.x Wave.y Phase.x Phase.y Ampl.x Ampl.y Power.x Power.y Power.x.avg Power.y.avg Power.x.pval Power.y.pval Power.x.avg.pval Power.y.avg.pval sPower.x sPower.y Ridge.xy Ridge.co Ridge.x Ridge.y Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Warning in wc.image(my.wc, n.levels = 250, legend.params = list(lab = "cross-wavelet power levels"), :
## Please check your calendar dates, format and time zone: dates may not be in an unambiguous format or chronological. The default numerical axis was used instead.
## [1] "Modesto Woodland"
## Starting wavelet transformation and coherency computation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave.xy Angle sWave.xy sAngle Power.xy Power.xy.avg Power.xy.pval Power.xy.avg.pval Coherency Coherence Coherence.avg Coherence.pval Coherence.avg.pval Wave.x Wave.y Phase.x Phase.y Ampl.x Ampl.y Power.x Power.y Power.x.avg Power.y.avg Power.x.pval Power.y.pval Power.x.avg.pval Power.y.avg.pval sPower.x sPower.y Ridge.xy Ridge.co Ridge.x Ridge.y Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Warning in wc.image(my.wc, n.levels = 250, legend.params = list(lab = "cross-wavelet power levels"), :
## Please check your calendar dates, format and time zone: dates may not be in an unambiguous format or chronological. The default numerical axis was used instead.
## [1] "Modesto San Francisco"
## Starting wavelet transformation and coherency computation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave.xy Angle sWave.xy sAngle Power.xy Power.xy.avg Power.xy.pval Power.xy.avg.pval Coherency Coherence Coherence.avg Coherence.pval Coherence.avg.pval Wave.x Wave.y Phase.x Phase.y Ampl.x Ampl.y Power.x Power.y Power.x.avg Power.y.avg Power.x.pval Power.y.pval Power.x.avg.pval Power.y.avg.pval sPower.x sPower.y Ridge.xy Ridge.co Ridge.x Ridge.y Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Warning in wc.image(my.wc, n.levels = 250, legend.params = list(lab = "cross-wavelet power levels"), :
## Please check your calendar dates, format and time zone: dates may not be in an unambiguous format or chronological. The default numerical axis was used instead.
## [1] "Modesto San Francisco, CA"
## Starting wavelet transformation and coherency computation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave.xy Angle sWave.xy sAngle Power.xy Power.xy.avg Power.xy.pval Power.xy.avg.pval Coherency Coherence Coherence.avg Coherence.pval Coherence.avg.pval Wave.x Wave.y Phase.x Phase.y Ampl.x Ampl.y Power.x Power.y Power.x.avg Power.y.avg Power.x.pval Power.y.pval Power.x.avg.pval Power.y.avg.pval sPower.x sPower.y Ridge.xy Ridge.co Ridge.x Ridge.y Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Warning in wc.image(my.wc, n.levels = 250, legend.params = list(lab = "cross-wavelet power levels"), :
## Please check your calendar dates, format and time zone: dates may not be in an unambiguous format or chronological. The default numerical axis was used instead.
## [1] "Turlock Esparto"
## Starting wavelet transformation and coherency computation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave.xy Angle sWave.xy sAngle Power.xy Power.xy.avg Power.xy.pval Power.xy.avg.pval Coherency Coherence Coherence.avg Coherence.pval Coherence.avg.pval Wave.x Wave.y Phase.x Phase.y Ampl.x Ampl.y Power.x Power.y Power.x.avg Power.y.avg Power.x.pval Power.y.pval Power.x.avg.pval Power.y.avg.pval sPower.x sPower.y Ridge.xy Ridge.co Ridge.x Ridge.y Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Warning in wc.image(my.wc, n.levels = 250, legend.params = list(lab = "cross-wavelet power levels"), :
## Please check your calendar dates, format and time zone: dates may not be in an unambiguous format or chronological. The default numerical axis was used instead.
## [1] "Turlock Woodland"
## Starting wavelet transformation and coherency computation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave.xy Angle sWave.xy sAngle Power.xy Power.xy.avg Power.xy.pval Power.xy.avg.pval Coherency Coherence Coherence.avg Coherence.pval Coherence.avg.pval Wave.x Wave.y Phase.x Phase.y Ampl.x Ampl.y Power.x Power.y Power.x.avg Power.y.avg Power.x.pval Power.y.pval Power.x.avg.pval Power.y.avg.pval sPower.x sPower.y Ridge.xy Ridge.co Ridge.x Ridge.y Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Warning in wc.image(my.wc, n.levels = 250, legend.params = list(lab = "cross-wavelet power levels"), :
## Please check your calendar dates, format and time zone: dates may not be in an unambiguous format or chronological. The default numerical axis was used instead.
## [1] "Turlock San Francisco"
## Starting wavelet transformation and coherency computation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave.xy Angle sWave.xy sAngle Power.xy Power.xy.avg Power.xy.pval Power.xy.avg.pval Coherency Coherence Coherence.avg Coherence.pval Coherence.avg.pval Wave.x Wave.y Phase.x Phase.y Ampl.x Ampl.y Power.x Power.y Power.x.avg Power.y.avg Power.x.pval Power.y.pval Power.x.avg.pval Power.y.avg.pval sPower.x sPower.y Ridge.xy Ridge.co Ridge.x Ridge.y Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Warning in wc.image(my.wc, n.levels = 250, legend.params = list(lab = "cross-wavelet power levels"), :
## Please check your calendar dates, format and time zone: dates may not be in an unambiguous format or chronological. The default numerical axis was used instead.
## [1] "Turlock San Francisco, CA"
## Starting wavelet transformation and coherency computation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave.xy Angle sWave.xy sAngle Power.xy Power.xy.avg Power.xy.pval Power.xy.avg.pval Coherency Coherence Coherence.avg Coherence.pval Coherence.avg.pval Wave.x Wave.y Phase.x Phase.y Ampl.x Ampl.y Power.x Power.y Power.x.avg Power.y.avg Power.x.pval Power.y.pval Power.x.avg.pval Power.y.avg.pval sPower.x sPower.y Ridge.xy Ridge.co Ridge.x Ridge.y Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Warning in wc.image(my.wc, n.levels = 250, legend.params = list(lab = "cross-wavelet power levels"), :
## Please check your calendar dates, format and time zone: dates may not be in an unambiguous format or chronological. The default numerical axis was used instead.
## [1] "Esparto Woodland"
## Starting wavelet transformation and coherency computation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave.xy Angle sWave.xy sAngle Power.xy Power.xy.avg Power.xy.pval Power.xy.avg.pval Coherency Coherence Coherence.avg Coherence.pval Coherence.avg.pval Wave.x Wave.y Phase.x Phase.y Ampl.x Ampl.y Power.x Power.y Power.x.avg Power.y.avg Power.x.pval Power.y.pval Power.x.avg.pval Power.y.avg.pval sPower.x sPower.y Ridge.xy Ridge.co Ridge.x Ridge.y Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Warning in wc.image(my.wc, n.levels = 250, legend.params = list(lab = "cross-wavelet power levels"), :
## Please check your calendar dates, format and time zone: dates may not be in an unambiguous format or chronological. The default numerical axis was used instead.
## [1] "Esparto San Francisco"
## Starting wavelet transformation and coherency computation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave.xy Angle sWave.xy sAngle Power.xy Power.xy.avg Power.xy.pval Power.xy.avg.pval Coherency Coherence Coherence.avg Coherence.pval Coherence.avg.pval Wave.x Wave.y Phase.x Phase.y Ampl.x Ampl.y Power.x Power.y Power.x.avg Power.y.avg Power.x.pval Power.y.pval Power.x.avg.pval Power.y.avg.pval sPower.x sPower.y Ridge.xy Ridge.co Ridge.x Ridge.y Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Warning in wc.image(my.wc, n.levels = 250, legend.params = list(lab = "cross-wavelet power levels"), :
## Please check your calendar dates, format and time zone: dates may not be in an unambiguous format or chronological. The default numerical axis was used instead.
## [1] "Esparto San Francisco, CA"
## Starting wavelet transformation and coherency computation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave.xy Angle sWave.xy sAngle Power.xy Power.xy.avg Power.xy.pval Power.xy.avg.pval Coherency Coherence Coherence.avg Coherence.pval Coherence.avg.pval Wave.x Wave.y Phase.x Phase.y Ampl.x Ampl.y Power.x Power.y Power.x.avg Power.y.avg Power.x.pval Power.y.pval Power.x.avg.pval Power.y.avg.pval sPower.x sPower.y Ridge.xy Ridge.co Ridge.x Ridge.y Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Warning in wc.image(my.wc, n.levels = 250, legend.params = list(lab = "cross-wavelet power levels"), :
## Please check your calendar dates, format and time zone: dates may not be in an unambiguous format or chronological. The default numerical axis was used instead.
## [1] "Woodland San Francisco"
## Starting wavelet transformation and coherency computation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave.xy Angle sWave.xy sAngle Power.xy Power.xy.avg Power.xy.pval Power.xy.avg.pval Coherency Coherence Coherence.avg Coherence.pval Coherence.avg.pval Wave.x Wave.y Phase.x Phase.y Ampl.x Ampl.y Power.x Power.y Power.x.avg Power.y.avg Power.x.pval Power.y.pval Power.x.avg.pval Power.y.avg.pval sPower.x sPower.y Ridge.xy Ridge.co Ridge.x Ridge.y Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Warning in wc.image(my.wc, n.levels = 250, legend.params = list(lab = "cross-wavelet power levels"), :
## Please check your calendar dates, format and time zone: dates may not be in an unambiguous format or chronological. The default numerical axis was used instead.
## [1] "Woodland San Francisco, CA"
## Starting wavelet transformation and coherency computation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave.xy Angle sWave.xy sAngle Power.xy Power.xy.avg Power.xy.pval Power.xy.avg.pval Coherency Coherence Coherence.avg Coherence.pval Coherence.avg.pval Wave.x Wave.y Phase.x Phase.y Ampl.x Ampl.y Power.x Power.y Power.x.avg Power.y.avg Power.x.pval Power.y.pval Power.x.avg.pval Power.y.avg.pval sPower.x sPower.y Ridge.xy Ridge.co Ridge.x Ridge.y Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Warning in wc.image(my.wc, n.levels = 250, legend.params = list(lab = "cross-wavelet power levels"), :
## Please check your calendar dates, format and time zone: dates may not be in an unambiguous format or chronological. The default numerical axis was used instead.
## [1] "San Francisco San Francisco, CA"
## Starting wavelet transformation and coherency computation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave.xy Angle sWave.xy sAngle Power.xy Power.xy.avg Power.xy.pval Power.xy.avg.pval Coherency Coherence Coherence.avg Coherence.pval Coherence.avg.pval Wave.x Wave.y Phase.x Phase.y Ampl.x Ampl.y Power.x Power.y Power.x.avg Power.y.avg Power.x.pval Power.y.pval Power.x.avg.pval Power.y.avg.pval sPower.x sPower.y Ridge.xy Ridge.co Ridge.x Ridge.y Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Warning in wc.image(my.wc, n.levels = 250, legend.params = list(lab = "cross-wavelet power levels"), :
## Please check your calendar dates, format and time zone: dates may not be in an unambiguous format or chronological. The default numerical axis was used instead.
Now, we utilize the previously computed periods to compare cities within each group across different frequencies, assessing the lead time between their signals using the sel.phase function
# Function to compute phase difference between two cities for a specific period
compute_phase_diff <- function(city1, city2, per){
my.wc <- analyze.coherency(my.data, my.pair = c(city1, city2),
loess.span = 0,
dt = 1, dj = 1/100, lowerPeriod=10 , upperPeriod = 250,
make.pval = TRUE, n.sim = 10)
at.ticks <- seq(from = -pi, to = pi, by = pi/4)
label.ticks <- (at.ticks/pi)*(per/2)
# Compute phases for the selected period
phases<-wc.sel.phases(my.wc, sel.period = per, only.sig = TRUE,
which.sig = "wt",
siglvl = 0.05,
phaselim = c(-pi,+pi),
phaselab = "phases (time units)",
spec.phase.axis = list(at = at.ticks, labels = label.ticks),
legend.coords = "topright", legend.horiz = FALSE,
main = paste(city1, ' vs. ', city2), sub = "", timelab = "")
phase_diff=phases$Phase.x-phases$Phase.y
days_lead <- phase_diff / (2 * pi) * per
#days_lead
#plot(days_lead )
trimmed_days_lead <- mean(days_lead, trim = 0.1)
#if (trimmed_days_lead < 0) {
# print(paste(city2, 'leads by', abs(trimmed_days_lead), 'days in the period ', per))
#} else {
# print(paste(city1, 'leads by', trimmed_days_lead, 'days in the period ', per))
#}
return(trimmed_days_lead)
}
# Function to compute phase differences for all pairs of cities in a group
compute_phase_diff_by_group<-function(cities_k, perk){
results_df <- data.frame(city1 = character(), city2 = character(), days_lead = numeric(), stringsAsFactors = FALSE)
for (i in 1:(length(cities_k) - 1)) {
for (j in (i + 1):length(cities_k)) {
city1_ <- cities_k[i]
city2_ <- cities_k[j]
days_lead <- compute_phase_diff(city1_, city2_, perk)
# Add the result to the dataframe
results_df <- rbind(results_df, data.frame(city1 = city1_, city2 = city2_, days_lead = days_lead))
}
}
# Display the results
return(results_df)
}
Differences between wastewater signals in the period 84.3871517
df_phases1=compute_phase_diff_by_group(cities_1, per1)
## Starting wavelet transformation and coherency computation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave.xy Angle sWave.xy sAngle Power.xy Power.xy.avg Power.xy.pval Power.xy.avg.pval Coherency Coherence Coherence.avg Coherence.pval Coherence.avg.pval Wave.x Wave.y Phase.x Phase.y Ampl.x Ampl.y Power.x Power.y Power.x.avg Power.y.avg Power.x.pval Power.y.pval Power.x.avg.pval Power.y.avg.pval sPower.x sPower.y Ridge.xy Ridge.co Ridge.x Ridge.y Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Starting wavelet transformation and coherency computation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave.xy Angle sWave.xy sAngle Power.xy Power.xy.avg Power.xy.pval Power.xy.avg.pval Coherency Coherence Coherence.avg Coherence.pval Coherence.avg.pval Wave.x Wave.y Phase.x Phase.y Ampl.x Ampl.y Power.x Power.y Power.x.avg Power.y.avg Power.x.pval Power.y.pval Power.x.avg.pval Power.y.avg.pval sPower.x sPower.y Ridge.xy Ridge.co Ridge.x Ridge.y Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Starting wavelet transformation and coherency computation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave.xy Angle sWave.xy sAngle Power.xy Power.xy.avg Power.xy.pval Power.xy.avg.pval Coherency Coherence Coherence.avg Coherence.pval Coherence.avg.pval Wave.x Wave.y Phase.x Phase.y Ampl.x Ampl.y Power.x Power.y Power.x.avg Power.y.avg Power.x.pval Power.y.pval Power.x.avg.pval Power.y.avg.pval sPower.x sPower.y Ridge.xy Ridge.co Ridge.x Ridge.y Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Starting wavelet transformation and coherency computation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave.xy Angle sWave.xy sAngle Power.xy Power.xy.avg Power.xy.pval Power.xy.avg.pval Coherency Coherence Coherence.avg Coherence.pval Coherence.avg.pval Wave.x Wave.y Phase.x Phase.y Ampl.x Ampl.y Power.x Power.y Power.x.avg Power.y.avg Power.x.pval Power.y.pval Power.x.avg.pval Power.y.avg.pval sPower.x sPower.y Ridge.xy Ridge.co Ridge.x Ridge.y Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Starting wavelet transformation and coherency computation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave.xy Angle sWave.xy sAngle Power.xy Power.xy.avg Power.xy.pval Power.xy.avg.pval Coherency Coherence Coherence.avg Coherence.pval Coherence.avg.pval Wave.x Wave.y Phase.x Phase.y Ampl.x Ampl.y Power.x Power.y Power.x.avg Power.y.avg Power.x.pval Power.y.pval Power.x.avg.pval Power.y.avg.pval sPower.x sPower.y Ridge.xy Ridge.co Ridge.x Ridge.y Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Starting wavelet transformation and coherency computation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave.xy Angle sWave.xy sAngle Power.xy Power.xy.avg Power.xy.pval Power.xy.avg.pval Coherency Coherence Coherence.avg Coherence.pval Coherence.avg.pval Wave.x Wave.y Phase.x Phase.y Ampl.x Ampl.y Power.x Power.y Power.x.avg Power.y.avg Power.x.pval Power.y.pval Power.x.avg.pval Power.y.avg.pval sPower.x sPower.y Ridge.xy Ridge.co Ridge.x Ridge.y Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Starting wavelet transformation and coherency computation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave.xy Angle sWave.xy sAngle Power.xy Power.xy.avg Power.xy.pval Power.xy.avg.pval Coherency Coherence Coherence.avg Coherence.pval Coherence.avg.pval Wave.x Wave.y Phase.x Phase.y Ampl.x Ampl.y Power.x Power.y Power.x.avg Power.y.avg Power.x.pval Power.y.pval Power.x.avg.pval Power.y.avg.pval sPower.x sPower.y Ridge.xy Ridge.co Ridge.x Ridge.y Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Starting wavelet transformation and coherency computation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave.xy Angle sWave.xy sAngle Power.xy Power.xy.avg Power.xy.pval Power.xy.avg.pval Coherency Coherence Coherence.avg Coherence.pval Coherence.avg.pval Wave.x Wave.y Phase.x Phase.y Ampl.x Ampl.y Power.x Power.y Power.x.avg Power.y.avg Power.x.pval Power.y.pval Power.x.avg.pval Power.y.avg.pval sPower.x sPower.y Ridge.xy Ridge.co Ridge.x Ridge.y Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Starting wavelet transformation and coherency computation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave.xy Angle sWave.xy sAngle Power.xy Power.xy.avg Power.xy.pval Power.xy.avg.pval Coherency Coherence Coherence.avg Coherence.pval Coherence.avg.pval Wave.x Wave.y Phase.x Phase.y Ampl.x Ampl.y Power.x Power.y Power.x.avg Power.y.avg Power.x.pval Power.y.pval Power.x.avg.pval Power.y.avg.pval sPower.x sPower.y Ridge.xy Ridge.co Ridge.x Ridge.y Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Starting wavelet transformation and coherency computation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave.xy Angle sWave.xy sAngle Power.xy Power.xy.avg Power.xy.pval Power.xy.avg.pval Coherency Coherence Coherence.avg Coherence.pval Coherence.avg.pval Wave.x Wave.y Phase.x Phase.y Ampl.x Ampl.y Power.x Power.y Power.x.avg Power.y.avg Power.x.pval Power.y.pval Power.x.avg.pval Power.y.avg.pval sPower.x sPower.y Ridge.xy Ridge.co Ridge.x Ridge.y Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Starting wavelet transformation and coherency computation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave.xy Angle sWave.xy sAngle Power.xy Power.xy.avg Power.xy.pval Power.xy.avg.pval Coherency Coherence Coherence.avg Coherence.pval Coherence.avg.pval Wave.x Wave.y Phase.x Phase.y Ampl.x Ampl.y Power.x Power.y Power.x.avg Power.y.avg Power.x.pval Power.y.pval Power.x.avg.pval Power.y.avg.pval sPower.x sPower.y Ridge.xy Ridge.co Ridge.x Ridge.y Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Starting wavelet transformation and coherency computation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave.xy Angle sWave.xy sAngle Power.xy Power.xy.avg Power.xy.pval Power.xy.avg.pval Coherency Coherence Coherence.avg Coherence.pval Coherence.avg.pval Wave.x Wave.y Phase.x Phase.y Ampl.x Ampl.y Power.x Power.y Power.x.avg Power.y.avg Power.x.pval Power.y.pval Power.x.avg.pval Power.y.avg.pval sPower.x sPower.y Ridge.xy Ridge.co Ridge.x Ridge.y Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Starting wavelet transformation and coherency computation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave.xy Angle sWave.xy sAngle Power.xy Power.xy.avg Power.xy.pval Power.xy.avg.pval Coherency Coherence Coherence.avg Coherence.pval Coherence.avg.pval Wave.x Wave.y Phase.x Phase.y Ampl.x Ampl.y Power.x Power.y Power.x.avg Power.y.avg Power.x.pval Power.y.pval Power.x.avg.pval Power.y.avg.pval sPower.x sPower.y Ridge.xy Ridge.co Ridge.x Ridge.y Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Starting wavelet transformation and coherency computation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave.xy Angle sWave.xy sAngle Power.xy Power.xy.avg Power.xy.pval Power.xy.avg.pval Coherency Coherence Coherence.avg Coherence.pval Coherence.avg.pval Wave.x Wave.y Phase.x Phase.y Ampl.x Ampl.y Power.x Power.y Power.x.avg Power.y.avg Power.x.pval Power.y.pval Power.x.avg.pval Power.y.avg.pval sPower.x sPower.y Ridge.xy Ridge.co Ridge.x Ridge.y Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Starting wavelet transformation and coherency computation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave.xy Angle sWave.xy sAngle Power.xy Power.xy.avg Power.xy.pval Power.xy.avg.pval Coherency Coherence Coherence.avg Coherence.pval Coherence.avg.pval Wave.x Wave.y Phase.x Phase.y Ampl.x Ampl.y Power.x Power.y Power.x.avg Power.y.avg Power.x.pval Power.y.pval Power.x.avg.pval Power.y.avg.pval sPower.x sPower.y Ridge.xy Ridge.co Ridge.x Ridge.y Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
#bin_edges<-c(10,25, 40,50,60,70,80,90, 120, 170, 255)
print(df_phases1)
## city1 city2 days_lead
## 1 Modesto Turlock 0.2314412
## 2 Modesto Esparto 7.2226007
## 3 Modesto Woodland 1.8197430
## 4 Modesto San Francisco 3.5295022
## 5 Modesto San Francisco, CA -2.1456966
## 6 Turlock Esparto NA
## 7 Turlock Woodland 1.5648690
## 8 Turlock San Francisco 3.2361310
## 9 Turlock San Francisco, CA -2.3993419
## 10 Esparto Woodland -6.1429614
## 11 Esparto San Francisco -4.2652484
## 12 Esparto San Francisco, CA -7.9989411
## 13 Woodland San Francisco 1.6329119
## 14 Woodland San Francisco, CA -4.2532149
## 15 San Francisco San Francisco, CA NA
Differences between wastewater signals in the period 126.8426053
df_phases2=compute_phase_diff_by_group(cities_2, per2)
## Starting wavelet transformation and coherency computation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave.xy Angle sWave.xy sAngle Power.xy Power.xy.avg Power.xy.pval Power.xy.avg.pval Coherency Coherence Coherence.avg Coherence.pval Coherence.avg.pval Wave.x Wave.y Phase.x Phase.y Ampl.x Ampl.y Power.x Power.y Power.x.avg Power.y.avg Power.x.pval Power.y.pval Power.x.avg.pval Power.y.avg.pval sPower.x sPower.y Ridge.xy Ridge.co Ridge.x Ridge.y Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Starting wavelet transformation and coherency computation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave.xy Angle sWave.xy sAngle Power.xy Power.xy.avg Power.xy.pval Power.xy.avg.pval Coherency Coherence Coherence.avg Coherence.pval Coherence.avg.pval Wave.x Wave.y Phase.x Phase.y Ampl.x Ampl.y Power.x Power.y Power.x.avg Power.y.avg Power.x.pval Power.y.pval Power.x.avg.pval Power.y.avg.pval sPower.x sPower.y Ridge.xy Ridge.co Ridge.x Ridge.y Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Starting wavelet transformation and coherency computation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave.xy Angle sWave.xy sAngle Power.xy Power.xy.avg Power.xy.pval Power.xy.avg.pval Coherency Coherence Coherence.avg Coherence.pval Coherence.avg.pval Wave.x Wave.y Phase.x Phase.y Ampl.x Ampl.y Power.x Power.y Power.x.avg Power.y.avg Power.x.pval Power.y.pval Power.x.avg.pval Power.y.avg.pval sPower.x sPower.y Ridge.xy Ridge.co Ridge.x Ridge.y Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Starting wavelet transformation and coherency computation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave.xy Angle sWave.xy sAngle Power.xy Power.xy.avg Power.xy.pval Power.xy.avg.pval Coherency Coherence Coherence.avg Coherence.pval Coherence.avg.pval Wave.x Wave.y Phase.x Phase.y Ampl.x Ampl.y Power.x Power.y Power.x.avg Power.y.avg Power.x.pval Power.y.pval Power.x.avg.pval Power.y.avg.pval sPower.x sPower.y Ridge.xy Ridge.co Ridge.x Ridge.y Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Starting wavelet transformation and coherency computation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave.xy Angle sWave.xy sAngle Power.xy Power.xy.avg Power.xy.pval Power.xy.avg.pval Coherency Coherence Coherence.avg Coherence.pval Coherence.avg.pval Wave.x Wave.y Phase.x Phase.y Ampl.x Ampl.y Power.x Power.y Power.x.avg Power.y.avg Power.x.pval Power.y.pval Power.x.avg.pval Power.y.avg.pval sPower.x sPower.y Ridge.xy Ridge.co Ridge.x Ridge.y Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Starting wavelet transformation and coherency computation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave.xy Angle sWave.xy sAngle Power.xy Power.xy.avg Power.xy.pval Power.xy.avg.pval Coherency Coherence Coherence.avg Coherence.pval Coherence.avg.pval Wave.x Wave.y Phase.x Phase.y Ampl.x Ampl.y Power.x Power.y Power.x.avg Power.y.avg Power.x.pval Power.y.pval Power.x.avg.pval Power.y.avg.pval sPower.x sPower.y Ridge.xy Ridge.co Ridge.x Ridge.y Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Starting wavelet transformation and coherency computation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave.xy Angle sWave.xy sAngle Power.xy Power.xy.avg Power.xy.pval Power.xy.avg.pval Coherency Coherence Coherence.avg Coherence.pval Coherence.avg.pval Wave.x Wave.y Phase.x Phase.y Ampl.x Ampl.y Power.x Power.y Power.x.avg Power.y.avg Power.x.pval Power.y.pval Power.x.avg.pval Power.y.avg.pval sPower.x sPower.y Ridge.xy Ridge.co Ridge.x Ridge.y Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Starting wavelet transformation and coherency computation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave.xy Angle sWave.xy sAngle Power.xy Power.xy.avg Power.xy.pval Power.xy.avg.pval Coherency Coherence Coherence.avg Coherence.pval Coherence.avg.pval Wave.x Wave.y Phase.x Phase.y Ampl.x Ampl.y Power.x Power.y Power.x.avg Power.y.avg Power.x.pval Power.y.pval Power.x.avg.pval Power.y.avg.pval sPower.x sPower.y Ridge.xy Ridge.co Ridge.x Ridge.y Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Starting wavelet transformation and coherency computation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave.xy Angle sWave.xy sAngle Power.xy Power.xy.avg Power.xy.pval Power.xy.avg.pval Coherency Coherence Coherence.avg Coherence.pval Coherence.avg.pval Wave.x Wave.y Phase.x Phase.y Ampl.x Ampl.y Power.x Power.y Power.x.avg Power.y.avg Power.x.pval Power.y.pval Power.x.avg.pval Power.y.avg.pval sPower.x sPower.y Ridge.xy Ridge.co Ridge.x Ridge.y Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Starting wavelet transformation and coherency computation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave.xy Angle sWave.xy sAngle Power.xy Power.xy.avg Power.xy.pval Power.xy.avg.pval Coherency Coherence Coherence.avg Coherence.pval Coherence.avg.pval Wave.x Wave.y Phase.x Phase.y Ampl.x Ampl.y Power.x Power.y Power.x.avg Power.y.avg Power.x.pval Power.y.pval Power.x.avg.pval Power.y.avg.pval sPower.x sPower.y Ridge.xy Ridge.co Ridge.x Ridge.y Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Starting wavelet transformation and coherency computation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave.xy Angle sWave.xy sAngle Power.xy Power.xy.avg Power.xy.pval Power.xy.avg.pval Coherency Coherence Coherence.avg Coherence.pval Coherence.avg.pval Wave.x Wave.y Phase.x Phase.y Ampl.x Ampl.y Power.x Power.y Power.x.avg Power.y.avg Power.x.pval Power.y.pval Power.x.avg.pval Power.y.avg.pval sPower.x sPower.y Ridge.xy Ridge.co Ridge.x Ridge.y Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Starting wavelet transformation and coherency computation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave.xy Angle sWave.xy sAngle Power.xy Power.xy.avg Power.xy.pval Power.xy.avg.pval Coherency Coherence Coherence.avg Coherence.pval Coherence.avg.pval Wave.x Wave.y Phase.x Phase.y Ampl.x Ampl.y Power.x Power.y Power.x.avg Power.y.avg Power.x.pval Power.y.pval Power.x.avg.pval Power.y.avg.pval sPower.x sPower.y Ridge.xy Ridge.co Ridge.x Ridge.y Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Starting wavelet transformation and coherency computation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave.xy Angle sWave.xy sAngle Power.xy Power.xy.avg Power.xy.pval Power.xy.avg.pval Coherency Coherence Coherence.avg Coherence.pval Coherence.avg.pval Wave.x Wave.y Phase.x Phase.y Ampl.x Ampl.y Power.x Power.y Power.x.avg Power.y.avg Power.x.pval Power.y.pval Power.x.avg.pval Power.y.avg.pval sPower.x sPower.y Ridge.xy Ridge.co Ridge.x Ridge.y Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Starting wavelet transformation and coherency computation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave.xy Angle sWave.xy sAngle Power.xy Power.xy.avg Power.xy.pval Power.xy.avg.pval Coherency Coherence Coherence.avg Coherence.pval Coherence.avg.pval Wave.x Wave.y Phase.x Phase.y Ampl.x Ampl.y Power.x Power.y Power.x.avg Power.y.avg Power.x.pval Power.y.pval Power.x.avg.pval Power.y.avg.pval sPower.x sPower.y Ridge.xy Ridge.co Ridge.x Ridge.y Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Starting wavelet transformation and coherency computation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave.xy Angle sWave.xy sAngle Power.xy Power.xy.avg Power.xy.pval Power.xy.avg.pval Coherency Coherence Coherence.avg Coherence.pval Coherence.avg.pval Wave.x Wave.y Phase.x Phase.y Ampl.x Ampl.y Power.x Power.y Power.x.avg Power.y.avg Power.x.pval Power.y.pval Power.x.avg.pval Power.y.avg.pval sPower.x sPower.y Ridge.xy Ridge.co Ridge.x Ridge.y Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Starting wavelet transformation and coherency computation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave.xy Angle sWave.xy sAngle Power.xy Power.xy.avg Power.xy.pval Power.xy.avg.pval Coherency Coherence Coherence.avg Coherence.pval Coherence.avg.pval Wave.x Wave.y Phase.x Phase.y Ampl.x Ampl.y Power.x Power.y Power.x.avg Power.y.avg Power.x.pval Power.y.pval Power.x.avg.pval Power.y.avg.pval sPower.x sPower.y Ridge.xy Ridge.co Ridge.x Ridge.y Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Starting wavelet transformation and coherency computation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave.xy Angle sWave.xy sAngle Power.xy Power.xy.avg Power.xy.pval Power.xy.avg.pval Coherency Coherence Coherence.avg Coherence.pval Coherence.avg.pval Wave.x Wave.y Phase.x Phase.y Ampl.x Ampl.y Power.x Power.y Power.x.avg Power.y.avg Power.x.pval Power.y.pval Power.x.avg.pval Power.y.avg.pval sPower.x sPower.y Ridge.xy Ridge.co Ridge.x Ridge.y Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Starting wavelet transformation and coherency computation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave.xy Angle sWave.xy sAngle Power.xy Power.xy.avg Power.xy.pval Power.xy.avg.pval Coherency Coherence Coherence.avg Coherence.pval Coherence.avg.pval Wave.x Wave.y Phase.x Phase.y Ampl.x Ampl.y Power.x Power.y Power.x.avg Power.y.avg Power.x.pval Power.y.pval Power.x.avg.pval Power.y.avg.pval sPower.x sPower.y Ridge.xy Ridge.co Ridge.x Ridge.y Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Starting wavelet transformation and coherency computation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave.xy Angle sWave.xy sAngle Power.xy Power.xy.avg Power.xy.pval Power.xy.avg.pval Coherency Coherence Coherence.avg Coherence.pval Coherence.avg.pval Wave.x Wave.y Phase.x Phase.y Ampl.x Ampl.y Power.x Power.y Power.x.avg Power.y.avg Power.x.pval Power.y.pval Power.x.avg.pval Power.y.avg.pval sPower.x sPower.y Ridge.xy Ridge.co Ridge.x Ridge.y Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Starting wavelet transformation and coherency computation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave.xy Angle sWave.xy sAngle Power.xy Power.xy.avg Power.xy.pval Power.xy.avg.pval Coherency Coherence Coherence.avg Coherence.pval Coherence.avg.pval Wave.x Wave.y Phase.x Phase.y Ampl.x Ampl.y Power.x Power.y Power.x.avg Power.y.avg Power.x.pval Power.y.pval Power.x.avg.pval Power.y.avg.pval sPower.x sPower.y Ridge.xy Ridge.co Ridge.x Ridge.y Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Starting wavelet transformation and coherency computation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave.xy Angle sWave.xy sAngle Power.xy Power.xy.avg Power.xy.pval Power.xy.avg.pval Coherency Coherence Coherence.avg Coherence.pval Coherence.avg.pval Wave.x Wave.y Phase.x Phase.y Ampl.x Ampl.y Power.x Power.y Power.x.avg Power.y.avg Power.x.pval Power.y.pval Power.x.avg.pval Power.y.avg.pval sPower.x sPower.y Ridge.xy Ridge.co Ridge.x Ridge.y Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Starting wavelet transformation and coherency computation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave.xy Angle sWave.xy sAngle Power.xy Power.xy.avg Power.xy.pval Power.xy.avg.pval Coherency Coherence Coherence.avg Coherence.pval Coherence.avg.pval Wave.x Wave.y Phase.x Phase.y Ampl.x Ampl.y Power.x Power.y Power.x.avg Power.y.avg Power.x.pval Power.y.pval Power.x.avg.pval Power.y.avg.pval sPower.x sPower.y Ridge.xy Ridge.co Ridge.x Ridge.y Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Starting wavelet transformation and coherency computation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave.xy Angle sWave.xy sAngle Power.xy Power.xy.avg Power.xy.pval Power.xy.avg.pval Coherency Coherence Coherence.avg Coherence.pval Coherence.avg.pval Wave.x Wave.y Phase.x Phase.y Ampl.x Ampl.y Power.x Power.y Power.x.avg Power.y.avg Power.x.pval Power.y.pval Power.x.avg.pval Power.y.avg.pval sPower.x sPower.y Ridge.xy Ridge.co Ridge.x Ridge.y Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Starting wavelet transformation and coherency computation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave.xy Angle sWave.xy sAngle Power.xy Power.xy.avg Power.xy.pval Power.xy.avg.pval Coherency Coherence Coherence.avg Coherence.pval Coherence.avg.pval Wave.x Wave.y Phase.x Phase.y Ampl.x Ampl.y Power.x Power.y Power.x.avg Power.y.avg Power.x.pval Power.y.pval Power.x.avg.pval Power.y.avg.pval sPower.x sPower.y Ridge.xy Ridge.co Ridge.x Ridge.y Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Starting wavelet transformation and coherency computation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave.xy Angle sWave.xy sAngle Power.xy Power.xy.avg Power.xy.pval Power.xy.avg.pval Coherency Coherence Coherence.avg Coherence.pval Coherence.avg.pval Wave.x Wave.y Phase.x Phase.y Ampl.x Ampl.y Power.x Power.y Power.x.avg Power.y.avg Power.x.pval Power.y.pval Power.x.avg.pval Power.y.avg.pval sPower.x sPower.y Ridge.xy Ridge.co Ridge.x Ridge.y Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Starting wavelet transformation and coherency computation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave.xy Angle sWave.xy sAngle Power.xy Power.xy.avg Power.xy.pval Power.xy.avg.pval Coherency Coherence Coherence.avg Coherence.pval Coherence.avg.pval Wave.x Wave.y Phase.x Phase.y Ampl.x Ampl.y Power.x Power.y Power.x.avg Power.y.avg Power.x.pval Power.y.pval Power.x.avg.pval Power.y.avg.pval sPower.x sPower.y Ridge.xy Ridge.co Ridge.x Ridge.y Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Starting wavelet transformation and coherency computation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave.xy Angle sWave.xy sAngle Power.xy Power.xy.avg Power.xy.pval Power.xy.avg.pval Coherency Coherence Coherence.avg Coherence.pval Coherence.avg.pval Wave.x Wave.y Phase.x Phase.y Ampl.x Ampl.y Power.x Power.y Power.x.avg Power.y.avg Power.x.pval Power.y.pval Power.x.avg.pval Power.y.avg.pval sPower.x sPower.y Ridge.xy Ridge.co Ridge.x Ridge.y Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Starting wavelet transformation and coherency computation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave.xy Angle sWave.xy sAngle Power.xy Power.xy.avg Power.xy.pval Power.xy.avg.pval Coherency Coherence Coherence.avg Coherence.pval Coherence.avg.pval Wave.x Wave.y Phase.x Phase.y Ampl.x Ampl.y Power.x Power.y Power.x.avg Power.y.avg Power.x.pval Power.y.pval Power.x.avg.pval Power.y.avg.pval sPower.x sPower.y Ridge.xy Ridge.co Ridge.x Ridge.y Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Starting wavelet transformation and coherency computation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave.xy Angle sWave.xy sAngle Power.xy Power.xy.avg Power.xy.pval Power.xy.avg.pval Coherency Coherence Coherence.avg Coherence.pval Coherence.avg.pval Wave.x Wave.y Phase.x Phase.y Ampl.x Ampl.y Power.x Power.y Power.x.avg Power.y.avg Power.x.pval Power.y.pval Power.x.avg.pval Power.y.avg.pval sPower.x sPower.y Ridge.xy Ridge.co Ridge.x Ridge.y Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Starting wavelet transformation and coherency computation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave.xy Angle sWave.xy sAngle Power.xy Power.xy.avg Power.xy.pval Power.xy.avg.pval Coherency Coherence Coherence.avg Coherence.pval Coherence.avg.pval Wave.x Wave.y Phase.x Phase.y Ampl.x Ampl.y Power.x Power.y Power.x.avg Power.y.avg Power.x.pval Power.y.pval Power.x.avg.pval Power.y.avg.pval sPower.x sPower.y Ridge.xy Ridge.co Ridge.x Ridge.y Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Starting wavelet transformation and coherency computation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave.xy Angle sWave.xy sAngle Power.xy Power.xy.avg Power.xy.pval Power.xy.avg.pval Coherency Coherence Coherence.avg Coherence.pval Coherence.avg.pval Wave.x Wave.y Phase.x Phase.y Ampl.x Ampl.y Power.x Power.y Power.x.avg Power.y.avg Power.x.pval Power.y.pval Power.x.avg.pval Power.y.avg.pval sPower.x sPower.y Ridge.xy Ridge.co Ridge.x Ridge.y Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Starting wavelet transformation and coherency computation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave.xy Angle sWave.xy sAngle Power.xy Power.xy.avg Power.xy.pval Power.xy.avg.pval Coherency Coherence Coherence.avg Coherence.pval Coherence.avg.pval Wave.x Wave.y Phase.x Phase.y Ampl.x Ampl.y Power.x Power.y Power.x.avg Power.y.avg Power.x.pval Power.y.pval Power.x.avg.pval Power.y.avg.pval sPower.x sPower.y Ridge.xy Ridge.co Ridge.x Ridge.y Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Starting wavelet transformation and coherency computation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave.xy Angle sWave.xy sAngle Power.xy Power.xy.avg Power.xy.pval Power.xy.avg.pval Coherency Coherence Coherence.avg Coherence.pval Coherence.avg.pval Wave.x Wave.y Phase.x Phase.y Ampl.x Ampl.y Power.x Power.y Power.x.avg Power.y.avg Power.x.pval Power.y.pval Power.x.avg.pval Power.y.avg.pval sPower.x sPower.y Ridge.xy Ridge.co Ridge.x Ridge.y Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Starting wavelet transformation and coherency computation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave.xy Angle sWave.xy sAngle Power.xy Power.xy.avg Power.xy.pval Power.xy.avg.pval Coherency Coherence Coherence.avg Coherence.pval Coherence.avg.pval Wave.x Wave.y Phase.x Phase.y Ampl.x Ampl.y Power.x Power.y Power.x.avg Power.y.avg Power.x.pval Power.y.pval Power.x.avg.pval Power.y.avg.pval sPower.x sPower.y Ridge.xy Ridge.co Ridge.x Ridge.y Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Starting wavelet transformation and coherency computation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave.xy Angle sWave.xy sAngle Power.xy Power.xy.avg Power.xy.pval Power.xy.avg.pval Coherency Coherence Coherence.avg Coherence.pval Coherence.avg.pval Wave.x Wave.y Phase.x Phase.y Ampl.x Ampl.y Power.x Power.y Power.x.avg Power.y.avg Power.x.pval Power.y.pval Power.x.avg.pval Power.y.avg.pval sPower.x sPower.y Ridge.xy Ridge.co Ridge.x Ridge.y Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Starting wavelet transformation and coherency computation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave.xy Angle sWave.xy sAngle Power.xy Power.xy.avg Power.xy.pval Power.xy.avg.pval Coherency Coherence Coherence.avg Coherence.pval Coherence.avg.pval Wave.x Wave.y Phase.x Phase.y Ampl.x Ampl.y Power.x Power.y Power.x.avg Power.y.avg Power.x.pval Power.y.pval Power.x.avg.pval Power.y.avg.pval sPower.x sPower.y Ridge.xy Ridge.co Ridge.x Ridge.y Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
#bin_edges<-c(10,25, 40,50,60,70,80,90, 120, 170, 255)
print(df_phases2)
## city1 city2 days_lead
## 1 Modesto Turlock 2.3789175
## 2 Modesto Davis 6.9612487
## 3 Modesto Esparto 7.4687871
## 4 Modesto Winters 8.8624317
## 5 Modesto Woodland -0.1184463
## 6 Modesto Oakland 6.3537389
## 7 Modesto San Francisco 0.8697531
## 8 Modesto San Francisco, CA 0.4502686
## 9 Turlock Davis 3.6528860
## 10 Turlock Esparto 5.3790216
## 11 Turlock Winters 7.1428862
## 12 Turlock Woodland -2.6690381
## 13 Turlock Oakland 4.3501891
## 14 Turlock San Francisco -1.4402996
## 15 Turlock San Francisco, CA -2.0909286
## 16 Davis Esparto 1.2827695
## 17 Davis Winters 2.5239025
## 18 Davis Woodland -6.5745737
## 19 Davis Oakland 0.2918286
## 20 Davis San Francisco -4.9747156
## 21 Davis San Francisco, CA -5.3738944
## 22 Esparto Winters 1.8920589
## 23 Esparto Woodland -8.0850800
## 24 Esparto Oakland -0.9775032
## 25 Esparto San Francisco -6.4133706
## 26 Esparto San Francisco, CA -7.3462673
## 27 Winters Woodland -9.5063956
## 28 Winters Oakland NA
## 29 Winters San Francisco -8.3622491
## 30 Winters San Francisco, CA -9.0898762
## 31 Woodland Oakland 6.8710408
## 32 Woodland San Francisco 1.0404327
## 33 Woodland San Francisco, CA 0.5404539
## 34 Oakland San Francisco -5.6810794
## 35 Oakland San Francisco, CA -6.2792588
## 36 San Francisco San Francisco, CA -0.6577601
Differences between wastewater signals in the period 175.2953018
df_phases3=compute_phase_diff_by_group(cities_3, per3)
## Starting wavelet transformation and coherency computation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave.xy Angle sWave.xy sAngle Power.xy Power.xy.avg Power.xy.pval Power.xy.avg.pval Coherency Coherence Coherence.avg Coherence.pval Coherence.avg.pval Wave.x Wave.y Phase.x Phase.y Ampl.x Ampl.y Power.x Power.y Power.x.avg Power.y.avg Power.x.pval Power.y.pval Power.x.avg.pval Power.y.avg.pval sPower.x sPower.y Ridge.xy Ridge.co Ridge.x Ridge.y Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Starting wavelet transformation and coherency computation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave.xy Angle sWave.xy sAngle Power.xy Power.xy.avg Power.xy.pval Power.xy.avg.pval Coherency Coherence Coherence.avg Coherence.pval Coherence.avg.pval Wave.x Wave.y Phase.x Phase.y Ampl.x Ampl.y Power.x Power.y Power.x.avg Power.y.avg Power.x.pval Power.y.pval Power.x.avg.pval Power.y.avg.pval sPower.x sPower.y Ridge.xy Ridge.co Ridge.x Ridge.y Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Starting wavelet transformation and coherency computation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave.xy Angle sWave.xy sAngle Power.xy Power.xy.avg Power.xy.pval Power.xy.avg.pval Coherency Coherence Coherence.avg Coherence.pval Coherence.avg.pval Wave.x Wave.y Phase.x Phase.y Ampl.x Ampl.y Power.x Power.y Power.x.avg Power.y.avg Power.x.pval Power.y.pval Power.x.avg.pval Power.y.avg.pval sPower.x sPower.y Ridge.xy Ridge.co Ridge.x Ridge.y Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Starting wavelet transformation and coherency computation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave.xy Angle sWave.xy sAngle Power.xy Power.xy.avg Power.xy.pval Power.xy.avg.pval Coherency Coherence Coherence.avg Coherence.pval Coherence.avg.pval Wave.x Wave.y Phase.x Phase.y Ampl.x Ampl.y Power.x Power.y Power.x.avg Power.y.avg Power.x.pval Power.y.pval Power.x.avg.pval Power.y.avg.pval sPower.x sPower.y Ridge.xy Ridge.co Ridge.x Ridge.y Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Starting wavelet transformation and coherency computation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave.xy Angle sWave.xy sAngle Power.xy Power.xy.avg Power.xy.pval Power.xy.avg.pval Coherency Coherence Coherence.avg Coherence.pval Coherence.avg.pval Wave.x Wave.y Phase.x Phase.y Ampl.x Ampl.y Power.x Power.y Power.x.avg Power.y.avg Power.x.pval Power.y.pval Power.x.avg.pval Power.y.avg.pval sPower.x sPower.y Ridge.xy Ridge.co Ridge.x Ridge.y Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Starting wavelet transformation and coherency computation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave.xy Angle sWave.xy sAngle Power.xy Power.xy.avg Power.xy.pval Power.xy.avg.pval Coherency Coherence Coherence.avg Coherence.pval Coherence.avg.pval Wave.x Wave.y Phase.x Phase.y Ampl.x Ampl.y Power.x Power.y Power.x.avg Power.y.avg Power.x.pval Power.y.pval Power.x.avg.pval Power.y.avg.pval sPower.x sPower.y Ridge.xy Ridge.co Ridge.x Ridge.y Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Starting wavelet transformation and coherency computation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave.xy Angle sWave.xy sAngle Power.xy Power.xy.avg Power.xy.pval Power.xy.avg.pval Coherency Coherence Coherence.avg Coherence.pval Coherence.avg.pval Wave.x Wave.y Phase.x Phase.y Ampl.x Ampl.y Power.x Power.y Power.x.avg Power.y.avg Power.x.pval Power.y.pval Power.x.avg.pval Power.y.avg.pval sPower.x sPower.y Ridge.xy Ridge.co Ridge.x Ridge.y Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Starting wavelet transformation and coherency computation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave.xy Angle sWave.xy sAngle Power.xy Power.xy.avg Power.xy.pval Power.xy.avg.pval Coherency Coherence Coherence.avg Coherence.pval Coherence.avg.pval Wave.x Wave.y Phase.x Phase.y Ampl.x Ampl.y Power.x Power.y Power.x.avg Power.y.avg Power.x.pval Power.y.pval Power.x.avg.pval Power.y.avg.pval sPower.x sPower.y Ridge.xy Ridge.co Ridge.x Ridge.y Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Starting wavelet transformation and coherency computation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave.xy Angle sWave.xy sAngle Power.xy Power.xy.avg Power.xy.pval Power.xy.avg.pval Coherency Coherence Coherence.avg Coherence.pval Coherence.avg.pval Wave.x Wave.y Phase.x Phase.y Ampl.x Ampl.y Power.x Power.y Power.x.avg Power.y.avg Power.x.pval Power.y.pval Power.x.avg.pval Power.y.avg.pval sPower.x sPower.y Ridge.xy Ridge.co Ridge.x Ridge.y Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
## Starting wavelet transformation and coherency computation...
## ... and simulations...
## | | | 0% | |======= | 10% | |============== | 20% | |===================== | 30% | |============================ | 40% | |=================================== | 50% | |========================================== | 60% | |================================================= | 70% | |======================================================== | 80% | |=============================================================== | 90% | |======================================================================| 100%
## Class attributes are accessible through following names:
## series loess.span dt dj Wave.xy Angle sWave.xy sAngle Power.xy Power.xy.avg Power.xy.pval Power.xy.avg.pval Coherency Coherence Coherence.avg Coherence.pval Coherence.avg.pval Wave.x Wave.y Phase.x Phase.y Ampl.x Ampl.y Power.x Power.y Power.x.avg Power.y.avg Power.x.pval Power.y.pval Power.x.avg.pval Power.y.avg.pval sPower.x sPower.y Ridge.xy Ridge.co Ridge.x Ridge.y Period Scale nc nr coi.1 coi.2 axis.1 axis.2 date.format date.tz
#bin_edges<-c(10,25, 40,50,60,70,80,90, 120, 170, 255)
print(df_phases3)
## city1 city2 days_lead
## 1 Merced Modesto 0.9419799
## 2 Merced Turlock -1.4633854
## 3 Merced Winters NA
## 4 Merced San Francisco, CA -8.7622029
## 5 Modesto Turlock -2.4326045
## 6 Modesto Winters -11.5294156
## 7 Modesto San Francisco, CA -9.6976415
## 8 Turlock Winters -10.4009844
## 9 Turlock San Francisco, CA -7.1640239
## 10 Winters San Francisco, CA 12.3260727
merged_df <- full_join(df_phases1, df_phases2, by = c("city1", "city2")) %>%
full_join(df_phases3, by = c("city1", "city2")) %>%
select(city1, city2, days_lead_per1 = days_lead.x, days_lead_per2 = days_lead.y, days_lead_per_3 = days_lead)
print(merged_df)
## city1 city2 days_lead_per1 days_lead_per2
## 1 Modesto Turlock 0.2314412 2.3789175
## 2 Modesto Esparto 7.2226007 7.4687871
## 3 Modesto Woodland 1.8197430 -0.1184463
## 4 Modesto San Francisco 3.5295022 0.8697531
## 5 Modesto San Francisco, CA -2.1456966 0.4502686
## 6 Turlock Esparto NA 5.3790216
## 7 Turlock Woodland 1.5648690 -2.6690381
## 8 Turlock San Francisco 3.2361310 -1.4402996
## 9 Turlock San Francisco, CA -2.3993419 -2.0909286
## 10 Esparto Woodland -6.1429614 -8.0850800
## 11 Esparto San Francisco -4.2652484 -6.4133706
## 12 Esparto San Francisco, CA -7.9989411 -7.3462673
## 13 Woodland San Francisco 1.6329119 1.0404327
## 14 Woodland San Francisco, CA -4.2532149 0.5404539
## 15 San Francisco San Francisco, CA NA -0.6577601
## 16 Modesto Davis NA 6.9612487
## 17 Modesto Winters NA 8.8624317
## 18 Modesto Oakland NA 6.3537389
## 19 Turlock Davis NA 3.6528860
## 20 Turlock Winters NA 7.1428862
## 21 Turlock Oakland NA 4.3501891
## 22 Davis Esparto NA 1.2827695
## 23 Davis Winters NA 2.5239025
## 24 Davis Woodland NA -6.5745737
## 25 Davis Oakland NA 0.2918286
## 26 Davis San Francisco NA -4.9747156
## 27 Davis San Francisco, CA NA -5.3738944
## 28 Esparto Winters NA 1.8920589
## 29 Esparto Oakland NA -0.9775032
## 30 Winters Woodland NA -9.5063956
## 31 Winters Oakland NA NA
## 32 Winters San Francisco NA -8.3622491
## 33 Winters San Francisco, CA NA -9.0898762
## 34 Woodland Oakland NA 6.8710408
## 35 Oakland San Francisco NA -5.6810794
## 36 Oakland San Francisco, CA NA -6.2792588
## 37 Merced Modesto NA NA
## 38 Merced Turlock NA NA
## 39 Merced Winters NA NA
## 40 Merced San Francisco, CA NA NA
## days_lead_per_3
## 1 -2.4326045
## 2 NA
## 3 NA
## 4 NA
## 5 -9.6976415
## 6 NA
## 7 NA
## 8 NA
## 9 -7.1640239
## 10 NA
## 11 NA
## 12 NA
## 13 NA
## 14 NA
## 15 NA
## 16 NA
## 17 -11.5294156
## 18 NA
## 19 NA
## 20 -10.4009844
## 21 NA
## 22 NA
## 23 NA
## 24 NA
## 25 NA
## 26 NA
## 27 NA
## 28 NA
## 29 NA
## 30 NA
## 31 NA
## 32 NA
## 33 12.3260727
## 34 NA
## 35 NA
## 36 NA
## 37 0.9419799
## 38 -1.4633854
## 39 NA
## 40 -8.7622029
knitr::kable(merged_df)
| city1 | city2 | days_lead_per1 | days_lead_per2 | days_lead_per_3 |
|---|---|---|---|---|
| Modesto | Turlock | 0.2314412 | 2.3789175 | -2.4326045 |
| Modesto | Esparto | 7.2226007 | 7.4687871 | NA |
| Modesto | Woodland | 1.8197430 | -0.1184463 | NA |
| Modesto | San Francisco | 3.5295022 | 0.8697531 | NA |
| Modesto | San Francisco, CA | -2.1456966 | 0.4502686 | -9.6976415 |
| Turlock | Esparto | NA | 5.3790216 | NA |
| Turlock | Woodland | 1.5648690 | -2.6690381 | NA |
| Turlock | San Francisco | 3.2361310 | -1.4402996 | NA |
| Turlock | San Francisco, CA | -2.3993419 | -2.0909286 | -7.1640239 |
| Esparto | Woodland | -6.1429614 | -8.0850800 | NA |
| Esparto | San Francisco | -4.2652484 | -6.4133706 | NA |
| Esparto | San Francisco, CA | -7.9989411 | -7.3462673 | NA |
| Woodland | San Francisco | 1.6329119 | 1.0404327 | NA |
| Woodland | San Francisco, CA | -4.2532149 | 0.5404539 | NA |
| San Francisco | San Francisco, CA | NA | -0.6577601 | NA |
| Modesto | Davis | NA | 6.9612487 | NA |
| Modesto | Winters | NA | 8.8624317 | -11.5294156 |
| Modesto | Oakland | NA | 6.3537389 | NA |
| Turlock | Davis | NA | 3.6528860 | NA |
| Turlock | Winters | NA | 7.1428862 | -10.4009844 |
| Turlock | Oakland | NA | 4.3501891 | NA |
| Davis | Esparto | NA | 1.2827695 | NA |
| Davis | Winters | NA | 2.5239025 | NA |
| Davis | Woodland | NA | -6.5745737 | NA |
| Davis | Oakland | NA | 0.2918286 | NA |
| Davis | San Francisco | NA | -4.9747156 | NA |
| Davis | San Francisco, CA | NA | -5.3738944 | NA |
| Esparto | Winters | NA | 1.8920589 | NA |
| Esparto | Oakland | NA | -0.9775032 | NA |
| Winters | Woodland | NA | -9.5063956 | NA |
| Winters | Oakland | NA | NA | NA |
| Winters | San Francisco | NA | -8.3622491 | NA |
| Winters | San Francisco, CA | NA | -9.0898762 | 12.3260727 |
| Woodland | Oakland | NA | 6.8710408 | NA |
| Oakland | San Francisco | NA | -5.6810794 | NA |
| Oakland | San Francisco, CA | NA | -6.2792588 | NA |
| Merced | Modesto | NA | NA | 0.9419799 |
| Merced | Turlock | NA | NA | -1.4633854 |
| Merced | Winters | NA | NA | NA |
| Merced | San Francisco, CA | NA | NA | -8.7622029 |