dot-hurdle_prepare_data: Prepare Hurdle Model Data

.hurdle_prepare_dataR Documentation

Prepare Hurdle Model Data

Description

Internal function to prepare data structures for TMB hurdle model fitting. Converts subject IDs to 0-indexed integers and creates derived variables.

Usage

.hurdle_prepare_data(data, y_var, x_var, id_var)

Arguments

data

A validated data frame.

y_var

Character string, name of consumption variable.

x_var

Character string, name of price variable.

id_var

Character string, name of subject ID variable.

Value

A list containing:

price

Numeric vector of prices

consumption

Numeric vector of consumption values

delta

Integer vector (1 if consumption == 0, else 0)

logQ

Log consumption (0 for zeros)

subject_id

0-indexed subject IDs for C++

subject_levels

Unique subject IDs (original)

n_subjects

Number of unique subjects


beezdemand documentation built on March 3, 2026, 9:07 a.m.