R: Tidying methods for quantile regression models

rq_tidiers {broom} | R Documentation

## Tidying methods for quantile regression models

### Description

These methods tidy the coefficients of a quantile regression model into a summary, augment the original data with information on the fitted values and residuals, and construct a glance of the model's statistics.

### Usage

    ## S3 method for class 'rq'
    tidy(x, se.type = "rank", conf.int = TRUE, conf.level = 0.95,
      alpha = 1 - conf.level, ...)

    ## S3 method for class 'rqs'
    tidy(x, se.type = "rank", conf.int = TRUE,
      conf.level = 0.95, alpha = 1 - conf.level, ...)

    ## S3 method for class 'nlrq'
    tidy(x, conf.int = FALSE, conf.level = 0.95, ...)

    ## S3 method for class 'rq'
    glance(x, ...)

    ## S3 method for class 'nlrq'
    glance(x, ...)

    ## S3 method for class 'rq'
    augment(x, data = model.frame(x), newdata, ...)

    ## S3 method for class 'rqs'
    augment(x, data = model.frame(x), newdata, ...)

    ## S3 method for class 'nlrq'
    augment(x, data = NULL, newdata = NULL, ...)

### Arguments

`x` | model object returned by `rq` or `nlrq`
`se.type` | Type of standard errors to calculate; see `summary.rq`
`conf.int` | boolean; should confidence intervals be calculated, ignored if `se.type = "rank"`
`conf.level` | confidence level for intervals
`alpha` | confidence level when `se.type = "rank"`; defaults to the same as `conf.level` although the specification is inverted
`...` | other arguments passed on to `summary.rq`
`data` | Original data, defaults to extracting it from the model
`newdata` | If provided, new data frame to use for predictions

### Details

If `se.type != "rank"` and `conf.int = TRUE` confidence intervals are calculated by `summary.rq`. Otherwise they are standard t based intervals.

This simply calls `augment.nls` on the "nlrq" object.

### Value

All tidying methods return a data.frame without rownames, whose structure depends on the method chosen.

`tidy.rq` returns a data frame with one row for each coefficient. The columns depend upon the confidence interval method selected.

`tidy.rqs` returns a data frame with one row for each coefficient at each quantile that was estimated. The columns depend upon the confidence interval method selected.

`tidy.nlrq` returns one row for each coefficient in the model, with five columns:

`term` | The term in the nonlinear model being estimated and tested
`estimate` | The estimated coefficient
`std.error` | The standard error from the linear model
`statistic` | t-statistic
`p.value` | two-sided p-value

`glance.rq` returns one row for each quantile (tau) with the columns:

`tau` | quantile estimated
`logLik` | the data's log-likelihood under the model
`AIC` | the Akaike Information Criterion
`BIC` | the Bayesian Information Criterion
`df.residual` | residual degrees of freedom

`glance.rq` returns one row for each quantile (tau) with the columns:

`tau` | quantile estimated
`logLik` | the data's log-likelihood under the model
`AIC` | the Akaike Information Criterion
`BIC` | the Bayesian Information Criterion
`df.residual` | residual degrees of freedom

`augment.rq` returns a row for each original observation with the following columns added:

`.resid` | Residuals
`.fitted` | Fitted quantiles of the model
`.tau` | Quantile estimated

Depending on the arguments passed on to `predict.rq` via `...` a confidence interval is also calculated on the fitted values resulting in columns:

`.conf.low` | Lower confidence interval value
`.conf.high` | Upper confidence interval value

See `predict.rq` for details on additional arguments to specify confidence intervals. `predict.rq` does not provide confidence intervals when `newdata` is provided.

`augment.rqs` returns a row for each original observation and each estimated quantile (`tau`) with the following columns added:

`.resid` | Residuals
`.fitted` | Fitted quantiles of the model
`.tau` | Quantile estimated

`predict.rqs` does not return confidence interval estimates.

`augment.rqs` returns a row for each original observation with the following columns added:

`.resid` | Residuals
`.fitted` | Fitted quantiles of the model

[Package broom version 0.4.4 Index]