score.apd_hat_values {applicable}R Documentation

Score new samples using hat values

Description

Score new samples using hat values

Usage

## S3 method for class 'apd_hat_values'
score(object, new_data, type = "numeric", ...)

Arguments

object

A apd_hat_values object.

new_data

A data frame or matrix of new predictors.

type

A single character. The type of predictions to generate. Valid options are:

  • "numeric" for a numeric value that summarizes the hat values for each sample across the training set.

...

Not used, but required for extensibility.

Value

A tibble of predictions. The number of rows in the tibble is guaranteed to be the same as the number of rows in new_data. For type = "numeric", the tibble contains two columns hat_values and hat_values_pctls. The column hat_values_pctls is in percent units so that a value of 11.5 indicates that, in the training set, 11.5 percent of the training set samples had smaller values than the sample being scored.

Examples

train_data <- mtcars[1:20,]
test_data <- mtcars[21:32,]

hat_values_model <- apd_hat_values(train_data)

hat_values_scoring <- score(hat_values_model, new_data = test_data)
hat_values_scoring


[Package applicable version 0.0.1.2 Index]