# Relative Risk (RR) and absolute reduction in relative risk (ARR) with stan_glm

Dear all,
I would like o to ask about the choice of the family to use to compute RR and ARR,
normally for RR I should choose these families in these lines

``````> str(mydata)

'data.frame':	190 obs. of  2 variables:
\$ treat:   int  1 1 1 1 1 1 1 1 1 1 ...
\$ death:   int  1 0 0 0 0 0 0 1 0 0 ...

> model_OR = stan_glm(death~treat, data = mydata,
+                     family =  binomial(link = "logit"),
+                     prior = normal(location =0, scale = 10),
prior_intercept = normal(location =0, scale = 10) ,
QR=FALSE,
+                     seed = 12345,
+                     refresh = 0)

> OR = exp(coef(model_OR))

> OR
treat
0.5749312

> model_RR = stan_glm(death~treat, data = mydata,
+          family =  binomial(link = "log"),
+          prior = normal(location =0, scale = 10),
prior_intercept = normal(location =0, scale = 10) ,
QR=FALSE,
+          seed = 12345,
+          refresh = 0)

> RR = exp(coef(model_RR))

> RR
treat
0.6721806

> model_ARR = stan_glm(death~treat, data = mydata,
+                    family =  binomial(link = "identity"),
+                    prior = normal(location =0, scale = 10),
prior_intercept = normal(location =0, scale = 10) ,
QR=FALSE,
+                    seed = 12345,
+                    refresh = 0)

Error in stan_glm.fit(x = X, y = Y, weights = weights, offset = offset,  :
'link' must be one of logit, probit, cauchit, log, cloglog

ARR = coef(model_ARR)

``````

Is it the correct families? if so, what is the correction for the last one?

Those are both legal syntax. I suspect the problem is with whatever you are specifying for `prior_intercept`. If the inverse link function is insufficient to make the probabilities between zero and one, then the intercept has to be such that the constraint is satisfied.

1 Like

I updated the post

that is supposed to work, but apparently it does not. But you cannot have a `normal(location = 0, scale = 10)` prior on the intercept when you specify a link function that does not ensure that the probabilities are between 0 and 1.

but for

``````gaussian(link="identity")
``````

it works well and give closed results to the exact ones, dose this mean this family is true or just by coincidence, and what about the family of RR is it true?

`gaussian(link = "identity")` can’t be right if the outcomes are binary.