bpfaff / vars

Multivariate Time Series Models: VAR, SVAR and SVEC
40 stars 22 forks source link

Unnecessarily complicated way to obtain degrees of freedom. #13

Open jonlachmann opened 2 years ago

jonlachmann commented 2 years ago

I have a project where we need to do many forecasts in a parallel setting. In predict.varest there are multiple calls to lm.summary. This has multiple side-effects, first it is a very expensive way to retrieve the degrees of freedom, as that would only require counting the number of coefficients and subtracting that number from the observation count. The second problem which I guess is more specific to my application is that I sometimes get a problem when running multiple threads in mclapply, where the execution stops inside the lm.summary function.

I have forked the repository and created a pull request for you to evaluate. Please let me know if you need any more information or any adjustments to the code. Please see https://github.com/bpfaff/vars/pull/12

Best regards Jon.