Closed A-Whitmarsh closed 4 weeks ago
I've made a few changes:
index_date > end_date_outcome
(link to code)population
and outcome_name
(link to code)inner_join
with left_join
to make sure we keep patients with no events in the dataset (e.g. here)data_repeat_events_episodes_long
to reduce the number of joins and group_by()
commands (link to code)@A-Whitmarsh please check your happy with these changes.
Additionally, please confirm whether patients can start an episode on index_date
or end_date_outcome
(as implemented in these lines)
@venexia - before merging this branch, we should discuss:
index_date
falls during an episode, should the new index_date
be episode_end
or episode_end+1
index_date
or end_date_outcome
(and can stset
in Stata handle this? If not, maybe we need to -/+1
to index_date
/end_date_outcome
?)@venexia I've transformed the repeat events episodes data to wide before saving, as discussed on the call.
I do wonder whether it would be better to use survival::tmerge()
to format the data with start/stop times at this stage, or whether that would cause problems when analysing it in Stata?
Update code to include episodes that started before index_date. If patient is in episode at index_date, update index_date to be end of first episode and then remove first episode.