| fit_demand_fixed | R Documentation |
Modern interface for fitting individual demand curves via nonlinear
least squares. Returns a structured S3 object with standard methods
including summary(), tidy(), and glance().
fit_demand_fixed(
data,
equation = c("hs", "koff", "simplified", "linear", "exponential", "exponentiated"),
k = 2,
agg = NULL,
x_var = "x",
y_var = "y",
id_var = "id",
param_space = c("natural", "log10"),
...
)
data |
Data frame in long format with columns: |
equation |
Character. Equation type: |
k |
Scaling constant. Numeric value (fixed), |
agg |
Character. Aggregation method: |
x_var |
Character. Name of the price column. Default |
y_var |
Character. Name of the consumption column. Default |
id_var |
Character. Name of the subject identifier column. Default |
param_space |
Character. Parameterization used for fitting. One of:
|
... |
Additional arguments passed to the underlying |
This function is a modern wrapper around the legacy FitCurves() function.
It provides the same fitting capabilities but returns a structured S3 object
with standardized methods for model interrogation.
An object of class beezdemand_fixed with components:
Data frame of fitted parameters for each subject
List of model fit objects (if detailed = TRUE internally)
List of prediction data frames
List of data frames used for each fit
The original function call
The equation form used
Description of k specification
Aggregation method used
Total number of subjects/fits attempted
Number of successful fits
Number of failed fits
data(apt)
fit <- fit_demand_fixed(apt, equation = "hs", k = 2)
print(fit)
summary(fit)
tidy(fit)
glance(fit)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.