Skip to content

Commit

Permalink
up docs
Browse files Browse the repository at this point in the history
  • Loading branch information
lrnv committed Apr 2, 2024
1 parent 6d7e5e8 commit b8508c5
Showing 1 changed file with 30 additions and 7 deletions.
37 changes: 30 additions & 7 deletions docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,47 @@ Then loading it through
using RateTables
```

provides a constant dictionary `RT_HMD` from which countries rate tables can be queried as follows:
provides a few constants rate tables objects. In particular: a constant dictionary `RT_HMD` from which countries rate tables can be queried as follows:
```example 1
RT_HMD[:SVN]
julia>
rt = RT_HMD[:SVN] # SVN for slovenia.
```

The list of availiable countries is as follows:

To obtain, for example, the daily hazard rate for a male, slovene, on its 20th birthday on the first of january 2010, you can call the `daily_hazard` function with several syntaxes:

```@example 1
a = 20*365.241
d = 2010*365.241
s = :male
v1 = daily_hazard(rt, a, d, s)
v2 = daily_hazard(rt, a, d; sex=s)
v3 = daily_hazard(rt[s], a, d)
(v1,v2,v3)
```

Note that there is a discrepency between HMD datasets and datasets from other places. For completeness, this package also include datasets commonly used in R for census datas, in particular the `relsurv::slopop` dataset for slovenia :

```@example 1
Dict(k => RT_HMD[k].country_name for k in keys(RT_HMD))
v1 = daily_hazard(slopop, a, d, s)
v2 = daily_hazard(slopop, a, d; sex=s)
v3 = daily_hazard(slopop[s], a, d)
(v1,v2,v3)
```

To obtain, for example, the daily hazard rate for a male (code 1), from slovenia, on it's 80th birthday on the 1rst january 2019:

Sometimes there is more covariates in the datasets than only the sex. Ths is for example the case for the `survival::survexp.usr` dataset that includes the race. In this case, the calling structure is very similar:
```@example 1
daily_hazard(RT_HMD[:SVN], 365.241*80, 365.241*2019, 1)
r = :white
v1 = daily_hazard(survexp_usr, a, d, s, r)
v2 = daily_hazard(survexp_usr, a, d; sex=s, race=r)
v3 = daily_hazard(survexp_usr[s, r], a, d)
(v1,v2,v3)
```


Check out the index below for the list of availiable datasets.


```@index
```

Expand Down

0 comments on commit b8508c5

Please sign in to comment.