stephenslab / mixsqp

R package for fast maximum-likelihood estimation of mixture proportions using SQP.
https://bit.ly/2NtYHWT
Other
10 stars 7 forks source link

Add "normalize.rows" option in mixsqp function #11

Closed pcarbo closed 5 years ago

pcarbo commented 5 years ago

I decided in the end that this is not needed because the gradient "self-normalizes", e.g., the gradient is the same even after multiplying all the entries of the likelihood matrix by a constant factor (100 in this example):

set.seed(1)
n  <- 1e5
m  <- 10
w  <- rep(1/n,n)
L  <- simulatemixdata(n,m,normalize.rows = FALSE)$L
# L <- 100*L
x <- rep(1/m,m)
u <- w / c(L %*% x)
g <- -c(t(L) %*% u)