Metadata-Version: 2.4
Name: robustbase-py-optimized
Version: 0.1.0
Summary: A Python port of the R robustbase package with optimized performance using JAX
Author: Eichi Uehara
License:                     GNU GENERAL PUBLIC LICENSE
                               Version 3, 29 June 2007
        
         Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
         Everyone is permitted to copy and distribute verbatim copies
         of this license document, but changing it is not allowed.
        
                                    Preamble
        
          The GNU General Public License is a free, copyleft license for
          software and other kinds of works.
        
          (The full text of the GNU GPL v3 is available at https://www.gnu.org/licenses/gpl-3.0.txt)
          
          This program is free software: you can redistribute it and/or modify
          it under the terms of the GNU General Public License as published by
          the Free Software Foundation, either version 3 of the License, or
          (at your option) any later version.
        
          This program is distributed in the hope that it will be useful,
          but WITHOUT ANY WARRANTY; without even the implied warranty of
          MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
          GNU General Public License for more details.
        
          You should have received a copy of the GNU General Public License
          along with this program.  If not, see <https://www.gnu.org/licenses/>.
        
Project-URL: Homepage, https://github.com/EichiUehara/robustbase-py
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
Classifier: Operating System :: OS Independent
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy
Requires-Dist: jax
Requires-Dist: jaxlib
Dynamic: license-file

# robustbase-py

A Python port of the R `robustbase` package.

## Description

This package implements robust statistical methods, primarily focusing on robust regression (LMROB) as implemented in the R `robustbase` package. It provides MM-estimators initialized by S-estimators for high breakdown point and efficiency.

## Installation

```bash
pip install robustbase-py
```

## Usage

```python
import numpy as np
from robustbase import LMROB

# Generate synthetic data with outliers
n = 100
p = 3
rng = np.random.default_rng(42)
X = rng.standard_normal((n, p))
beta_true = np.array([1.0, 2.0, 0.5])
y = X @ beta_true + rng.standard_normal(n)

# Contaminate data (outliers)
y[:10] = 100.0

# Fit Robust Linear Regression
model = LMROB(method='MM', psi='bisquare')
model.fit(X, y)

print("Estimated Coefficients:", model.coef_)
print("True Coefficients:", beta_true)
print("Robust Scale:", model.scale_)
```

## Features

- **LMROB**: MM-estimator regression (S-init).
- **Psi Functions**: Bisquare, Huber.
- **Fast-S Algorithm**: For robust scale estimation and initialization.

## License

GPL-3.0
