tfcausalimpact icon indicating copy to clipboard operation
tfcausalimpact copied to clipboard

modifying alpha.

Open aazz7777 opened this issue 10 months ago • 6 comments

how can i modify alpha level?

aazz7777 avatar Apr 23 '24 16:04 aazz7777

Hi @aazz7777 ,

By alpha you mean the prior level? See if this helps:

ci = CausalImpact(data, pre_period, post_period, model_args={'prior_level_sd':0.1})

WillianFuks avatar May 04 '24 15:05 WillianFuks

I meant the alpha that affect CI value. 0.05, 0.2 . I noticed that it is set to 0.05

aazz7777 avatar May 06 '24 15:05 aazz7777

It sure is, simply run: ci = CausalImpact(data, pre_period, post_period, alpha=0.02) for alpha=0.02 for instance.

WillianFuks avatar May 06 '24 21:05 WillianFuks

Hello, is it possible to access the posterior distribution of the cumulative effect directly ? The idea is to extract whatever high density interval is needed from the posterior without having to perform the calculation again.

Maybe something like that: np.quantile(ci.posterior_dist.sample(1000)[:,-1,0], [0.98, 0.02]). Although this seems to be based on the processed data ...

MilaimKas avatar Aug 20 '24 16:08 MilaimKas

Hi @MilaimKas ,

Unfortunately this information is not currently available directly. Maybe you'd have to compute the simulated posteriors and then take the effect on each one so to get a distribution for effects.

WillianFuks avatar Aug 21 '24 18:08 WillianFuks

Hello @WillianFuks I took a quick look at the code. It looks like it should be possible to implement something without too much effort. I would love to contribute to the project (even though I do not have much experience with code development).

MilaimKas avatar Aug 30 '24 09:08 MilaimKas