There are more than 20,000 R packages, most of which import other R packages. You can ask ChatGPT on high or extra high mode to translate the computational algorithms of an R package, given a zip file of its code, to an FPM package, ignoring plotting, and provide translated packages for dependencies if they exist, and ChatGPT will do so in 10-20 minutes. When a package contains C, C++, or FORTRAN code, this is also translated to modern Fortran. If this is done in the chat interface it does not eat into the Codex quota. So far I have translated 490 R packages to FPM in the areas of
- Time Series Analysis
- Empirical Finance
- Missing Data
- Optimization and Mathematical Programming
- Numerical Mathematics
- Probability Distributions
ChatGPT tests its translations against the R originals. I have looked at the results of the translation of the rugarch package myself, and they look correct, but in general the translations have not been verified by a human. In about 1/4 of cases ChatGPT asserts there is a flaw in the code of the R package that it has fixed in the translation. I need to review these assertions and report bugs to the maintainers of R packages. Once you have translated the algorithms of a package to Fortran it is straightforward to call the code from Python, Octave/Matlab, and R with a Fortran wrapper that uses explicit shape arrays (translations used assumed shape). This has been done for a few translations and will eventually be done for all. In about 100 tests of R vs. translated Fortran I saw a median speedup of a factor of 5.4. Since the LLM has access to the R code while translating, the translations inherit the license of the R code, which is usually GPL-2.0-or-later or GPL-3.0-only, and licenses are listed in the translations. Many packages share algorithms, some of which have been centralized in shared modules. I use and credit fortran-lapack of @FedericoPerini. Unlike Numerical Recipes, IMSL, or NAG, R packages are a decentralized set of codes, often contributed by professors as part of their research, so there is considerable overlap in R packages. I would like to create a comprehensive Fortran library from the individual packages. Besides the areas listed above, there many packages in the following domains that would make sense to translate.
| ActuarialScience | Actuarial Science |
|---|---|
| AnomalyDetection | Anomaly Detection |
| Bayesian | Bayesian Inference |
| CausalInference | Causal Inference |
| ClinicalTrials | Clinical Trial Design, Monitoring, Analysis and Reporting |
| Cluster | Cluster Analysis & Finite Mixture Models |
| CompositionalData | Compositional Data Analysis |
| DifferentialEquations | Differential Equations |
| Econometrics | Econometrics |
| Environmetrics | Analysis of Ecological and Environmental Data |
| Epidemiology | Epidemiology |
| ExperimentalDesign | Design of Experiments (DoE) & Analysis of Experimental Data |
| ExtremeValue | Extreme Value Analysis |
| FunctionalData | Functional Data Analysis |
| GraphicalModels | Graphical Models |
| Hydrology | Hydrological Data and Modeling |
| MachineLearning | Machine Learning & Statistical Learning |
| MetaAnalysis | Meta-Analysis |
| MissingData | Missing Data |
| MixedModels | Mixed, Multilevel, and Hierarchical Models in R |
| NetworkAnalysis | Network Analysis |
| Omics | Genomics, Proteomics, Metabolomics, Transcriptomics, and Other Omics |
| Pharmacokinetics | Analysis of Pharmacokinetic Data |
| Phylogenetics | Phylogenetics |
| Psychometrics | Psychometric Models and Methods |
| Robust | Robust Statistical Methods |
| Spatial | Analysis of Spatial Data |
| SpatioTemporal | Handling and Analyzing Spatio-Temporal Data |
| Survival | Survival Analysis |
| Tracking | Processing and Analysis of Tracking Data |