Learn R Programming

broom (version 0.4.0)

rq_tidiers: 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
data
Original data, defaults to extracting it from the model
newdata
If provided, new data frame to use for predictions
...
other arguments passed on to summary.rq

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:

  • termThe term in the nonlinear model being estimated and tested
  • estimateThe estimated coefficient
  • std.errorThe standard error from the linear model
  • statistict-statistic
  • p.valuetwo-sided p-value
  • glance.rq returns one row for each quantile (tau) with the columns:
  • tauquantile estimated
  • logLikthe data's log-likelihood under the model
  • AICthe Akaike Information Criterion
  • BICthe Bayesian Information Criterion
  • df.residualresidual degrees of freedom
  • glance.rq returns one row for each quantile (tau) with the columns:
  • tauquantile estimated
  • logLikthe data's log-likelihood under the model
  • AICthe Akaike Information Criterion
  • BICthe Bayesian Information Criterion
  • df.residualresidual degrees of freedom
  • augment.rq returns a row for each original observation with the following columns added:
  • .residResiduals
  • .fittedFitted quantiles of the model
  • .tauQuantile 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.lowLower confidence interval value
  • .conf.highUpper 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:

  • .residResiduals
  • .fittedFitted quantiles of the model
  • .tauQuantile estimated
  • predict.rqs does not return confidence interval estimates.

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

  • .residResiduals
  • .fittedFitted quantiles of the model

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.