dfols icon indicating copy to clipboard operation
dfols copied to clipboard

Generalized least squares

Open lindonroberts opened this issue 5 years ago • 2 comments
trafficstars

Allow option for generalized least squares (i.e. instead of ||r(x)||^2, have ||r(x)||_A^2, where A is the inverse of the correlation matrix; see https://en.wikipedia.org/wiki/Generalized_least_squares). This captures correlation/heteroskedacity in the residuals.

lindonroberts avatar Feb 12 '20 12:02 lindonroberts

Hi Lindon, this would be useful! I implement it by translating into (and out of ) the eigenvector space of the covariance matrix.

SimonTett avatar Apr 26 '21 09:04 SimonTett

And as I gave been having a hard time with DFOLS and "noise" in my trials so have been looking at that bit of my code I put it here! Part 1 --generate transformation matrix from Covariance matrix. You might want to filter this evalue, evect = np.linalg.eigh(Cov) transMatrix = np.diag(evalue ** (-0.5)).dot(evect.T) Part 2 -- apply resid = transMatrix @ fn(params)

SimonTett avatar Jun 15 '21 12:06 SimonTett