# Version 0.3.2 (Jan. 10, 2024)
(1) revised in DESCRIPTION format
# Version 0.3.1 (Dec. 22, 2023)
(1) title in DESCRIPTION is shorten
(2) add author(year) in DESCRIPTION format
(3) change cat()/print() to warning()/warings()
(4) delete unnecessary text in ~Rd file
# Version 0.3.0 (Dec. 13, 2023)
(1) change depends to R (>= 4.0.0)
(2) change Weiliang Qiu's email to Weiliang.Qiu@Sanofi.com
# Version 0.2.9 (Nov. 9, 2023)
(1) add paper info
# Version 0.2.8 (July 5, 2023)
(1) add simulation-annealing EM (eLNNpairedCov.SEM)
# Version 0.2.7 (Jun. 1, 2023)
(1)use proportional change to replace absolute likelihood change
# Version 0.2.6 (Oct. 23, 2021)
(1) drop memMethod option (i.e., only keep memMethod = "max.w")
(2) clean code (e.g., delete un-used comments)
(3) set mc.cores = 1 as default
(4) add reference
# Version 0.2.5 (Oct. 17, 2021)
(1) simplify calculation of logf123 function by using matrix operations to improve speed
# Version 0.2.4 (Oct. 17, 2021)
(1) when flag = TRUE, use old t_pi
# Version 0.2.3 (Oct. 16, 2021)
(1) first use adjusted p-values to obtain initial clusters. If nOE=nUE=0, then use un-adjusted p-values
# Version 0.2.2 (Oct. 14, 2021)
(1) add internal function 'eLNNpairedCov_updatePiOnly'
(2) set lower bound of alpha_c, beta_c, and k_c as 0.001
# Version 0.2.1 (Oct. 12, 2021)
(1) without re-parameterization
(2) bound for alpha_c is changed to [1/bound.alpha, bound.alpha], where default value for bound.alpha=6
(2) bound for alpha_c is changed to [1/bound.beta, bound.beta], where default value for bound.beta=6
# Version 0.2.0 (Oct. 12, 2021)
(1) randomly choose a value between [0, 6] when initial estimates of alpha_c or beta_c are beyond the bound
(2) in M-step, also set bounds for alpha_c and beta_c
# Version 0.1.9 (Oct. 10, 2021)
(1) set bounds [0, 6] for alpha_c and beta_c, c=1, 2, 3 for initial parameter estimates
# Version 0.1.8 (Oct. 9, 2021)
(1) add 'wmat' (responsibility matrix) as output to 'eLNNpairedCov'
# Version 0.1.7 (Oct. 9, 2021)
(1) rename 'getMemFunc' as 'getMemFunc2' and define 'getMemFunc' based on maximum of responsibities per gene
# Version 0.1.6 (Oct. 6, 2021)
# (1) added parameter names to psi and psi.r
# (2) add determine cluster membership based on FDR < 0.05
#
# Version 0.1.5 (Oct. 4, 2021)
# in 'getIniParaEst', added 0.001 to abs(muhat) to avoid log(0)
#
# Version 0.1.4 (Sept. 30, 2021)
# (1) add input option 'optimMethod' to 'eLNNpairedCov'
# Version 0.1.4 (Sept. 29, 2021)
(1) simplify functions
# Version 0.1.3 (Sept. 25, 2021)
(1) in 'genSimDat' function, use 'OE', 'UE', and 'NE' to repalce '1', '2', and '3'
(2) add first derivatives of Q function
# Version 0.1.2 (Sept. 24, 2021)
# (1) fixed a bug in 'eLNNpairedCov.R': par.r.ini = c(t_pi, psi.r)
# should be par.r.ini = c(t_pi, psi.r.ini)
# Version 0.1.1 (Sept. 23, 2021)
# (1) in 'genSimDat', do not need to scale 'age'
# (2) in 'genSimDat', sex takes value 'F' and 'M', instead of 1 and 0
# Version 0.1.0 (Oct. 24, 2019)
# (1) fixed a bug: reparameterization of k_c should be k_c=Phi(xi_c), where
# Phi is the CDF of N(0, 1)
# xi_c = Phi^{-1}(k_c)
# Version 0.0.9 (Oct. 19, 2019)
# (1) use sum square difference as condition1 in EM iteration
# Version 0.0.8 (Oct. 19, 2019)
# (1) add functions eLNNpairedCovEM and eLNNpairedDiffParaEM
#
# Version 0.0.7 (Oct. 18, 2019)
# (1) add output par.ini and par.r.ini for eLNNpairedCov
#
# Version 0.0.6 (Oct. 15, 2019)
# (1) add function 'eLNNpairedCovDiffPara'
# (2) change the way to determine cluster membership so that
# cluster mixture proportions will be consistent with with t_pi
# (3) remove the dependence to 'iCheck' since some r packages called by
# iCheck take long time to load
#
# Version 0.0.5 (Oct. 14, 2019)
# (1) add scaling option 'scaleFlag'. By default, will do probe-wise
# scaling, but not centering to stablize alpha1 and alpha2
# (2) set alpha1=alpha3, and alpha2=alpha3; beta1=beta3, beta2=beta3
# to stablize beta1 and beta2
# (3) set k1=k2=k3=(k1+k2)/2 to stablize k3
# (4) replace 'eLNNpairedCov' by 'eLNNpairedCov2'
# (5) add a convergence criterion: negative Q func (new) > negative Q func (old)
#
# Version 0.0.4 (Oct. 12, 2019)
# (1) do not use EM algorithm to estimate model parameters,
# except for cluster mixture proportions
# (2) for clusters 1 (OE) and 2 (UE), we use the same hyperparameters
# (3) logf123: use alpha1, beta1, k1, instead of alpha, beta, and k
#
# Version 0.0.3 (Oct. 12, 2019)
# (1) add na.rm to mean()
# Version 0.0.2 (Apr. 22, 2019)
# (1) add "shape=" and "rate=" when calling rgamma
# Version 0.0.1 (Apr. 19, 2019)
# (1) create the R package