actvspred: Comparison of actual and predicted linear response

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

View source: R/actvspred.R

Description

Takes in actual, predicted linear response and quantile value, and returns average actual and predicted response in each quantile

Usage

1
actvspred(y, yhat, n)

Arguments

y

actual linear response

yhat

predicted linear response

n

quantiles to be created for comparison

Details

actvspred function divides the data into n (given as input by the user) quantiles and computes mean of y and yhat for each quantile. All NA's in n, y and yhat are removed for calculation.

The function also plots a line chart of average actual response and average predicted response over n quantiles. This plot can be used to visualize how close both the lines are.

Value

a data.frame with average actual and predicted response in each quantile

Author(s)

Akash Jain

See Also

mape, splitdata

Examples

1
2
3
4
5
6
# A 'data.frame' with y and yhat
df <- data.frame(y = c(1, 2, 3, 6, 8, 10, 15),
                 yhat = c(1.2, 2.5, 3.3, 6.9, 9.3, 6.5, 12.3))

# Get actual vs predicted table
ACTVSPRED <- actvspred(y = df[, 'y'], yhat = df[, 'yhat'], n = 5)

StatMeasures documentation built on May 2, 2019, 1:44 p.m.