Description Usage Arguments Details Value Author(s) See Also Examples
View source: R/SLR_prediction.R
Predicting with a simple linear regression model. (S3 generic function)
1 | SLR_prediction(y, exploratory, col_response, col_exploratory, pre_x_value)
|
y |
depends on the class of the input: for
|
exploratory |
numeric vector representing the exploratory variable, must have the same length as y (for the input class numeric only) |
col_response |
column number of the response variable within y (default is 1) (for data frames and matrices only) |
col_exploratory |
column number of the exploratory variable within y (default is 2) (for data frames and matrices only) |
pre_x_value |
the numeric value (within the range of the exploratory vector) for which the prediction is made |
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 returned.
the predicted value of the response variable
Emanuel Sommer
SLR_prediction_vis
SLR_prediction.numeric
SLR_prediction.data.frame
SLR_prediction.matrix
1 2 3 4 5 6 7 8 9 10 11 | ##numeric S3 method
response <- c(1:5)
exploratory <- c(1,3,4.5,7,8)
special <- 6
SLR_prediction(response,exploratory,pre_x_value = special)
##data.frame S3 method
Y<-data.frame(c(1:5),c(1,3,4.5,7,8))
SLR_prediction(Y,pre_x_value = special)
##matrix S3 method is eqivalently used as the one for data frames
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.