Description Usage Arguments Details Value Author(s) See Also Examples
View source: R/SLR_prediction_vis.R
Simple visualization tool for predictions within a simple linear regression model.
1 2 3 4 | ## S3 method for class 'matrix'
SLR_prediction_vis(y, col_response = 1,
col_exploratory = 2, pre_x_value = mean(y[, col_exploratory]),
pre_col = "red", reg_col = "blue")
|
y |
a numeric |
col_response |
column number of the response variable within y (default is 1) |
col_exploratory |
column number of the exploratory variable within y (default is 2) |
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 |
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.
a scatterplot of the two variables + regression line + highlighted prediction
Emanuel Sommer
1 2 3 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.