Checks the entries of demographics data frame used for parameter stratification

check_demographics(demographics, par_tab = NULL, verbose = FALSE)

Arguments

demographics

the data frame of demographics data. Must have columns: individual (integer ID of individual); birth (numeric time of birth); any other columns also in par_tab$stratification will be checked.

par_tab

Optional: the parameter table controlling information such as bounds, initial values etc. If included, this will be used to check that the demographics data is consistent with the data.

verbose

if TRUE, prints warning messages

Value

the same data object with corrections if needed

Examples

data(example_antibody_data)
demographics <- unique(example_antibody_data[, c("individual", "birth")])
check_demographics(demographics)
#>      individual birth
#> 1             1  1988
#> 121           2  1981
#> 241           3  1968
#> 361           4  1946
#> 481           5  1992
#> 601           6  1946
#> 721           7  1943
#> 841           8  1962
#> 961           9  1964
#> 1081         10  2001
#> 1201         11  1992
#> 1321         12  1994
#> 1441         13  1960
#> 1561         14  1980
#> 1681         15  1955
#> 1801         16  1973
#> 1921         17  1958
#> 2041         18  1940
#> 2161         19  1980
#> 2281         20  1954
#> 2401         21  1944
#> 2521         22  1991
#> 2641         23  1962
#> 2761         24  1997
#> 2881         25  1988
#> 3001         26  1980
#> 3121         27  2005
#> 3241         28  1980
#> 3361         29  1948
#> 3481         30  1983
#> 3601         31  1974
#> 3721         32  1966
#> 3841         33  1973
#> 3961         34  1993
#> 4081         35  1951
#> 4201         36  1961
#> 4321         37  1953
#> 4441         38  1998
#> 4561         39  1958
#> 4681         40  1978
#> 4801         41  1951
#> 4921         42  1963
#> 5041         43  1954
#> 5161         44  1969
#> 5281         45  1971
#> 5401         46  1953
#> 5521         47  2004
#> 5641         48  1974
#> 5761         49  1957
#> 5881         50  1960