I want to calculate weighted covariance matrix where the weights are given to each element (entry, cell) of the original data matix, and not to rows (as done by cov.wt in stats
).
The issue had been discussed on CrossValidated here, but no actual implementation (e.g. in a form of R code) was presented. Some solutions are offered by this and this papers, but are impenetrable to me and I lack the skill to code them.
Is there a package or a function that does it? Or, would anybody be able to come up with a couple of lines of code that can do it?