R Under development (unstable) (2025-10-21 r88963 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.09090909 > cat("Cluster 1 Params:", paste(result$params1, collapse = ", "), "\n") Cluster 1 Params: 0.885316090750984, 0.212247756792799, 0.941703086536024, 0.804125074113182 > cat("Cluster 2 Params:", paste(result$params2, collapse = ", "), "\n") Cluster 2 Params: 1.25863272187167, 0.122534818625899, 1e-06, 0.684541682746134 > 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) > > proc.time() user system elapsed 4.39 0.43 4.81