From 9b5c6a2f35ab169b3ff607290afba88017a7e4a6 Mon Sep 17 00:00:00 2001
From: Clare <chorscroft@users.noreply.github.com>
Date: Tue, 26 May 2020 15:18:26 +0100
Subject: [PATCH] Initial commit of est_Beta_Params helper function

---
 R/est_Beta_Params.R | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
 create mode 100644 R/est_Beta_Params.R

diff --git a/R/est_Beta_Params.R b/R/est_Beta_Params.R
new file mode 100644
index 0000000..aaf9ec2
--- /dev/null
+++ b/R/est_Beta_Params.R
@@ -0,0 +1,14 @@
+
+
+## Estimates starting parameters for the Beta distribution calculation
+##
+## @param mu The mean of the data.
+## @param var The variance of the data.
+##
+## @return A list containing the estimated beta parameters alpha and beta.
+##
+est_Beta_Params <- function(mu, var){
+  alpha <- ((1-mu)/var - 1/mu) * mu^2
+  beta <- alpha * (1/mu - 1)
+  return(params = list(alpha = alpha, beta = beta))
+}
-- 
GitLab