I trying to find $\pi_{1}, \pi_{2}, \pi_{3}$ for model: $$ Y = \pi_{1}X_{1} + \pi_{2}X_{2} + \pi_{3}X_{3} + \epsilon, $$ with constraints: $\Sigma_{k}\pi_{k}=1$ and $\pi_{k}\geq0$. (All $\pi$ are positive and add up to 1)
I found a very similar question here that tried to minimize squared errors: $\Sigma_{i}(Y_{i}-(\pi_{1}X_{i1} + \pi_{2}X_{i2} + \pi_{3}X_{i3}))^{2}$.
However, my dependent variable $Y$ is binary, not continuous. So it's like fitting a logistic regression model rather than a linear regression model.
Is there a way for me to apply a link function (e.g. logit function) to the solution provided in the above link to find better estimates of $\pi_{1}, \pi_{2}, \pi_{3}$ ?
Or, are there any other well-known solutions to solve problems like these (quadratic programming where dependent variable is binary?)
I copied the example code from the above link with the dependent variable rounded to either 1 or 0 in case it helps.
library("quadprog");
X <- matrix(runif(300), ncol=3)
Y <- round(X %*% c(0.2,0.3,0.5))
Rinv <- solve(chol(t(X) %*% X));
C <- cbind(rep(1,3), diag(3))
b <- c(1,rep(0,3))
d <- t(Y) %*% X
solve.QP(Dmat = Rinv, factorized = TRUE, dvec = d, Amat = C, bvec = b, meq = 1)
# 0.02080963 0.18475508 0.79443529
I tried searching for similar problems on Google, but with my little knowledge on quadratic programs, I couldn't get close to finding information that matched mine.
optim()
$\endgroup$glm()
) and pass the coefficients through the softmax function? $\endgroup$optim()
function. Thank you! $\endgroup$