Comparison of actual and predicted linear response
Takes in actual, predicted linear response and quantile value, and returns average actual and predicted response in each quantile
actvspred(y, yhat, n)
y |
actual linear response |
yhat |
predicted linear response |
n |
quantiles to be created for comparison |
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.
a data.frame with average actual and predicted response in each quantile
Akash Jain
# 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)Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.