I'm new to linear algebra, but I know how multiple linear regressions work. What I want to do is something slightly different.
As an example, let's say that I have a list of nutrients I want to get every day. Say I have a list of foods, and I want to know how much of each food to eat to get the best fit for my nutrition plan. Assume I'm fine with using a linear model.
However, some nutrients are more important than others. The errors on protein and calcium might be equal in a typical linear regression, but that's no use. Protein has higher priority than calcium (in this model), so I'd want a model that is better fitting to the higher priority points than to the lower ones.
I tried putting weights on the error function, and I end up with a matrix of matrices. At that point, I'm not sure if I'm minimising for the weights or for the coefficients on the nutrients. I think both, but I wasn't sure how to minimise for both at the same time.
Is it possible to solve this with linear algebra, or does this require some numerical approximation solution?
So here is my understanding of what you have in mind. Let $X_i$ ($i=1...N$) represent the total number of units for nutrient $i$. Each nutrient has a weight $w_i$. Therefore, your objective function is $\sum_{i=1}^N w_iX_i$.
But, you don't choose nutrients directly, you choose foods. Let food be represented by the subscript $j$, $j=1...J$, Each food $j$ is associated with a set of nutrients. In particular, suppose that 1 unit of each food has $m_{ij}$ units of nutrient $i$. Therefore, if you purchase one unit of food, your objective function increases by $\sum w_im_{ij}$.
Finally, let $F_j$ represent the amount of food $j$ purchases (or consumed). Then your objective is to choose a consumption set of foods {$F_j$} to maximize your objective function.
$max_{\{F_j\}} \sum_{j=1}^J\sum_{i=1}^N F_j w_im_{ij}$
Perhaps subject to some budget constraint?