Structural-break detection in high-dimensional factor models using QML methods.
Project description
fmbqml: Structural Break Analysis in High-Dimensional Factor Models
fmbqml is a Python package for quasi-maximum-likelihood analysis of
structural breaks in high-dimensional factor models. It provides tools for
single-break testing and estimation, joint multiple-break estimation, sup-LR
testing, factor-number selection, break-type classification, and diagnostic
plots.
Links
Installation
Install the package from PyPI with:
python -m pip install fmbqml
For development from a source checkout, use:
python -m pip install -e .
Input data
The input data should be a finite two-dimensional NumPy array or pandas DataFrame with observations in rows and variables in columns. Missing values should be imputed before constructing a model.
Single-break analysis
Assuming that panel_data contains the input panel dataset:
from fmbqml import SingleBreakQML
model = SingleBreakQML(
panel_data,
trim_ratio=0.15,
max_factors=10,
factor_criterion="IC2",
)
result = model.lr_test(
alpha=0.05,
classify=True,
n_sim=5000,
random_state=12345,
)
print(result["reject_null"])
print(result["break_point"])
print(result.get("break_type"))
Use estimate_breakpoint() when a break is assumed to exist and significance
testing is not required. In lr_test(), break_point is returned when the
no-break null is rejected, while estimated_break_candidate records the
profile optimizer.
Multiple-break analysis
from fmbqml import MultiBreakQML
model = MultiBreakQML(
panel_data,
max_break=5,
max_factors=8,
factor_criterion="IC2",
trim_ratio=0.10,
)
result = model.estimate_breaks_jointly(
min_break=0,
classify=True,
)
print(result["n_breaks"])
print(result["breakpoints"])
print(result.get("break_types"))
The option min_break=0 permits selection of a no-break model. Use
joint_sup_lr_test(n_breaks=...) to test no structural change against an exact
number of breaks.
Factor-number selection
factor_criterion accepts IC1, IC2, IC3, PC1, PC2, PC3, AIC3,
or BIC3. Integer indices 0 through 7 are also accepted in that order.
The argument max_factors is a search bound and should be smaller than
min(T, N).
Results and model state
Result dictionaries contain NumPy arrays for available profiles and nested structures for breakpoint classifications and information-criterion paths. For example, single-break procedures store candidate break locations together with LR or QML profile values, while multiple-break joint estimation stores the selected breakpoints and the information-criterion path used to choose the number of breaks.
Public result methods return independent copies of the cached results, so
changing a returned object does not modify the model's internal state. Calling
set_data() or set_parameters() validates the new values and clears previous
estimates. Retrieve results with get_test_results(), get_joint_results(),
or get_joint_test_results() after running the corresponding procedure.
Reproducibility
All stochastic procedures accept an explicit random seed. For reproducible
critical values, pass random_state to lr_test(), joint_sup_lr_test(), and
profile plotting routines that simulate critical values.
Example scripts demonstrating the main functionality of fmbqml are available
in the project repository:
Dependencies
fmbqml depends on NumPy, SciPy, pandas, matplotlib, and joblib. Python 3.8 or
newer is required.
License
fmbqml is distributed under the MIT License. See
LICENSE.txt.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fmbqml-0.1.1.tar.gz.
File metadata
- Download URL: fmbqml-0.1.1.tar.gz
- Upload date:
- Size: 46.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b9e56424164731be61bd007e7de56058478bec440a93b2f0f62a9987b43b3278
|
|
| MD5 |
9e8058ede3d7b8dc7dfb76c7071ae2f7
|
|
| BLAKE2b-256 |
f33706d9416c8e3f3d2e8b56c1a43f0a7b4f13f7882ccefcc3e5fcbe35f2022a
|
File details
Details for the file fmbqml-0.1.1-py3-none-any.whl.
File metadata
- Download URL: fmbqml-0.1.1-py3-none-any.whl
- Upload date:
- Size: 55.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3e79ccff7f0abb4e237b4bcc080478f85363751b3555f657680abb10b32b1ccb
|
|
| MD5 |
1b866468185584bd2d5f0607ed1a0f21
|
|
| BLAKE2b-256 |
43845b0d5198ad31f6b96af948a21dc66157a96cca4735ec2d60b5335cb43863
|