---
title: "Examples: LASSOLKT Preset"
author: "Philip I. Pavlik Jr."
date: "2026-06-07"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{Examples: LASSOLKT Preset}
  %\VignetteEngine{knitr::rmarkdown}
  \usepackage[utf8]{inputenc}
---

```{r setup}
source("lkt-vignette-setup.R")
knitr::opts_chunk$set(eval = run_expensive_vignette)
```

The full LASSO path is intentionally not evaluated during routine CRAN checks.
Set `LKT_RUN_EXPENSIVE_VIGNETTES=true` to execute it when rendering.

# Load data

```{r bundled-data}
val <- prepare_largeraw_sample()
```

# LASSOLKT with preset

```{r lassolkt-preset}
modelob <- LASSOLKTModel(
  data = val,
  gridpars = (1:9) / 10,
  allcomponents = c("Anon.Student.Id", "KC..Default."),
  preset = "PFA",
  target_n = 5
)

check_true("LASSOLKT preset returned a list", is.list(modelob))
check_true("LASSOLKT preset has glmnet fit", inherits(modelob$fit, "glmnet"))
check_true("LASSOLKT preset target AUC finite", is.finite(as.numeric(modelob$target_auc)))
check_true("LASSOLKT preset target coefficients present", nrow(modelob$target_coefs) > 0)
```
