Skip to contents

Report date logit hazard reporting model module

Usage

enw_report(non_parametric = ~0, structural = ~0, data)

Arguments

non_parametric

A formula (as implemented in enw_formula()) describing the non-parametric logit hazard model. This can use features defined by report date as defined in metareport as produced by enw_preprocess_data(). Note that the intercept for this model is set to 0 as it should be used for specifying report date related hazards vs time invariant hazards which should instead be modelled using the non_parametric argument of enw_reference()

structural

A formula with fixed effects and using only binary variables, and factors describing the known reporting structure (i.e weekday only reporting). The base case (i.e the first factor entry) should describe the dates for which reporting is possible. Internally dates with a non-zero element in the design matrix have their hazard set to 0. This can use features defined by report date as defined in metareport as produced by enw_preprocess_data(). Note that the intercept for this model is set to 0 in order to allow all dates without other structural reasons to not be reported to be reported. Note that this feature is not yet available to users.

data

Output from enw_preprocess_data().

Value

A list containing the supplied formulas, data passed into a list describing the models, a data.frame describing the priors used, and a function that takes the output data and priors and returns a function that can be used to sample from a tightened version of the prior distribution.

See also

Examples

enw_report(data = enw_example("preprocessed"))
#> $formula
#> $formula$non_parametric
#> [1] "~1"
#> 
#> 
#> $data
#> $data$rep_fdesign
#>   (Intercept)
#> 1           1
#> 
#> $data$rep_fintercept
#> [1] 1
#> 
#> $data$rep_fnrow
#> [1] 1
#> 
#> $data$rep_findex
#>      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,14]
#> [1,]    1    1    1    1    1    1    1    1    1     1     1     1     1     1
#>      [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24] [,25] [,26]
#> [1,]     1     1     1     1     1     1     1     1     1     1     1     1
#>      [,27] [,28] [,29] [,30] [,31] [,32] [,33] [,34] [,35] [,36] [,37] [,38]
#> [1,]     1     1     1     1     1     1     1     1     1     1     1     1
#>      [,39] [,40] [,41] [,42] [,43] [,44] [,45] [,46] [,47] [,48] [,49] [,50]
#> [1,]     1     1     1     1     1     1     1     1     1     1     1     1
#>      [,51] [,52] [,53] [,54] [,55] [,56] [,57] [,58] [,59] [,60]
#> [1,]     1     1     1     1     1     1     1     1     1     1
#> 
#> $data$rep_fnindex
#> [1] 60
#> 
#> $data$rep_fncol
#> [1] 0
#> 
#> $data$rep_rdesign
#>      (Intercept)
#> attr(,"assign")
#> [1] 0
#> 
#> $data$rep_rncol
#> [1] 0
#> 
#> $data$rep_t
#> [1] 60
#> 
#> $data$model_rep
#> [1] 0
#> 
#> 
#> $priors
#>       variable                                             description
#>         <char>                                                  <char>
#> 1: rep_beta_sd Standard deviation of scaled pooled report date effects
#>             distribution  mean    sd
#>                   <char> <num> <num>
#> 1: Zero truncated normal     0     1
#> 
#> $inits
#> function (data, priors) 
#> {
#>     priors <- enw_priors_as_data_list(priors)
#>     fn <- function() {
#>         init <- list(rep_beta = numeric(0), rep_beta_sd = numeric(0))
#>         if (data$rep_fncol > 0) {
#>             init$rep_beta <- array(rnorm(data$rep_fncol, 0, 0.01))
#>         }
#>         if (data$rep_rncol > 0) {
#>             init$rep_beta_sd <- array(abs(rnorm(data$rep_rncol, 
#>                 priors$rep_beta_sd_p[1], priors$rep_beta_sd_p[2]/10)))
#>         }
#>         return(init)
#>     }
#>     return(fn)
#> }
#> <bytecode: 0x56178e972118>
#> <environment: 0x56178e96bc80>
#>