Description Usage Arguments Details Value References See Also Examples

Evaluate the correlation between tide change and sun angle to determine potential effectiveness of weighted regression

1 2 3 4 5 |

`dat_in` |
Input |

`tz` |
chr string for timezone, e.g., 'America/Chicago' |

`lat` |
numeric for latitude |

`long` |
numeric for longitude (negative west of prime meridian) |

`depth_val` |
chr indicating name of the tidal height column in |

`daywin` |
numeric for half-window width used in moving window correlation |

`method` |
chr string for corrrelation method, passed to |

`plot` |
logical to return a plot |

`lims` |
two element numeric vector indicating y-axis limits on plot |

`progress` |
logical if progress is saved to a text file named 'log.txt' in the working directory |

`harm` |
logical indicating if the tidal height vector indicated in |

`chk_tide` |
logical indicating if harmonic regression output is returned for diagnostics |

`constituents` |
chr string of harmonic constituents to predict if |

This function can be used before weighted regression to identify locations in the time series when tidal and solar changes are not correlated. In general, the `wtreg`

will be most effective when correlations between the two are zero, whereas `wtreg`

will remove both the biological and physical components of the dissolved oxygen time series when the sun and tide are correlated. The correlation between tide change and sun angle is estimated using a moving window for the time series, where the half-window width is defined by `daywin`

(i.e., the default value is a moving window with six days on each side for 12 days total). Tide changes are estimated as angular rates for the tidal height vector and sun angles are estimated from the time of day and geographic location.

The `foreach`

function is used to execute the moving window correlation in parallel and will be run automatically if a backend is created.

Setting `harm = TRUE`

will predict the tidal time series with harmonic regression using the `tidem`

function. This is useful if there are missing observations in the observed tidal vector. The correlation time series in the plot will also be smoother. Use the `chk_tide`

function before applying this option to verify the harmonic regression model is adequate for the observed time series. The predicted tidal constituents in the default argument should account for a majority of the variation in the observed data. These include M2: principal lunar semidiurnal, S2: principal solar semidiurnal, N2: larger lunar elliptic semidiurnal, K2: lunisolar semidiurnal, K1: lunisolar declinational diurnal, O1: principal lunar diurnal, P1: principal solar diurnal, Q1: larger lunar elliptic diurnal, MF: lunar fortnightly, MM: lunar monthly, SSA: solar semi annual, M4: first overtide of M2, M6: second overtide of M2, S4: first overtide of S2, and MS4: compound tide of M2 and S2.

Figure 9 in Beck et al. 2015 was created using this function.

A `ggplot`

object if `plot = TRUE`

, otherwise a numeric vector of the correlations for each row in the input dataset. A two-element list will be returned for the tidal model and predicted resutls of `chk_tide = TRUE`

Beck MW, Hagy III JD, Murrell MC. 2015. Improving estimates of ecosystem metabolism by reducing effects of tidal advection on dissolved oxygen time series. Limnology and Oceanography Methods. DOI: 10.1002/lom3.10062

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | ```
## Not run:
data(SAPDC)
# metadata
tz <- 'America/Jamaica'
lat <- 31.39
long <- -89.28
# setup parallel backend
library(doParallel)
registerDoParallel(cores = 7)
evalcor(SAPDC, tz, lat, long, progress = TRUE)
# check fit of tidal predictions
# in this case, predictions = observed because sample data are already predicted
tochk <- evalcor(SAPDC, tz, lat, long, progress = TRUE, chk_tide = TRUE)
tochk <- tochk$tide_pred
plot(tide_obs ~ tide_pred, tochk)
## End(Not run)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.