I want to fit a Tweedie GlM to a response variable but with a dispersion parameter (phi) set to 1 for all the records in my data. So all the parameters get estimated using Maximum Likelihood Estimator except for phi.
Thank you.
I want to fit a Tweedie GlM to a response variable but with a dispersion parameter (phi) set to 1 for all the records in my data. So all the parameters get estimated using Maximum Likelihood Estimator except for phi.
Thank you.
You can do this by using the
mapargument inglmmTMB.Example setup:
Fit the unconstrained model:
(
sigma()is the general accessor method for the dispersion parameter; its definition varies by family, see?sigma.glmmTMB)Constrained:
Explanation:
mapspecifies sets of parameters to be held fixed to their starting values (ifNA), or sets of parameters to be constrained to be equal to each other (i.e. sharing a factor level): seeglmmTMB. In this case the dispersion parameter is a single value (it could have length > 1 ifdispformulawas specified), so we make it a factor of length 1 containingNA.startspecifies starting values (which are the values thatmapuses for fixed parameters). The dispersion parameter is fitted on a log scale, so we set the starting value to 0 (exp(0) = 1). In this case we don't really need to specify the value, since the default is 0 anyway, but it's clearer this way.