print_prediction: print_prediction

Description Usage Arguments Value Examples

View source: R/print_prediction.R

Description

Given a model and data, print the predicted value.

Usage

1
print_prediction(model, predict_data, ...)

Arguments

model

Model used to make the prediction

predict_data

Data used to make the prediciton

...

Any extra parameters to be passed the predict

Value

Nothing

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
{
job.satisfaction.data <- AdvancedRegression::job_satisfaction
#specifying reference levels
educ.rel <- relevel(job.satisfaction.data$educ, ref = "master")
gender.rel <- relevel(job.satisfaction.data$gender, ref = "F")

#fitting general linear model
fitted.model <- glm(score ~ gender.rel + age + educ.rel,
                    data = job.satisfaction.data,
                    family = gaussian(link = identity))
#using fitted model for prediction
print_prediction(fitted.model,
                 tibble::tibble(gender.rel = "F", age = 40, educ.rel = "bachelor"))
}

ocrug/AdvancedRegression documentation built on Nov. 4, 2019, 10:13 p.m.