SLR_prediction.data.frame: SLR prediction S3 method for data frames

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 'data.frame'
SLR_prediction(y, col_response = 1,
  col_exploratory = 2, pre_x_value = mean(y[, col_exploratory]))

Arguments

y

a numeric data.frame containing the response and exploratory variable

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

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
special <- 6
Y<-data.frame(c(1:5),c(1,3,4.5,7,8))
SLR_prediction(Y,pre_x_value = special)

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