Description Usage Arguments Details Value See Also Examples
View source: R/add_quantile_lm.R
This function is one of the methods of add_quantile
. It is
called automatically when add_quantile
is called on objects
of class lm
.
1 2 3 4 5 6 7 8 9 10 |
df |
A data frame of new data. |
fit |
An object of class |
p |
A real number between 0 and 1. Sets the level of the quantiles. |
name |
|
yhatName |
A string. Name of the vector of predictions. |
log_response |
A logical. If TRUE, quantiles will be generated for the prediction made with a log-linear model: \log(Y) = Xβ + ε. These quantiles will be on the scale of the original response, Y. |
... |
Additional arguments. |
Quantiles for linear models are determined parametrically, by applying a pivotal quantity to the distribution of Y|x.
A dataframe, df
, with predicted values and level -
p quantiles attached.
add_ci.lm
for confidence intervals for
lm
objects, add_pi.lm
for prediction
intervals of lm
objects, and add_probs.lm
for response probabilities of lm
objects.
1 2 3 4 5 6 7 8 9 | # Fit a linear Model
fit <- lm(dist ~ speed, data = cars)
# Find the 0.7-quantile (70th percentile) of new distances, given
# the linear model fit.
add_quantile(cars, fit, p = 0.7)
# As above, but with a custom name for the vector of quantiles
add_quantile(cars, fit, p = 0.7, name = "my_quantile")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.