sup_single_subsample: Supervised single subsampling method

View source: R/sup_single_subsample.R

sup_single_subsampleR Documentation

Supervised single subsampling method

Description

Construct one augmented subsample containing one observation per subject and (X_k+1, Y_k+1) = (X_new, Y_new). On the augmented subsample, fit model mu.hat. Compute nonconformity scores R_i = |mu.hat(X_i) - Y_i|, i = 1, ..., k+1. The p-value is the proportion of R_i scores greater than or equal to R_k+1. At a given X_new = x, the prediction set is the set of all (x, y) with p-values >= alpha.

Usage

sup_single_subsample(
  xy_data,
  model_formula,
  alpha,
  n_val,
  k_indices,
  grid_values,
  new_xy_data
)

Arguments

xy_data

Data frame containing observations and outcomes for all subjects. Must include a Subject column that identifies subjects.

model_formula

Linear model formula for mu.hat which will be fit on augmented samples of one observation per subject plus hypothetical data on new subject

alpha

Significance level

n_val

Number of observations from each subject. For our examples, we assume this is equal across subjects.

k_indices

Labels of subjects to be treated as observed data

grid_values

Vector of starting values to start for lower and upper bounds of prediction interval. Should contain values across the range of Y.

new_xy_data

Covariate and outcome data for new subject

Value

List containing prediction interval size at new observation's covariate values, prediction interval lower bound at new observation's covariate values, prediction interval upper bound at new observation's covariate values, and whether new observation's outcome is contained inside prediction interval.


RobinMDunn/ConformalTwoLayer documentation built on March 22, 2022, 6:38 p.m.