add_probs.lm {ciTools}  R Documentation 
This is the method add_probs
uses if the model is of class
lm
. Probabilities are calculated parametrically,
using a pivotal quantity.
## S3 method for class 'lm'
add_probs(
df,
fit,
q,
name = NULL,
yhatName = "pred",
comparison = "<",
log_response = FALSE,
...
)
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.
# 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 = ">")