Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/mbg-unsw/Rwtdttt
Browse files Browse the repository at this point in the history
  • Loading branch information
sabrinagiometto committed Jun 25, 2024
2 parents 99fcdb7 + d60209e commit afb61a2
Show file tree
Hide file tree
Showing 14 changed files with 23 additions and 504 deletions.
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,32 @@ The parametric Waiting Time Distribution has been developed to provide a data-dr

This implementation of estimation procedures mimics that found in the corresponding Stata package (wtdttt). The model is fit using maximum likelihood estimation.

## Example

```R
library(haven)
df <- read_dta(system.file("extdata", "ranwtddat_discdates.dta", package="Rwtdttt"))

fit_r <- ranwtdttt(data = df,
rxdate ~ dlnorm(logitp, mu, lnsigma),
id = "pid",
start = as.Date('2014-01-01'),
end = as.Date('2014-12-31'),
reverse = T, robust = F
)

summary(fit_r)
```
Please see [examples.R](sandpit/examples.R) for more.

## More

### Known bugs

Robust variance calculation, used by default in the randwtdttt() function, is very slow. We are working on improving this.

Other planned improvements are listed in [TODO](sandpit/TODO)

### Bug reports, feature requests etc.

This is a young project with some rough edges. Please submit any bug reports, feature request and comments as a Github issue.
Expand All @@ -40,6 +60,8 @@ The package was developed by:
* Malcolm Gillies
* Olga Paoletti

Thank you to Jesper Hallas for kindly allowing us to reproduce the synthetic dispensing data in the `drugpakud.dta` dataset.

### License

Rwtdttt is licensed under the GNU General Public License, Version 3.
Expand Down
Binary file added inst/extdata/score_ex.xlsx
Binary file not shown.
60 changes: 0 additions & 60 deletions sandpit/d1functions.R

This file was deleted.

3 changes: 1 addition & 2 deletions sandpit/try2.R → sandpit/examples.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Quick test

library(bbmle)
library(Rwtdttt)
#library(Rwtdttt)
library(haven)
library(data.table)
library(tidyverse)
Expand Down Expand Up @@ -71,7 +71,6 @@ summary(fit1)
df <- haven::read_dta(system.file("extdata", "wtddat_covar.dta", package="Rwtdttt"))

### fit waiting time distribution (exp)
# XXXX need to change wtdttt(... subset= ...) to use non-standard evaluation
fit3 <- wtdttt(data = df,
last_rxtime ~ dexp(logitp, lnbeta),
start = 0, end = 1, reverse = T, subset = packsize==200
Expand Down
31 changes: 0 additions & 31 deletions sandpit/good_practises.R

This file was deleted.

6 changes: 0 additions & 6 deletions sandpit/mlwtdttt_lnorm.R

This file was deleted.

80 changes: 0 additions & 80 deletions sandpit/sandwich_estimation_code_malcolm.R

This file was deleted.

97 changes: 0 additions & 97 deletions sandpit/try.R

This file was deleted.

43 changes: 0 additions & 43 deletions sandpit/try_sandwich.R

This file was deleted.

Loading

0 comments on commit afb61a2

Please sign in to comment.