0

I am modeling a random variable as

$T_i\sim\Gamma(\mu_i, \alpha_i)$,

where $log(\mu_i) = X_i + ZU + \epsilon$

$\mu_i$ represents the mean of the gamma distribution and $\alpha_i$ is the shape.

I'm modeling this in R and my current function call is:

glm(T ~ Z, family = Gamma(link="log"))

My question is: is this modeling the mean the way I wrote it down? If not, how can I modify it to do so? I am also interested in modeling the variance, where:

$T_i\sim\Gamma(\alpha_i, \beta_i)$,

where $log(var) = log(\frac{\alpha_i}{\beta_i^2}) = V_i + ZU + \epsilon$

Is it possible to write this in R's glm() function?

Thank you!

ohblahitsme
  • 189
  • 4
  • Is $U$ a noise variable? Are $Z$ a set of covariates measured with some multiplicative error? – AdamO Mar 21 '18 at 17:39
  • Sorry, $Z$ and $U$ are covariates and their effect sizes, $\epsilon$ is the noise variable – ohblahitsme Mar 21 '18 at 17:43
  • So is $X$ an offset then with a covariate value of 1 or is there a coefficient term for it, like $B$ or $\beta_1$ or something like that? – AdamO Mar 21 '18 at 17:49
  • $X$ is the intercept term so the covariate can be thought of as 1. We are interested in estimating the intercept here. Thanks for thinking about this! – ohblahitsme Mar 21 '18 at 18:02
  • For, what I understand to be the R-related part of this question, see: https://stats.stackexchange.com/a/58546/1390 – Gavin Simpson Mar 21 '18 at 18:21
  • @GavinSimpson do you mean the `dglm` portion? I think this could solve modeling the mean, but not the variance? – ohblahitsme Mar 21 '18 at 19:18
  • The dglm, I though allowed for modelling of the variance too. But I also should have linked to the full Q&A rather than a specific answer as what is possible with `glm()` is covered in both answers and comments. You can model all parameters of the distribution, given a parameterisation, using distributional models; see the VGAM, gamlss, and brms packages for a suitable gamma family with the parameterization you need for the mean and variance. – Gavin Simpson Mar 21 '18 at 19:46

0 Answers0