You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ENH: OLS Influence, more statistics without explicit looo loop #9009
"
I am wondering why the computation times of the dfbeta and dfbetas influence statistics are extremely large. The reason seems to be that the implementation uses results form leave-one-out regression loops, requiring N auxilliary regressions (where N is the number of observations of the data set). In the classical monography by Belsley et al. it is shown that these statistics can be computed extremely fast, even without running OLS regressions.
Why are the algorithms presented in the book not implemented?
"
related: Closed form studentized residuals external #373
I tried to ad versions of OLS outlier statistics that get without the observation-wise LOOO loops. I am anxious, howerver, that my amenendements would destroy the architecture of the current implementation. Why? To the best of my knowledge, the current implementation, includes both internal and external versions of several (auxiliary) statistics. According to Belsley et al.'s book, all statistics dfbeta, dffit, covratio, cooksd can be computed without observation-wise LOOO computations.
Therefore I add sketches of the implementations here, hoping that they are helpful for you.
References for the formulas (All refer to Belsley, Kuh and Welsch: Regression Diagnostics ISBN 978-0-471-69117-4)
dfbeta: Page 13, formulas 2.1 and 2.7
dfits: Page 15, formula 2.11
covratio: Page 22, formula 2.38
A computationally efficient alterntive to using observation-wise LOOO loops for nonlinear models (MLE and GLM) would be to linearize these models using first order Taylor approximations. Then the closed form solutions for the OLS case could be used. Did you consider this choice?
Thanks, I will go over the details of your code soon(ish).
To the best of my knowledge, the current implementation, includes both internal and external versions of several (auxiliary) statistics.
This was mainly based on the documentation of other packages, e.g. SAS.
for GLM, I have two versions, GLM influence tries to take some shortcuts using the irls WLS version. (I don't remember right now about looo scale, There might be only "internal" versions for families that don't have scale fixed at 1.).
Generic MLEInfluence can also be used for it.
MLEInfluence is generic and uses only derivative information (AFAIR), e.g. df_params are from a one-step Newton iteration as approximation. This was mainly based on references for specific distributions or models.
we don't have WLSInfluence yet, I did not see a reference for which statistic should be based on resid, exog or wresid, wexog.
i.e. parts that should differ from applying OLSInfluence on only the weighted data, wendog, wexog. #9067
Activity
josef-pkt commentedon Sep 23, 2023
looo for scale: BKW equ (2.8) p. 14
ludsteckj-home commentedon Mar 28, 2024
I tried to ad versions of OLS outlier statistics that get without the observation-wise LOOO loops. I am anxious, howerver, that my amenendements would destroy the architecture of the current implementation. Why? To the best of my knowledge, the current implementation, includes both internal and external versions of several (auxiliary) statistics. According to Belsley et al.'s book, all statistics dfbeta, dffit, covratio, cooksd can be computed without observation-wise LOOO computations.
Therefore I add sketches of the implementations here, hoping that they are helpful for you.
@cache_readonly
def dfbeta(self):
""" dfbeta statistic """
hii = self.hat_matrix_diag
invXtX = np.linalg.inv(self.exog.T @ self.exog)
dfbeta = ((invXtX @ exog.T * self.resid) / (1-hii)).T
return dfbeta
don't hesitate to contact me if
Best regards,
Johannes
ludsteckj-home commentedon Mar 28, 2024
References for the formulas (All refer to Belsley, Kuh and Welsch: Regression Diagnostics ISBN 978-0-471-69117-4)
dfbeta: Page 13, formulas 2.1 and 2.7
dfits: Page 15, formula 2.11
covratio: Page 22, formula 2.38
ludsteckj-home commentedon Mar 28, 2024
A computationally efficient alterntive to using observation-wise LOOO loops for nonlinear models (MLE and GLM) would be to linearize these models using first order Taylor approximations. Then the closed form solutions for the OLS case could be used. Did you consider this choice?
josef-pkt commentedon Mar 29, 2024
Thanks, I will go over the details of your code soon(ish).
This was mainly based on the documentation of other packages, e.g. SAS.
for GLM, I have two versions, GLM influence tries to take some shortcuts using the irls WLS version. (I don't remember right now about looo scale, There might be only "internal" versions for families that don't have scale fixed at 1.).
Generic MLEInfluence can also be used for it.
MLEInfluence is generic and uses only derivative information (AFAIR), e.g. df_params are from a one-step Newton iteration as approximation. This was mainly based on references for specific distributions or models.
we don't have WLSInfluence yet, I did not see a reference for which statistic should be based on resid, exog or wresid, wexog.
i.e. parts that should differ from applying OLSInfluence on only the weighted data, wendog, wexog.
#9067
ENH: closed form leave-one-out measures in OLSInfluence