SLR_prediction_vis.numeric: SLR prediction visualization numeric S3 method

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/SLR_prediction_vis.R

Description

Simple visualization tool for predictions within a simple linear regression model.

Usage

1
2
3
## S3 method for class 'numeric'
SLR_prediction_vis(y, exploratory,
  pre_x_value = mean(exploratory), pre_col = "red", reg_col = "blue")

Arguments

y

a numeric vector (the response variable)

exploratory

a numeric vector (the exploratory variable with the same length as y)

pre_x_value

the numeric value (within the range of the exploratory vector) for which the prediction is made

pre_col

color of the highlighted prediction within the scatterplot

reg_col

color of the regression line

Details

The generic function first builds a simple linear regression model with one response and one exploratory variable. Then the prediction for a given value of the exploratory variable (default the mean and no out of sample predictions) gets computed.(see SLR_prediction) Finally using these bits of information a scatterplot of the two variables with the regression line gets returned. Moreover the predicition will be highlighted in the scatterplot and the exact values of the predicition will be displayed above the plot.

Value

a scatterplot of the two variables + regression line + highlighted prediction

Author(s)

Emanuel Sommer

See Also

SLR_prediction

Examples

1
2
3
4
response <- c(1:5)
exploratory <- c(1,3,4.5,7,8)
special <- 6
SLR_prediction_vis(response,exploratory,pre_x_value = special)

EmanuelSommer/SLRprediction documentation built on Nov. 22, 2020, 3:18 p.m.