Skip to contents

The mvgam method of brms::hypothesis(), with the arguments and parameter names of brms::hypothesis.brmsfit(). By default a hypothesis names population-level coefficients without their b_ prefix, as "x > 0" tests b_x. class = NULL names any parameter by the full name variables.mvgam() lists, such as ar1_trend[series_1] or sigma. That help page sets out how the names are formed.

Usage

# S3 method for class 'mvgam'
hypothesis(
  x,
  hypothesis,
  class = "b",
  group = "",
  alpha = 0.05,
  robust = FALSE,
  seed = NULL,
  ...
)

Arguments

x

A fitted mvgam object.

hypothesis

Character vector of hypothesis strings in the brms::hypothesis() grammar, such as "x > 0" or "(x - z) = 0".

class

The class prefix the names in hypothesis omit. Defaults to "b". NULL or "" takes every parameter by its full name.

group

The grouping factor of a group-level class, as class = "sd", group = "site" tests sd_site__Intercept as Intercept.

alpha

One minus the credible-interval mass. Defaults to 0.05 (90%-CI for one-sided, 95%-CI for two-sided).

robust

Logical. If FALSE (the default), uses mean and standard deviation for summaries. If TRUE, uses median and median absolute deviation (MAD).

seed

Optional integer seed for the random draws of an evidence ratio. The session's random state is restored when the call returns.

...

Forwarded to brms::hypothesis.

Value

A brmshypothesis object. See brms::hypothesis().

Author

Nicholas J Clark

Examples

# \dontrun{
set.seed(13)
simdat <- sim_mvgam(family = poisson(), n_series = 1L,
                     n_timepoints = 120L, trend_model = AR())

mod <- mvgam(y ~ x,
              trend_formula = ~ AR(p = 1),
              data    = simdat$data_train,
              family  = poisson(),
              chains  = 2, silent = 2)
#> Warning: 1 of 2000 (0.0%) transitions ended with a divergence.
#> See https://mc-stan.org/misc/warnings for details.

# A population-level coefficient, named as fixef() names it.
hypothesis(mod, "x > 0")
#> Hypothesis Tests for class :
#>   Hypothesis Estimate Est.Error CI.Lower CI.Upper Evid.Ratio Post.Prob Star
#> 1    (x) > 0    -0.36      0.08    -0.48    -0.24          0         0     
#> ---
#> 'CI': 90%-CI for one-sided and 95%-CI for two-sided hypotheses.
#> '*': For one-sided hypotheses, the posterior probability exceeds 95%;
#> for two-sided hypotheses, the value tested against lies outside the 95%-CI.
#> Posterior probabilities of point hypotheses assume equal prior probabilities.

# Any parameter by its full name.
hypothesis(mod, c("ar1_trend[series_1] > 0",
                  "sigma_trend[series_1] < 1"),
           class = NULL)
#> Hypothesis Tests for class :
#>                 Hypothesis Estimate Est.Error CI.Lower CI.Upper Evid.Ratio
#> 1 (ar1_trend[series... > 0     0.44      0.15     0.18     0.67     665.67
#> 2 (sigma_trend[seri... < 0    -0.37      0.08    -0.49    -0.23        Inf
#>   Post.Prob Star
#> 1         1    *
#> 2         1    *
#> ---
#> 'CI': 90%-CI for one-sided and 95%-CI for two-sided hypotheses.
#> '*': For one-sided hypotheses, the posterior probability exceeds 95%;
#> for two-sided hypotheses, the value tested against lies outside the 95%-CI.
#> Posterior probabilities of point hypotheses assume equal prior probabilities.
# }