# Interpreting output of gamma model

Hi,

Hello, as you may have guessed from all my questions here, I am very new to Bayesian modeling! I have a dataset containing 3 groups’ sentiment score data, from 0 to -4 (this is a continuous variable), and my goal is to determine if there is an effect by group. To model it, I converted it to postive (*-1) so that close to 0 is actually less negative than a score of 4 (as 4 is actually -4).

After following many online tutorials, I settled on a gamma score (did LOO of different families) - model below:

 Family: gamma


Links: mu = inverse; shape = identity
Formula: transformedsent ~ group + (1 | id)
Data: df (Number of observations: 1856)
Samples: 20 chains, each with iter = 2000; warmup = 1000; thin = 1;
total post-warmup samples = 20000

The output is as follows:

Group-Level Effects:
~id (Number of levels: 1856)
Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
sd(Intercept)     0.40      0.16     0.04     0.65 1.01     2289     2424

Population-Level Effects:
Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
Intercept       2.55      0.09     2.38     2.74 1.00     6787    13508
group 2         1.22      0.14     0.95     1.50 1.00    27476    15066
group 3.        1.29      0.15     1.00     1.58 1.00    24998    15147

Family Specific Parameters:
Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
shape     1.65      0.06     1.54     1.76 1.00     7659    11316


So group 2 and 3 are different in sentiment to group 1 (as 95%CI don’t cross 0) but how do I interpret the estimate? Do I need to log? Transform something? How would I make this into a sentence? I’m confused as when I plot the conditional effects, I don’t understand what is on the y axis? Attached is the plot.

Thank you for your patience in helping me to understand!

Hi. Could you try to write out the model in plain mathematical/statistical notation (you may already know this, but the forum supports \LaTeX for you to type the expressions)?

While brms is hugely popular high-level interface to Stan, its notation is limited to R users. By describing your problem in universal language (the Stan model code always helps too) maybe you’ll reach a larger audience of general Stan users who may not be familiar with the brms syntax (like me).

1 Like

Thank you for this advice, I’m not actually sure how to write it in maths notations!

I’m not sure if you mean the Latex typesetting or in general how a brms model looks in mathematical notation.

If it’s the typesetting, you just need to use a $sign before and after the expression, so $ y = ax + b + \varepsilon $ becomes y = ax + b + \varepsilon , or $ y \sim \mathcal{N}(\mu, \sigma) \$ gives y \sim \mathcal{N}(\mu, \sigma) . If you are not familiar with Latex, it can look like a complicated way to write documents, but it makes writing expressions here much faster.

If you mean the model in general, it may be a good exercise to try to write it out in universal math notation, as not everyone will understand R/brms notation when you are presenting to a general audience.

Thank you! Sorry I should have clarified! I mean the model in general, I am not sure how to write the model in general. I will do some reading and come back

It’s possible to understand what you are doing without being able to write the model in mathematical notation, if you are getting started you don’t have to be able to do one to do the other, but it is probably helpful to be able to do that conversion. In the meantime you can always post your Stan or brms model specification here, and people here will generally be able to reconstruct what the model is and help you with your specific issue. Unfortunately I am not a brms user, so maybe I can’t do it, but someone else certainly will.

1 Like