## Confidence Intervals for Linear Model Predictions

### Description

This function is one of the methods in add_ci and automatically is called when an object of class lm is passed to add_ci.

### Usage

## S3 method for class 'lm'
df,
fit,
alpha = 0.05,
names = NULL,
yhatName = "pred",
log_response = FALSE,
...
)


### Arguments

 df A data frame. fit An object of class lm. Predictions are made with this object. alpha A real number between 0 and 1. Controls the confidence level of the interval estimates. names NULL or character vector of length two. If NULL, confidence bounds automatically will be named by add_ci, otherwise, the lower confidence bound will be named names[1] and the upper confidence bound will be named names[2]. yhatName A string. Name of the vector of the predictions made for each observation in df log_response Logical. Default is FALSE. If TRUE, confidence intervals will be generated for the response level of a log-linear model: log(Y) = X\beta + \epsilon. ... Additional arguments.

### Details

Confidence intervals for lm objects are calculated parametrically. This function is essentially a wrapper for predict(fit, df, interval = "confidence") if fit is a linear model. If log_response = TRUE, confidence intervals for the response are calculated using Wald's Method. See Meeker and Escobar (1998) for details.

### Value

A dataframe, df, with predicted values, upper and lower confidence bounds attached.

add_pi.lm for prediction intervals for lm objects, add_probs.lm for conditional probabilities of lm objects, and add_quantile.lm for response quantiles of lm objects.

### Examples

# Fit a linear model
fit <- lm(dist ~ speed, data = cars)
# Get fitted values for each observation in cars, and append
# confidence intervals