# StochFracPoisson

An R package implementing advanced stochastic counting processes based on recent research in fractional calculus and stochastic subordination.

## Installation

```r
## Installation

You can install the package from the local source directory:

```r
# Install from local source
install.packages("path/to/StochFracPoisson", repos = NULL, type = "source")
```

## Overview

This package implements the following stochastic processes:

### Fractional Counting Processes
- **Fractional Counting Process (FCP)**: A generalized counting process using three-parameter Mittag-Leffler functions
- **Time-Changed FCP (TCFCP)**: FCP subordinated by Lévy subordinators
- **Compound Generalized FCP (CGFCP)**: Compound version with random jump sizes

### Risk Processes
- **Generalized Fractional Risk Process (GFRP)**: Insurance risk models with fractional counting processes

### Negative Binomial Processes
- **Tempered Space-Time Fractional Negative Binomial Process (TSTFNBP)**: Tempered Mittag-Leffler subordinated process

### Iterated Processes
- **Generalized Iterated Poisson Process (GIPP)**: Composition of Poisson processes with fractional Bell polynomials

## Special Functions

The package includes implementations of:
- Mittag-Leffler functions (standard and Prabhakar three-parameter)
- Gamma subordinators
- Inverse stable subordinators
- Tempered stable subordinators
- Tempered Mittag-Leffler Lévy processes
- Fractional Bell polynomials
- Fractional Stirling numbers of the second kind

## Example Usage

```r
library(StochFracPoisson)

# Fractional Counting Process
fcp <- fractional_counting_process(mu = 0.8, zeta = 1.0, theta = 0.5, 
                                   lambda = 1.0, t = 1.0, n = 0:10)

# Time-Changed FCP with gamma subordinator
tcfcp <- time_changed_fcp(mu = 0.8, zeta = 1.0, theta = 0.5, lambda = 1.0,
                          subordinator_type = "gamma", 
                          subordinator_params = list(shape = 2, rate = 1),
                          t = 1.0, n = 0:10)

# Generalized Iterated Poisson Process
gipp <- generalized_iterated_poisson(beta = 0.7, lambda = 1.0, 
                                     lambda_beta = 0.5, t = 1.0, k = 0:10)

# Simulate sample paths
sim_data <- simulate_fcp(mu = 0.8, zeta = 1.0, theta = 0.5, lambda = 1.0,
                         t_max = 10, n_paths = 5)
```

## References

Please cite the following papers if you use this package:

1. Garg, S., Pathak, A.K. & Maheshwari, A. Fractional counting process at Lévy times and its applications. *J Stat Phys* 192, 130 (2025). https://doi.org/10.1007/s10955-025-03515-9

2. Soni, R., Pathak, A.K. Generalized Iterated Poisson Process and Applications. *J Theor Probab* 37, 3216–3245 (2024). https://doi.org/10.1007/s10959-024-01362-0

3. Soni, R., Pathak, A.K. Generalized Fractional Risk Process. *Methodol Comput Appl Probab* 26, 42 (2024). https://doi.org/10.1007/s11009-024-10111-z

4. Garg, S., Pathak, A.K. & Maheshwari, A. Tempered Space-Time Fractional Negative Binomial Process. *Methodol Comput Appl Probab* 27, 51 (2025). https://doi.org/10.1007/s11009-025-10179-1

## License

MIT License

## Contributing

Contributions are welcome! Please feel free to submit a Pull Request.
