Model Evaluation

Description

Used for cross-validation. For a model of class "rqPen" it provides the average prediction error given the evaluation function of choice.

Usage

1
model_eval(model, test_x, test_y, func="check",...)

Arguments

model

Model of class "rqPen".

test_x

Covariates used for prediction.

test_y

Response to compare predictions against.

func

Function used for evaluation. Options: "check" (Quantile Check), "SqErr" (Squared Error), "AE" (Absolute Value)

...

Additional arguments to be sent to evaluation function. For instance check requires tau which is not part of the model_eval function.

Value

Mean of prediction errors using the chosen function.

Author(s)

Ben Sherwood

Examples

1
2
3
4
5
6
7
8
9
x <- matrix(rnorm(800),ncol=8)
y <- 1 + x[,1] - 3*x[,5] + rnorm(100)
l_model <- rq.lasso.fit(x,y,lambda=1)
nc_model <- rq.nc.fit(x,y,lambda=1)
newx <- matrix(rnorm(16),ncol=8)
newy <- 1 + newx[,1] - 3*newx[,5] + rnorm(2)
model_eval(l_model, newx, newy)
model_eval(l_model, newx, newy, func="SqErr")
model_eval(nc_model, newx, newy)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.