Skip to contents

Store a process specification under its name, replacing any existing process with the same name.

Usage

set_process(model, process)

Arguments

model

A hammel_model object.

process

A hammel_process specification.

Value

An updated hammel_model. The input model is not modified.

Details

The available processes are:

Use this function to attach an already-created process. The convenience setters set_mortality(), set_fertility(), set_union_formation(), set_union_dissolution(), and set_group_transition() construct and attach the corresponding process in one call.

Examples

mortality_process <- mortality(usa_2000_mortality)
model <- hammel_model() |> set_process(mortality_process)
model$processes
#> $mortality
#> $name
#> [1] "mortality"
#> 
#> $rates
#> # A tibble: 44 × 4
#>    sex   age_start age_end     rate
#>    <chr>     <int>   <dbl>    <dbl>
#>  1 f             0       1 0.00628 
#>  2 f             1       5 0.000288
#>  3 f             5      10 0.000142
#>  4 f            10      15 0.000159
#>  5 f            15      20 0.000396
#>  6 f            20      25 0.000471
#>  7 f            25      30 0.000536
#>  8 f            30      35 0.000745
#>  9 f            35      40 0.00114 
#> 10 f            40      45 0.00174 
#> # ℹ 34 more rows
#> 
#> attr(,"class")
#> [1] "hammel_mortality" "hammel_process"  
#>