- data
The data of analysis
- model
A formula specifying the long-run model equation. This formula defines the relationships
between the dependent variable and explanatory variables, including options for deterministic terms,
asymmetric variables, and a trend component.
Example formula:
y ~ x + z + asym(z) + asymL(x2 + x3) + asymS(x3 + x4) + deterministic(dummy1 + dummy2) + trend
Details
The formula allows flexible specification of variables and their roles in the model:
- Deterministic variables (e.g., dummies) can be included using deterministic(). Multiple
deterministic variables can be added with + (e.g., deterministic(dummy1 + dummy2)).
These variables are considered fixed and are not associated with short-run or long-run dynamics.
- Asymmetric variables can be included for both short-run and long-run dynamics:
asymS: Specifies short-run asymmetric variables. For example,
asymS(x1 + x2) includes variables x1 and x2 for short-run asymmetry.
asymL: Specifies long-run asymmetric variables. For example,
asymL(x1 + x3) includes variables x1 and x3 for long-run asymmetry.
asym: Includes variables for both short-run and long-run asymmetry.
For example, asym(x1 + x3) applies asymmetric decomposition for both dynamics.
A trend term can be added to the model to account for deterministic linear trends
over time. Simply include trend in the formula.
These components can be combined flexibly in the formula to define a robust model tailored
to your analysis.
- case
Numeric or character. Specifies the case of the test to be used in the function.
Acceptable values are 1, 2, 3, 4, 5, and "auto". If "auto" is chosen, the function determines the case automatically based on the model's characteristics. Invalid values will result in an error.
1: No intercept and no trend
2: Restricted intercept and no trend
3: Unrestricted intercept and no trend
4: Unrestricted intercept and restricted trend
5: Unrestricted intercept and unrestricted trend
- signif_level
Character or numeric. Specifies the significance level to be used in the function.
Acceptable values are "auto", "0.10", "0.1", "0.05", "0.025", and "0.01".
If a numeric value is provided, it will be converted to a character string.
If "auto" is chosen, the function determines the significance level automatically.
Invalid values will result in an error.
- maxlag
An integer specifying the maximum number of lags to be considered for the model.
The default value is 4. This parameter sets an upper limit on the lag length during
the model estimation process.
details
The maxlag parameter is crucial for defining the maximum lag length that the model
will evaluate when selecting the optimal lag structure based on the specified criterion.
It controls the computational effort and helps prevent overfitting by restricting the search
space for lag selection.
If the data has a short time horizon or is prone to overfitting, consider reducing maxlag.
-
If the data is expected to have long-term dependencies, increasing maxlag may be necessary to capture the relevant dynamics.
Setting an appropriate value for maxlag depends on the nature of your dataset and the
context of the analysis:
For small datasets or quick tests, use smaller values (e.g., maxlag = 2).
For datasets with more observations or longer-term patterns, larger values (e.g., maxlag = 8) may be appropriate, though this increases computational time.
examples
Using the default maximum lag (4)
kardl(data, MyFormula, maxlag = 4)
Reducing the maximum lag to 2 for faster computation
kardl(data, MyFormula, maxlag = 2)
Increasing the maximum lag to 8 for datasets with longer dependencies
kardl(data, MyFormula, maxlag = 8)
- mode
Specifies the mode of estimation and output control. This parameter determines how
the function handles lag estimation and what kind of feedback or control is provided during
the process. The available options are:
"quick" (default):
Displays progress and messages in the console while the function estimates the optimal lag values.
This mode is suitable for interactive use or for users who want to monitor the estimation process
in real-time. It provides detailed feedback for debugging or observation but may use additional
resources due to verbose output.
"grid" :
Displays progress and messages in the console while the function estimates the optimal lag values.
This mode is suitable for interactive use or for users who want to monitor the estimation process
in real-time. It provides detailed feedback for debugging or observation but may use additional
resources due to verbose output.
"grid_custom":
Suppresses most or all console output, prioritizing faster execution and reduced resource usage
on PCs or servers. This mode is recommended for high-performance scenarios, batch processing,
or when the estimation process does not require user monitoring. Suitable for large-scale or
repeated runs where output is unnecessary.
User-defined vector:
A numeric vector of lag values specified by the user, allowing full customization of the lag
structure used in model estimation. When a user-defined vector is provided (e.g., `c(1, 2, 4, 5)`),
the function skips the lag optimization process and directly uses the specified lags.
- Users can define lag values directly as a numeric vector. For example:
mode = c(1, 2, 4, 5) assigns lags of 1, 2, 4, and 5 to variables in the specified order.
- Alternatively, lag values can be assigned to variables by name for clarity and control. For example:
mode = c(CPI = 2, ER_POS = 3, ER_NEG = 1, PPI = 3) assigns lags to variables explicitly.
- Ensure that the lags are correctly designated by verifying the result using
kardl_model$properLag after estimation.
Attention!
-A function-based criterion or user-defined function can be specified
for model selection, but this is only supported for mode = "grid_custom"
and mode = "quick". The mode = "grid" option is restricted to
predefined criteria (e.g., AIC or BIC). For more information on available criteria,
see the modelCriterion function documentation.
- When using a numeric vector, ensure the order of lag values matches the variables in your formula.
- If using named vectors, double-check the variable names to avoid mismatches or unintended results.
- This mode bypasses the automatic lag optimization and assumes the user-defined lags are correct.
The `mode` parameter provides flexibility for different use cases:
- Use `"grid"` mode for debugging or interactive use where progress visibility is important.
- Use `"grid_custom"` mode to minimize overhead in computationally intensive tasks.
- Specify a user-defined vector to customize the lag structure based on prior knowledge or analysis.
Selecting the appropriate mode can improve the efficiency and usability of the function depending
on the user's requirements and the computational environment.
- criterion
A string specifying the information criterion to be used for selecting the optimal lag structure.
The available options are:
"AIC": Akaike Information Criterion (default). This criterion balances model fit and complexity,
favoring models that explain the data well with fewer parameters.
"BIC": Bayesian Information Criterion. This criterion imposes a stronger penalty for model complexity
than AIC, making it more conservative in selecting models with fewer parameters.
"AICc": Corrected Akaike Information Criterion. This is an adjusted version of AIC that accounts for small sample sizes,
making it more suitable when the number of observations is limited relative to the number of parameters.
"HQ": Hannan-Quinn Information Criterion. This criterion provides a compromise between AIC and BIC,
favoring models that balance fit and complexity without being overly conservative.
The criterion can be specified as a string (e.g., "AIC") or as a user-defined function that takes a fitted model object.
Please visit the modelCriterion function documentation for more details on using custom criteria.
- differentAsymLag
A logical value indicating whether to allow different lag lengths for positive and negative decompositions.
- batch
A string specifying the batch processing configuration in the format "current_batch/total_batches".
If a user utilize grid or grid_custom mode and want to split the lag search into multiple batches, this parameter can be used to define the current batch and the total number of batches.
For example, "2/5" indicates that the current batch is the second out of a total of five batches.
The default value is "1/1", meaning that the entire lag search is performed in a single batch.
- ...
Additional arguments that can be passed to the function. These arguments can be used to