gamma2                 package:VGAM                 R Documentation

_2-_p_a_r_a_m_e_t_e_r _G_a_m_m_a _D_i_s_t_r_i_b_u_t_i_o_n

_D_e_s_c_r_i_p_t_i_o_n:

     Estimates the 2-parameter gamma distribution by maximum likelihood
     estimation.

_U_s_a_g_e:

     gamma2(lmu = "loge", lshape = "loge",
            emu = list(), eshape = list(),
            method.init = 1, deviance.arg = FALSE,
            ishape = NULL, zero = -2)

_A_r_g_u_m_e_n_t_s:

lmu, lshape: Link functions applied to the (positive) _mu_ and _shape_
          parameters (called mu and shape respectively). See 'Links'
          for more choices.

emu, eshape: List. Extra argument for each of the links. See 'earg' in
          'Links' for general information.

  ishape: Optional initial value for _shape_.  A 'NULL' means a value
          is computed internally. If a failure to converge occurs, try
          using this argument. This argument is ignored if used within
          'cqo'; see the 'iShape' argument of 'qrrvglm.control'
          instead.

method.init: An integer with value '1' or '2' which specifies the
          initialization method for the mu parameter. If failure to
          converge occurs try another value (and/or specify a value for
          'ishape').

deviance.arg: Logical. If 'TRUE', the deviance function is attached to
          the object. Under ordinary circumstances, it should be left
          alone because it really assumes the shape parameter is at the
          maximum likelihood estimate. Consequently, one cannot use
          that criterion to minimize within the IRLS algorithm. It
          should be set 'TRUE' only when used with 'cqo' under the fast
          algorithm.

    zero: Integer valued vector, usually assigned -2 or 2 if used at
          all.  Specifies which of the two linear/additive predictors
          are modelled as an intercept only. By default, the shape
          parameter (after 'lshape' is applied) is modelled as a single
          unknown number that is estimated.  It can be modelled as a
          function of the explanatory variables by setting 'zero=NULL'.
           A negative value means that the value is recycled, so
          setting -2 means all shape parameters are intercept only.

_D_e_t_a_i_l_s:

     This distribution can model continuous skewed responses. The
     density function is given by

 f(y;mu,shape) = exp(-shape * y / mu) y^(shape-1) shape^(shape) /  [mu^(shape) * gamma(shape)]

     for mu > 0, shape > 0 and y > 0. Here, gamma() is the gamma
     function, as in 'gamma'. The mean of _Y_ is mu=mu (returned as the
     fitted values) with variance sigma^2 = mu^2 / shape.  If 0<shape<1
     then the density has a pole at the origin and decreases
     monotonically as y increases. If shape=1 then this corresponds to
     the exponential distribution.  If shape>1 then the density is zero
     at the origin and is unimodal with mode at y = mu - mu / shape;
     this can be achieved with 'lshape="loglog"'.

     By default, the two linear/additive predictors are eta1=log(mu)
     and eta2=log(shape). This family function implements Fisher
     scoring and the working weight matrices are diagonal.

     This 'VGAM' family function handles _multivariate_ responses, so
     that a matrix can be used as the response. The number of columns
     is the number of species, say, and 'zero=-2' means that _all_
     species have a shape parameter equalling a (different) intercept
     only.

_V_a_l_u_e:

     An object of class '"vglmff"' (see 'vglmff-class'). The object is
     used by modelling functions such as 'vglm' and 'vgam'.

_N_o_t_e:

     The response must be strictly positive. A moment estimator for the
     shape parameter may be implemented in the future.

     If 'mu' and 'shape' are vectors, then 'rgamma(n=n, shape=shape,
     scale=mu/shape)' will generate random gamma variates of this
     parameterization, etc.; see 'GammaDist'.

     For 'cqo' and 'cao', taking the logarithm of the response means
     (approximately) a 'gaussianff' family may be used on the
     transformed data.

_A_u_t_h_o_r(_s):

     T. W. Yee

_R_e_f_e_r_e_n_c_e_s:

     The parameterization of this 'VGAM' family function is the
     2-parameter gamma distribution described in the monograph

     McCullagh, P. and Nelder, J. A. (1989) _Generalized Linear
     Models_, 2nd ed. London: Chapman & Hall.

_S_e_e _A_l_s_o:

     'gamma1' for the 1-parameter gamma distribution, 'gamma2.ab' for
     another parameterization of the 2-parameter gamma distribution,
     'mckaygamma2' for _a_ bivariate gamma distribution, 'expexp',
     'GammaDist', 'golf'.

_E_x_a_m_p_l_e_s:

     # Essentially a 1-parameter gamma
     y = rgamma(n <- 100, shape= exp(1))
     fit1 = vglm(y ~ 1, gamma1, trace=TRUE, crit="c")
     fit2 = vglm(y ~ 1, gamma2, trace=TRUE, crit="c")
     coef(fit1, matrix=TRUE)
     Coef(fit1)
     coef(fit2, matrix=TRUE)
     Coef(fit2)

     # Essentially a 2-parameter gamma
     y = rgamma(n <- 500, rate=exp(1), shape=exp(2))
     fit2 = vglm(y ~ 1, gamma2, trace=TRUE, crit="c")
     coef(fit2, matrix=TRUE)
     Coef(fit2)
     summary(fit2)

