Interpreting Variables in Multilevel Regression with Random Effects
I have a dataset that looks like below (first 5 rows are shown). CPA is the observable result of an experiment (treatment) on different advertising flights. Flights are grouped hierarchically into campaigns.
campaign_uid flight_uid treatment CPA
0 0C2o4hHDSN 0FBU5oULvg control -50.757370
1 0C2o4hHDSN 0FhOqhtsl9 control 10.963426
2 0C2o4hHDSN 0FwPGelRRX exposed -72.868952
3 0C5F8ZNKxc 0F0bYuxlmR control 13.356081
4 0C5F8ZNKxc 0F2ESwZY22 control 141.030900
5 0C5F8ZNKxc 0F5rfAOVuO exposed 11.200450
I am coming up with a model like the following:
model.fit('CPA ~ treatment', random=['1|campaign_uid'])
As far as I know, this model just says:
- We have a slope for treatment
- We have a global intercept
- We also have interception per campaign.
to just one trailing one for each such variable .
However, looking at the results below, I also get back for the following variables: 1|campaign_uid_offset
. What does he represent?
Code to fit the model and graph:
model = Model(df)
results = model.fit('{} ~ treatment'.format(metric),
random=['1|campaign_uid'],
samples=1000)
# Plotting the result
pm.traceplot(model.backend.trace)
source to share
- 1 | campaign_uid
These are random interceptions for the campaigns mentioned in the parameter list.
- 1 | campaign_uid_sd
This is the standard deviation of the aforementioned random attack hooks.
- CPA_sd
This is the residual standard deviation. That is, your model can be written (partially) as CPA_ij ~ Normal (b0 + b1 * treatment_ij + u_j, sigma ^ 2), but CPA_sd
represents the parameter sigma.
- 1 | campaign_uid_offset
This is an alternative parameterization of random hooks. bambi
uses this transformation internally to improve MCMC sampling efficiency. Usually this converted parameter is hidden from the user by default; that is, if you create a trace using results.plot()
, and not pm.traceplot(model.backend.trace)
, then those terms are hidden unless you specify transformed=True
(default is False). It is also hidden from output by default results.summary()
. For more information on this transformation, see this nice blog post by Thomas Wicca .
source to share