My overarching question is, how does R calculate R^2 in the WLS case? It doesn't just weight the observations and then calculate the R^2. To try and figure this out, I was going through the source code until I ran into this in the lm.wfit
code:
z <- .Call(C_Cdqrls, x *wts, y*wts, tol)
What is being done here? Does anyone know how I can access the code for this to get to the details? I.e., what is being returned to z
? How are C_Cdqrls
, x*wts
, y*wts
, tol
being used?
What I understand so far (and I'm not sure if it's right), is that .Call
means that R is executing this code in C. However, I'd like to see how this is done in C if possible.
Thanks!