klarsen1 / MarketMatching

Other
131 stars 37 forks source link

Unexpected error in MarketMatching::inference() #13

Closed leungi closed 5 years ago

leungi commented 5 years ago

Thanks first of all for the useful package; I'd used it on several cases and bumped into this recently.

I tried debugging and found my way down to the CausalImpact() call; however, I can't find an explanation to the error.

Error:

Error in data.frame(y.model, cum.y.model, point.pred, cum.pred) : 
  arguments imply differing number of rows: 122, 123

In MarketMatching::inference(), the ts variable created, which is passed on to CausalImpact::CausalImpact(ts, pre.period, post.period, alpha = alpha, model.args = bsts_modelargs) has dim() 122 10, so not sure where the 123 comes from.

Apologies for not providing a reproducible example as data is confidential; further, toy problems don't have this issue.

Look forward to insights.

klarsen1 commented 5 years ago

Have you checked for “holes” in your time series input data?

K

On Sun, Jan 20, 2019 at 2:07 PM leungi notifications@github.com wrote:

Thanks first of all for the useful package; I'd used it on several cases and bumped into this recently.

I tried debugging and found my way down to the CausalImpact() call; however, I can't find an explanation to the error.

Error:

Error in data.frame(y.model, cum.y.model, point.pred, cum.pred) : arguments imply differing number of rows: 122, 123

In MarketMatching::inference(), the ts variable created, which is passed on to CausalImpact::CausalImpact(ts, pre.period, post.period, alpha = alpha, model.args = bsts_modelargs) has dim() 122 10, so not sure where the 123 comes from.

Apologies for not providing a reproducible example as data is confidential; further, toy problems don't have this issue.

Look forward to insights.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/klarsen1/MarketMatching/issues/13, or mute the thread https://github.com/notifications/unsubscribe-auth/AJqqdPAEDx0Lnu5COcIADK7J76VP8_Vuks5vFOiKgaJpZM4aJ4Aw .

leungi commented 5 years ago

That was my first suspicion, but there are no NA/NaN/NULL, only zeroes.

The zeroes are not the causes as I realized by adjusting post_end_period to an earlier interval (even with the zeroes in there) avoids the error.

klarsen1 commented 5 years ago

By holes, I mean that you’re skipping a week or day. No nulls, etc. this triggers an error.

On Sun, Jan 20, 2019 at 4:20 PM leungi notifications@github.com wrote:

That was my first suspicion, but there are no NA/NaN/NULL, only zeroes.

The zeroes are not the causes as I realized by adjusting post_end_period to an earlier interval (even with the zeroes in there) avoids the error.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/klarsen1/MarketMatching/issues/13#issuecomment-455916475, or mute the thread https://github.com/notifications/unsubscribe-auth/AJqqdO3t7rbzW9rAbhaU4T36OhJuTHpuks5vFQfdgaJpZM4aJ4Aw .

leungi commented 5 years ago

@klarsen1: spot on!

I did find a hole.

Thanks again for the advise.