2
$\begingroup$

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
$\endgroup$
1
  • $\begingroup$ I believe the solution can be found here. $\endgroup$
    – Keith Lau
    Mar 22, 2019 at 14:56

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.