validate_data: Validate data formatting for logitr models

View source: R/encoding.R

validate_dataR Documentation

Validate data formatting for logitr models

Description

This function checks that data is properly formatted for use with logitr() and provides detailed diagnostic information about potential issues.

Usage

validate_data(
  data,
  outcome,
  obsID,
  pars = NULL,
  scalePar = NULL,
  panelID = NULL
)

Arguments

data

The data frame to validate

outcome

The name of the column that identifies the outcome variable

obsID

The name of the column that identifies each observation

pars

Optional. The names of parameters to check (for additional validation)

scalePar

Optional. The name of the scale parameter column (for WTP models)

panelID

Optional. The name of the panel ID column (for panel data)

Value

An object of class 'logitr_validation' containing validation results

Examples

library(logitr)

# Validate the yogurt dataset
validate_data(yogurt, outcome = "choice", obsID = "obsID")

# Validate with parameters specified
validate_data(yogurt, outcome = "choice", obsID = "obsID",
              pars = c("price", "feat", "brand"))

logitr documentation built on Nov. 18, 2025, 9:06 a.m.