Skip to contents

Creates an outcome with gamma distribution with the chosen parameters (can only specify 2).

Usage

Gamma(
  phi = NA,
  mu = NA,
  alpha = NA,
  beta = NA,
  sigma = NA,
  data,
  offset = as.matrix(data)^0
)

Arguments

phi

character or numeric: Name of the linear predictor associated with the shape parameter of the gamma distribution. If numeric, this parameter is treated as known and equal to the value passed. If a character, the parameter is treated as unknown and equal to the exponential of the associated linear predictor. It cannot be specified with alpha.

mu

character: Name of the linear predictor associated with the mean parameter of the gamma distribution. The parameter is treated as unknown and equal to the exponential of the associated linear predictor.

alpha

character: Name of the linear predictor associated with the shape parameter of the gamma distribution. The parameter is treated as unknown and equal to the exponential of the associated linear predictor. It cannot be specified with phi.

beta

character: Name of the linear predictor associated with the rate parameter of the gamma distribution. The parameter is treated as unknown and equal to the exponential of the associated linear predictor. It cannot be specified with sigma.

sigma

character: Name of the linear predictor associated with the scale parameter of the gamma distribution. The parameter is treated as unknown and equal to the exponential of the associated linear predictor. It cannot be specified with beta.

data

numeric: Values of the observed data.

offset

numeric: The offset at each observation. Must have the same shape as data.

Value

An object of the class dlm_distr

Details

For evaluating the posterior parameters, we use the method proposed in Alves et al. (2024) .

For the details about the implementation see dos Santos et al. (2024) .

References

Mariane Branco Alves, Helio S. Migon, Raíra Marotta, Junior, Silvaneo Vieira dos Santos (2024). “k-parametric Dynamic Generalized Linear Models: a sequential approach via Information Geometry.” 2201.05387.

Junior, Silvaneo Vieira dos Santos, Mariane Branco Alves, Helio S. Migon (2024). “kDGLM: an R package for Bayesian analysis of Dynamic Generialized Linear Models.”

See also

fit_model

Other auxiliary functions for a creating outcomes: Multinom(), Normal(), Poisson(), summary.dlm_distr()

Examples


structure <- polynomial_block(mu = 1, D = 0.95)

outcome <- Gamma(phi = 0.5, mu = "mu", data = cornWheat$corn.log.return[1:500]**2)
fitted.data <- fit_model(structure, corn = outcome)
summary(fitted.data)
#> Fitted DGLM with 1 outcomes.
#> 
#> distributions:
#>     corn: Gamma
#> 
#> ---
#> No static coeficients.
#> ---
#> See the coef.fitted_dlm for the coeficients with temporal dynamic.
#> 
#> One-step-ahead prediction
#> Log-likelihood        : -Inf
#> Interval Score        : 0.00199
#> Mean Abs. Scaled Error: 0.94446
#> ---
plot(fitted.data, plot.pkg = "base")