wtsplot | R Documentation |

Create several plots showing the weights used to fit a model for a single observation.

```
wtsplot(dat_in, ...)
## Default S3 method:
wtsplot(
dat_in,
ref = NULL,
wins = list(0.5, 10, NULL),
min_obs = TRUE,
slice = FALSE,
dt_rng = NULL,
pt_rng = c(1, 12),
col_vec = NULL,
col_lns = NULL,
alpha = 1,
as_list = FALSE,
...
)
## S3 method for class 'tidal'
wtsplot(dat_in, ...)
## S3 method for class 'tidalmean'
wtsplot(dat_in, ...)
```

`dat_in` |
input tidal object |

`...` |
arguments passed to other methods |

`ref` |
chr string indicating the date at the center of the weighting window. Must be in the format 'YYYY-mm-dd' which is passed to |

`wins` |
list with three elements passed to |

`min_obs` |
logical to use window widening if less than 100 non-zero weights are found, passed to |

`slice` |
logical indicating if only weights bounded by the year window (i.e., the limiting window for the combined weights) are shown, passed to |

`dt_rng` |
Optional chr string indicating the date range for all plots except seasonal (day) weights. Must be two values in the format 'YYYY-mm-dd' which is passed to |

`pt_rng` |
numeric vector of two elements indicating point scaling for all weights in the plot of salinity/flow vs time. |

`col_vec` |
chr string of plot colors to use, passed to |

`col_lns` |
chr string of line color in plots |

`alpha` |
numeric value from zero to one indicating transparency of points and lines |

`as_list` |
logical indicating if plots should be returned in a list |

Create diagnostic plots to view the effects of different weighting windows on model predictions. The plots illustrate the weights that are used when fitting a weighted regression in reference to a single observation. The process is repeated for all observations when the entire model is fit. Five plots are produced by the function, each showing the weights in relation to time and the selected observation (i.e., center of the weighting window). The top plot shows salinity/flow over time with the points colored and sized by the combined weight vector. The remaining four plots show the weights over time for each separate weighting component (months/days, year, and salinity/flow) and the final combined vector.

A combined `ggplot`

object created using `grid.arrange`

. A list with elements for each individual plot will be returned if `as_list = TRUE`

.

`getwts`

```
## load a fitted tidal object
data(tidfit)
## plot using defaults,
wtsplot(tidfit)
## change the defaults
wtsplot(tidfit, ref = '2000-01-01', wins = list(0.5, 15, Inf),
dt_rng = c('1990-01-01', '2010-01-01'),
pt_rng = c(3, 8), col_vec = c('lightgreen', 'lightblue', 'purple'),
alpha = 0.7)
```

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.