SLR_prediction.numeric: SLR prediction numeric S3 method

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

View source: R/SLR_prediction.R

Description

Predicting with a simple linear regression model

Usage

1
2
3
## S3 method for class 'numeric'
SLR_prediction(y, exploratory,
  pre_x_value = mean(exploratory))

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

Details

The 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.

Value

the predicted value of the response variable

Author(s)

Emanuel Sommer

See Also

SLR_prediction_vis

Examples

1
2
3
4
5
##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)

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