nobsplot: Plot number of observations in a WRTDS interpolation grid

View source: R/nobsplot.R

nobsplotR Documentation

Plot number of observations in a WRTDS interpolation grid

Description

Plot number of observations for each point in a WRTDS interpolation grid. This is a diagnostic plot to identify sample size for each unique location in the domain of the time series that is considered during model fitting.

Usage

nobsplot(dat_in, ...)

## Default S3 method:
nobsplot(
  dat_in,
  month = "all",
  years = NULL,
  col_vec = NULL,
  allflo = TRUE,
  ncol = NULL,
  grids = FALSE,
  pretty = TRUE,
  ...
)

## S3 method for class 'tidal'
nobsplot(dat_in, ...)

## S3 method for class 'tidalmean'
nobsplot(dat_in, ...)

Arguments

dat_in

input tidal or tidalmean object

...

arguments passed to other methods

month

numeric indicating months to plot or chr string 'all' to indicate all months with no plot facets

years

numeric vector of years to plot, defaults to all

col_vec

chr string of plot colors to use, passed to gradcols and scale_fill_gradientn for grid shading. Any color palette from RColorBrewer can be used as a named input. Palettes from grDevices must be supplied as the returned string of colors for each palette.

allflo

logical indicating if the salinity/flow values for plotting are limited to the fifth and ninety-fifth percentile of observed values for the month of interest

ncol

numeric argument passed to facet_wrap indicating number of facet columns

grids

logical indicating if grid lines are present

pretty

logical indicating if my subjective idea of plot aesthetics is applied, otherwise the ggplot default themes are used

Details

The plots can be used sample size as an indication of model fit for each unique location in the domain space of the time series. The plots show grids of the number of observations with weights greater than zero for each unique date and salinity/flow combination. The obs attribute in the tidal or tidalmean object is created during model fitting and has the same dimensions as the interpolation grid. Each row is a unique date in the original dataset and each column is a salinity/flow value used to fit each regression (i.e., values in the flo_grd attribute). In general, low points in the grid may indicate locations in the time series where insufficient data could affect model fit.

Unlike gridplot, interpolation of the grids for a smoother appearance is not allowed because the objective is to identify specific locations with low sample size. For the former function, the objective is to characterize general trends over time rather values at specific locations.

Value

A ggplot object that can be further modified

See Also

wtsplot for an alternative to evaluating weights with different window width combinations

Examples

## Not run: 
## load a fitted tidal object
data(tidfit)

## default plot
nobsplot(tidfit)

## no facets, all months
nobsplot(tidfit)

## change the defaults
nobsplot(tidfit, tau = c(0.1), month = c(3, 6, 9, 12), 
 col_vec = c('red', 'blue', 'green'), flo_fac = 1)
 
## plot a tidalmean object
data(tidfitmean)

nobsplot(tidfitmean)


## End(Not run)

WRTDStidal documentation built on Oct. 20, 2023, 5:08 p.m.