Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

actvspred

Comparison of actual and predicted linear response


Description

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

Usage

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

Examples

# 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

Easy Data Manipulation, Data Quality and Statistical Checks

v1.0
GPL-2
Authors
Akash Jain
Initial release
2015-03-24

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.