R Under development (unstable) (2025-10-07 r88904 ucrt) -- "Unsuffered Consequences" Copyright (C) 2025 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > # Clean environment and load libraries > rm(list = ls()) # Clear environment to avoid conflicts > > # Source filess > library(MixStable) Attaching package: 'MixStable' The following object is masked from 'package:graphics': clip > > > # Set seed and generate synthetic data > set.seed(0) > S <- rnorm(77) > u <- seq(min(S), max(S), length.out = 100) > > # Fit the model using the custom EM algorithm > result <- em_stable_mixture(S, u, estimator_func = estimate_stable_weighted_ols) There were 50 or more warnings (use warnings() to see the first 50) > > # Print results > cat("Estimated Weights:", result$weights, "\n") Estimated Weights: 0.1038961 > cat("Cluster 1 Params:", paste(result$params1, collapse = ", "), "\n") Cluster 1 Params: 0.712704493344931, -1, 1.15373023533946, 0.249101338238031 > cat("Cluster 2 Params:", paste(result$params2, collapse = ", "), "\n") Cluster 2 Params: 1.2374983912734, -0.328834961577314, 1e-06, 0.664606442091634 > cat("Log-Likelihood:", result$log_likelihood, "\n") Log-Likelihood: -Inf > > # Plot the final mixture fit > plot_final_mixture_fit(S, result$params1, result$params2, result$weights) Plotting mixture: Weight: 0.1038961 Params1: 0.712704493344931, -1, 1.15373023533946, 0.249101338238031 Params2: 1.2374983912734, -0.328834961577314, 1e-06, 0.664606442091634 null device 1 > > proc.time() user system elapsed 4.50 0.50 4.78