Description Usage Arguments Value See Also Examples
This is the method add_probs
uses if the model is of class
lm
. Probabilities are calculated parametrically,
using a pivotal quantity.
1 2 3 4 5 6 7 8 9 10 11 |
df |
A data frame of new data. |
fit |
An object of class |
q |
A real number. A quantile of the response distribution. |
name |
|
yhatName |
A character vector of length one. Names of the |
comparison |
|
log_response |
A logical. Default is |
... |
Additional arguments. |
A dataframe, df
, with predicted values and
probabilities attached.
add_ci.lm
for confidence intervals for
lm
objects, add_pi.lm
for prediction
intervals of lm
objects, and
add_quantile.lm
for response quantiles of
lm
objects.
1 2 3 4 5 6 7 8 9 10 | # Fit a linear model
fit <- lm(dist ~ speed, data = cars)
# Calculate the probability that a new dist will be less than 20,
# given the model.
add_probs(cars, fit, q = 20)
# Calculate the probability that a new dist will be greater than
# 30, given the model.
add_probs(cars, fit, q = 30, comparison = ">")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.