Example usage 1
set.seed(123)
n <- 1000
vector <- rweibull(n, 2, 3) # Replace with your vector
start <- proc.time()[3]
simulate_function <- misc::fit_param_dist(vector)
## [1] 17.67329861 0.09061650 0.12501307 4.46394854 0.03302592 NaN
## [7] 0.08655094 0.04391711 Inf 0.04878161 0.90238403 0.02175046
## [1] "Best distribution based on KL divergence: weibull"
end <- proc.time()[3]
print(paste("Time taken:", end - start))
## [1] "Time taken: 0.392"
simulated_data <- simulate_function(n) # Generate 100 samples from the best-fit distribution
par(mfrow = c(1, 2))
hist(vector, main = "Original Data", xlab = "Value", ylab = "Frequency")
hist(simulated_data, main = "Simulated Data", xlab = "Value", ylab = "Frequency")

Example usage 2
set.seed(123)
n <- 1000
vector <- rnorm(n) # Replace with your vector
start <- proc.time()[3]
simulate_function <- misc::fit_param_dist(vector)
## [1] 12.56009975 0.06457125 9.61265383 9.60274199 9.57615179 NaN
## [7] Inf 0.01611113 Inf 0.01283163 0.15734994 Inf
## [1] "Best distribution based on KL divergence: normal"
end <- proc.time()[3]
print(paste("Time taken:", end - start))
## [1] "Time taken: 0.335"
simulated_data <- simulate_function(n) # Generate 100 samples from the best-fit distribution
par(mfrow = c(1, 2))
hist(vector, main = "Original Data", xlab = "Value", ylab = "Frequency")
hist(simulated_data, main = "Simulated Data", xlab = "Value", ylab = "Frequency")

Example usage 3
# Example usage 1
set.seed(123)
n <- 1000
vector <- rlnorm(n) # Replace with your vector
start <- proc.time()[3]
simulate_function <- misc::fit_param_dist(vector)
## [1] 10.15776279 0.03482640 0.04704209 0.70874223 0.05123187 NaN
## [7] 0.01779376 0.25579394 Inf 0.41587181 0.04209187 0.04123623
## [1] "Best distribution based on KL divergence: log-normal"
end <- proc.time()[3]
print(paste("Time taken:", end - start))
## [1] "Time taken: 0.518"
simulated_data <- simulate_function(n) # Generate 100 samples from the best-fit distribution
par(mfrow = c(1, 2))
hist(vector, main = "Original Data", xlab = "Value", ylab = "Frequency")
hist(simulated_data, main = "Simulated Data", xlab = "Value", ylab = "Frequency")

Example usage 4
set.seed(123)
n <- 1000
vector <- rbeta(n, 2, 3) # Replace with your vector
start <- proc.time()[3]
simulate_function <- misc::fit_param_dist(vector, verbose=TRUE)
## [1] 0.003348187 0.076889442 0.317792831 0.192600862 0.037330018 NaN
## [7] 0.107711307 0.025396848 Inf 0.016032465 Inf 0.011174278
## [1] "Best distribution based on KL divergence: beta"
end <- proc.time()[3]
print(paste("Time taken:", end - start))
## [1] "Time taken: 0.532"
simulated_data <- simulate_function(n) # Generate 100 samples from the best-fit distribution
par(mfrow = c(1, 2))
hist(vector, main = "Original Data", xlab = "Value", ylab = "Frequency")
hist(simulated_data, main = "Simulated Data", xlab = "Value", ylab = "Frequency")
