Get WRTDS residuals for each quantile model. These are used to estimate goodness of fit of the model predictions.

wrtdsrsd(dat_in, ...)

# S3 method for tidal
wrtdsrsd(dat_in, trace = TRUE, ...)

# S3 method for tidalmean
wrtdsrsd(dat_in, trace = TRUE, ...)

Arguments

dat_in

input tidal object which must already have fitted model data

...

arguments passed to or from other methods

trace

logical indicating if progress is shown in the console

Value

Columns are added to the data of the tidal object for residuals and non-conditional residuals. Both are required to assess the goodness of fit measure described for quantile regression in Koenker and Machado (1999).

A tidal object with columns added to the predonobs attribute for the residuals ('rsd') and non-conditional residuals ('rsdnl') of each quantile model or a tidalmean object with columns added to the predonobs attribute for the residuals ('rsd') and back-transformed residuals ('bt_rsd').

References

Koenker, R., Machado, J.A.F. 1999. Goodness of fit and related inference processes for quantile regression. Journal of the American Statistical Association. 94(448):1296-1310.

See also

Examples

## load a fitted model object
data(tidfit)

## run the function
res <- wrtdsrsd(tidfit)
head(res)
#>         date      res       flo       lim not_cens     day_num month year
#> 1 1974-01-01 3.417727 0.4100012 0.8754687     TRUE 0.005479452     1 1974
#> 2 1974-02-01 3.860730 0.5086014 0.8754687     TRUE 0.090410959     2 1974
#> 3 1974-03-01 2.639057 0.3490211 0.8754687     TRUE 0.164383562     3 1974
#> 4 1974-04-01 2.484907 0.3509642 0.8754687     TRUE 0.249315068     4 1974
#> 5 1974-05-01 2.708050 0.3345128 0.8754687     TRUE 0.331506849     5 1974
#> 6 1974-06-01 2.740840 0.3009137 0.8754687     TRUE 0.416438356     6 1974
#>   dec_time   fit0.1   fit0.5   fit0.9  norm0.1  norm0.5  norm0.9
#> 1 1974.005 2.610429 3.267295 3.685544 2.570321 3.083240 3.319924
#> 2 1974.090 2.541529 3.157350 3.831174 2.555630 3.008398 3.435083
#> 3 1974.164 2.545622 2.838006 3.280516 2.598238 2.863887 3.368876
#> 4 1974.249 2.511704 2.649719 3.233701 2.581767 2.717951 3.281687
#> 5 1974.332 2.576503 2.709492 3.360528 2.593957 2.734914 3.346043
#> 6 1974.416 2.747688 2.811803 3.463858 2.745408 2.825647 3.474432