dot-get_pred: Create Predicted Values + Upper and Lower Bounds for...

Description Usage Arguments Value Examples

Description

Create Predicted Values + Upper and Lower Bounds for Confidence Interval

Usage

1
.get_pred(fit, new_data)

Arguments

fit

- model used for making predictions

new_data

- dataframe or matrix used for prediction

Value

- list of predictions and lower and upper bounds of confidence interval

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
#Load data
data(mtcars)

#Create simple regression model
fit = stats::lm(mpg ~ wt, data = mtcars)

#Create new set of data for prediction
new_wt = seq(min(mtcars$wt), max(mtcars$wt))
new_data = data.frame(wt = new_wt)

#Use get_pred to get predictions and confidence bounds
mpg_pred = .get_pred(fit, new_data)

#Show output for predicted y
mpg_pred$fHat

#Show output for upper and lower bounds
mpg_pred$ub
mpg_pred$lb

christithomp/scamplot documentation built on Dec. 10, 2019, 11:33 a.m.