2

What is exactly the calculation used when calling cov.wt((faithful,c(1,2,3,4))$cov)?

(Say the data faithful has 4 rows and 2 columns, coordinates x,y)

I.e.: What is the formula it uses to compute the weighted covariance matrix $\Sigma$?

The doumentation doesn't say, the internet shows more than one formula and the code is short but I don't understand it and want just a mathematical clear formula.

center <- colSums(wt * x)
x <- sqrt(wt) * sweep(x, 2, center, check.margin = FALSE)
cov <- crossprod(x)/(1-sum(wt^2))
cov
BanaNana
  • 21
  • 3
  • I believe the solution can be found [here](https://stats.stackexchange.com/questions/61225/correct-equation-for-weighted-unbiased-sample-covariance). – Keith Lau Mar 22 '19 at 14:56

0 Answers0