<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Resources and example code | Advanced Epidemiologic Methods</title>
    <link>https://epid722sp22.edwardsjk.com/example/</link>
      <atom:link href="https://epid722sp22.edwardsjk.com/example/index.xml" rel="self" type="application/rss+xml" />
    <description>Resources and example code</description>
    <generator>Source Themes Academic (https://sourcethemes.com/academic/)</generator>
    <image>
      <url>https://epid722sp22.edwardsjk.com/img/epid722logo.png</url>
      <title>Resources and example code</title>
      <link>https://epid722sp22.edwardsjk.com/example/</link>
    </image>
    
    <item>
      <title>Course feedback</title>
      <link>https://epid722sp22.edwardsjk.com/example/feedback/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://epid722sp22.edwardsjk.com/example/feedback/</guid>
      <description>
&lt;script src=&#34;https://epid722sp22.edwardsjk.com/rmarkdown-libs/header-attrs/header-attrs.js&#34;&gt;&lt;/script&gt;


&lt;iframe src=&#34;https://docs.google.com/forms/d/e/1FAIpQLSfjObvqf6z5QG6ZNGXCdNAjdZkGmqmu31UFwyhdybeaUZIwkA/viewform?embedded=true&#34; width=&#34;640&#34; height=&#34;403&#34; frameborder=&#34;0&#34; marginheight=&#34;0&#34; marginwidth=&#34;0&#34;&gt;
Loading…
&lt;/iframe&gt;
</description>
    </item>
    
    <item>
      <title>Final Project</title>
      <link>https://epid722sp22.edwardsjk.com/example/project/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://epid722sp22.edwardsjk.com/example/project/</guid>
      <description>


&lt;p&gt;The purpose of the final project is to design a target trial to answer a public health or clinical question.&lt;/p&gt;
&lt;div id=&#34;components&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Components&lt;/h2&gt;
&lt;p&gt;The final project will consist of 2 parts:&lt;/p&gt;
&lt;ol style=&#34;list-style-type: decimal&#34;&gt;
&lt;li&gt;A presentation in class on April 19th or 21st&lt;/li&gt;
&lt;li&gt;A 1- to 2-page document summarizing your target trial&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;div id=&#34;process&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Process&lt;/h2&gt;
&lt;p&gt;Students will work in groups of 3 to form a question and design a target trial to answer that question. Note that the assignment is to &lt;em&gt;design&lt;/em&gt; the target trial only; there is no need to discuss how one would emulate the target trial with observational data.&lt;/p&gt;
&lt;p&gt;In class presentations will be no more than 7 minutes in length. Groups may divide responsibilities however they see fit. Groups may divide the presentation between all members or elect 1 or 2 group members to speak. After each presentation, groups will field questions from the class and the instructional team.&lt;/p&gt;
&lt;p&gt;In addition to the presentations, groups should submit a 1- to 2-page document describing their study question and target trial to the teaching team on the day of their presentation.&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;content&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Content&lt;/h2&gt;
&lt;p&gt;A target trial is a hypothetical randomized trial that you would do to answer a question of interest. The target trial need not be feasible nor ethical. Rather, the target trial is a mental device that sharpens questions. Designing a target trial is a useful first step when addressing causal questions. With the target trial in hand, one could either implement the trial, or some version of the trial, or emulate the trial using observational data.&lt;/p&gt;
&lt;p&gt;Necessary components of the target trial include:&lt;/p&gt;
&lt;p&gt;A. A detailed question, including&lt;/p&gt;
&lt;ol style=&#34;list-style-type: decimal&#34;&gt;
&lt;li&gt;Aim&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;Target population&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;Actions considered&lt;/li&gt;
&lt;li&gt;Origin/timescale&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;Outcome&lt;/li&gt;
&lt;li&gt;Parameter of interest&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;B. How a target trial would answer the question, including&lt;/p&gt;
&lt;ol style=&#34;list-style-type: decimal&#34;&gt;
&lt;li&gt;Aim&lt;/li&gt;
&lt;li&gt;Significance&lt;/li&gt;
&lt;li&gt;Eligibility criteria&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;Sampling/recruitment strategy&lt;/li&gt;
&lt;li&gt;Actions forming arms of the trial (treatment strategies, exposure plans, what is being manipulated?)&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;How will actions be assigned?&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;Follow-up (when does it start and end? when does randomization occur?)&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;Outcome definitions&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;Causal contrast (parameter of interest)&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;Presentation of hypothetical results (table and figure)&lt;/li&gt;
&lt;li&gt;Impact (how will results be used?)&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;As noted above, a third step described in many papers that use target trials to sharpen a question is to emulate the target trial using observational data. For this project, you are &lt;em&gt;not&lt;/em&gt; required to outline how you might emulate the target trial using observational data. (But, this is something you will likely need to do in your career, and we discuss how to do so in the lecture on April 7th).&lt;/p&gt;
&lt;p&gt;In addition to addressing the components listed above, projects should include a statement on the significance of the question (why this question at this time?) and the potential impact of the work (how will results be used?).&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;preparation&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Preparation&lt;/h2&gt;
&lt;p&gt;On February 24th, we will discuss the design of target trials, including the elements needed for this assignment. On April 7th, we will revisit the design of target trials and discuss how to emulate target trials using observational data. During the lab session on April 12th, groups will have the opportunity to give and receive peer feedback on each other’s target trial designs.&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;deadlines&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Deadlines&lt;/h2&gt;
&lt;ol style=&#34;list-style-type: decimal&#34;&gt;
&lt;li&gt;By &lt;strong&gt;February 10th&lt;/strong&gt;: Form 3-person groups and inform teaching team of your group by email&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;By &lt;strong&gt;March 31st&lt;/strong&gt;: Determine your general study question and send to teaching team&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;By &lt;strong&gt;April 12th&lt;/strong&gt;: Develop draft of your target trial design to obtain feedback during lab&lt;br /&gt;
4: &lt;strong&gt;April 19th/21st&lt;/strong&gt;: Present target trial to class and submit 1-pager&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;div id=&#34;faqs&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;FAQs&lt;/h2&gt;
&lt;ol style=&#34;list-style-type: decimal&#34;&gt;
&lt;li&gt;What if I don’t have a group?&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;If you need help finding a group, please reach out to the teaching team and we will place you in a group.&lt;/p&gt;
&lt;ol start=&#34;2&#34; style=&#34;list-style-type: decimal&#34;&gt;
&lt;li&gt;How do I choose a topic?&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;You may choose the topic of your study question from any area of epidemiology. Note that, for this assignment, you will need to ask a &lt;em&gt;causal&lt;/em&gt; question that lends itself to some type of action. To specify a target trial, your exposure/treatment/plan/etc will need to be manipulable. (While descriptive questions are also critically important for epidemiology, a descriptive question will not fill the needs of this assignment). If you would like preliminary feedback on your topic or assistance in finding a topic, please contact the teaching team ahead of the March 31st deadline.&lt;/p&gt;
&lt;ol start=&#34;3&#34; style=&#34;list-style-type: decimal&#34;&gt;
&lt;li&gt;What format should be used for presentations?&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Presentations should be no more than 7 minutes in length and should be presented in the style of a short conference presentation or funding proposal. Presentations will be assessed for content and clarity. Slides are allowed but not required. Some visual element should be used.&lt;/p&gt;
&lt;ol start=&#34;4&#34; style=&#34;list-style-type: decimal&#34;&gt;
&lt;li&gt;What is the desired format for the document?&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The document must be no more than 1 to 2 pages and can include text and figures. Please strive for brevity and clarity.&lt;/p&gt;
&lt;ol start=&#34;5&#34; style=&#34;list-style-type: decimal&#34;&gt;
&lt;li&gt;Where can I go for help?&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Please contact the teaching team with any additional questions.&lt;/p&gt;
&lt;/div&gt;
</description>
    </item>
    
    <item>
      <title>Line Diagrams</title>
      <link>https://epid722sp22.edwardsjk.com/example/linediagrams/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://epid722sp22.edwardsjk.com/example/linediagrams/</guid>
      <description>
&lt;script src=&#34;https://epid722sp22.edwardsjk.com/rmarkdown-libs/header-attrs/header-attrs.js&#34;&gt;&lt;/script&gt;


&lt;div id=&#34;why-would-i-need-code-for-a-line-diagram&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Why would I need code for a line diagram?&lt;/h2&gt;
&lt;p&gt;Line diagrams are easy to draw by hand, but can get unwieldy for real datasets. But sometimes plotting the line diagram can be useful. This includes settings when you want a quick visual check of&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;the administrative censoring date&lt;/li&gt;
&lt;li&gt;the presence of late entry&lt;/li&gt;
&lt;li&gt;the maximum follow-up time&lt;/li&gt;
&lt;li&gt;etc&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div id=&#34;r-code-to-produce-line-diagrams&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;R code to produce line diagrams&lt;/h2&gt;
&lt;div id=&#34;simple-simulated-data-used-in-l1&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Simple simulated data (used in L1)&lt;/h3&gt;
&lt;p&gt;First, we generate simple data on 20 participants as describe by L1:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;“Say you wish to estimate the 5-year risk of death among people entering HIV care. You have a database of people entering HIV care between 2012 and 2020.”&lt;/p&gt;
&lt;/blockquote&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;### Generate some data -----
require(dplyr)
set.seed(123)
year0 &amp;lt;- runif(20, min=2012, max = 2020)
t &amp;lt;- runif(20, min=2, max = 15)
dat &amp;lt;- data.frame(year0, t)


dat &amp;lt;- dat %&amp;gt;% mutate(y=ifelse(t+year0&amp;gt;2020 | t&amp;gt;5, 0, 1),
                      t = ifelse(t+year0&amp;gt;2020, 2020-year0, t), 
                      t = ifelse(t&amp;gt;5, 5, t),
                      id = row_number())

dat&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;##       year0         t y id
## 1  2014.301 5.0000000 0  1
## 2  2018.306 1.6935589 0  2
## 3  2015.272 4.7281846 0  3
## 4  2019.064 0.9358608 0  4
## 5  2019.524 0.4762617 0  5
## 6  2012.364 5.0000000 0  6
## 7  2016.225 3.7751561 0  7
## 8  2019.139 0.8606476 0  8
## 9  2016.411 3.5885199 0  9
## 10 2015.653 3.9124774 1 10
## 11 2019.655 0.3453332 0 11
## 12 2015.627 4.3733268 0 12
## 13 2017.421 2.5794349 0 13
## 14 2016.581 3.4189328 0 14
## 15 2012.823 2.3199779 1 15
## 16 2019.199 0.8014002 0 16
## 17 2013.969 5.0000000 0 17
## 18 2012.336 4.8133032 1 18
## 19 2014.623 5.0000000 0 19
## 20 2019.636 0.3639708 0 20&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Produce the line diagram by creating line segments and points in &lt;code&gt;ggplot&lt;/code&gt;.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;# Calendar time as timescale
library(grid)
library(ggthemr)
ggthemr(&amp;#39;solarized&amp;#39;)
line &amp;lt;- ggplot() +
  geom_segment(data = dat %&amp;gt;% filter(y==0), aes(x = year0, y = id, xend = year0+t, yend = id),  arrow = arrow(length = unit(0.1, &amp;quot;cm&amp;quot;))) +
  geom_segment(data = dat %&amp;gt;% filter(y==1), aes(x = year0, y = id, xend = year0+t, yend = id)) +
  scale_y_continuous(name = &amp;quot;ID&amp;quot;, breaks = c(1, 5, 10, 15, 20), limits = c(0,20))+
  scale_x_continuous(name = &amp;quot;Calendar Time&amp;quot;, breaks=c(2012, 2014, 2016, 2018,  2020), limits = c(2012, 2021)) +
  geom_point(data = dat %&amp;gt;% filter(y==1), aes(x = year0+t, y = id), color = &amp;quot;red&amp;quot;, size = 0.6) +
  theme(text = element_text(size = 14, family = &amp;quot;Open Sans&amp;quot;))

line&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://epid722sp22.edwardsjk.com/example/linediagrams_files/figure-html/unnamed-chunk-2-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;p&gt;Reorganize plot to show time since entry into HIV care on the &lt;code&gt;x&lt;/code&gt;-axis.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;# Calendar time as timescale
line2 &amp;lt;- ggplot() +
  geom_segment(data = dat %&amp;gt;% filter(y==0), aes(x = 0, y = id, xend = t, yend = id),  arrow = arrow(length = unit(0.1, &amp;quot;cm&amp;quot;))) +
  geom_segment(data = dat %&amp;gt;% filter(y==1), aes(x = 0, y = id, xend = t, yend = id)) +
  scale_y_continuous(name = &amp;quot;ID&amp;quot;, breaks = c(1, 5, 10, 15, 20), limits = c(0,20))+
  scale_x_continuous(name = &amp;quot;Calendar Time&amp;quot;, breaks=c(0, 1, 2, 3, 4, 5), limits = c(0, 6)) +
  geom_point(data = dat %&amp;gt;% filter(y==1), aes(x = t, y = id), color = &amp;quot;red&amp;quot;, size = 0.6) +
  theme(text = element_text(size = 14, family = &amp;quot;Open Sans&amp;quot;))

line2&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://epid722sp22.edwardsjk.com/example/linediagrams_files/figure-html/unnamed-chunk-3-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;example-data-similar-to-cole-hudgens-2010&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Example data (similar to Cole &amp;amp; Hudgens 2010)&lt;/h3&gt;
&lt;p&gt;Next, we read in some sample data similar to that used in Cole &amp;amp; Hudgens 2010.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;##   int     year        w        t cenyear d late newid yearw    yeart
## 1   1 2010.320 4.679838 5.527338    2020 1    1     1  2015 2015.848
## 2   1 2010.321 4.678720 9.557808    2020 1    1     2  2015 2019.879
## 3   1 2010.427 4.573213 9.573213    2020 0    1     3  2015 2020.000
## 4   1 2010.509 4.490943 9.490943    2020 0    1     4  2015 2020.000
## 5   1 2010.645 4.355168 9.355168    2020 0    1     5  2015 2020.000
## 6   1 2010.775 4.224887 9.224887    2020 0    1     6  2015 2020.000&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div id=&#34;calendar-timescale&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Calendar timescale&lt;/h3&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;### Create second dataset with only events ------
exdat2 &amp;lt;- exdat[exdat$d == 1, ]

### Plot the lines -----
line &amp;lt;- ggplot(data = exdat) +
  geom_segment(aes(x = year, y = newid, xend = yearw, yend = newid), lty = &amp;quot;dotted&amp;quot;) +
  geom_segment(aes(x = yearw, y = newid, xend = yeart, yend = newid)) +
  ylab(&amp;quot;ID&amp;quot;) +
  scale_x_continuous(name = &amp;quot;Calendar Time&amp;quot;, breaks=c(2010, 2015,  2020)) +
  geom_point(data = exdat2, aes(x = yeart, y = newid), color = &amp;quot;red&amp;quot;, size = 0.5) +
  theme(text = element_text(size = 16, family = &amp;quot;Open Sans&amp;quot;))

line&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://epid722sp22.edwardsjk.com/example/linediagrams_files/figure-html/unnamed-chunk-5-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;time-since-aids-diagnosis&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Time since AIDS diagnosis&lt;/h3&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;line2 &amp;lt;- ggplot(data = exdat) +
  geom_segment(aes(x = 0, y = newid, xend = w, yend = newid), lty = &amp;quot;dotted&amp;quot;) +
  geom_segment(aes(x = w, y = newid, xend = t, yend = newid)) +
  ylab(&amp;quot;ID&amp;quot;) +
  scale_x_continuous(name = &amp;quot;Time since AIDS diagnosis&amp;quot;, breaks = c(0,2, 4, 6, 8, 10)) +
  geom_point(data = exdat2, aes(x = t, y = newid), color = &amp;quot;red&amp;quot;, size = 0.5) +
  
  theme(text = element_text(size = 14, family = &amp;quot;Open Sans&amp;quot;))

line2&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://epid722sp22.edwardsjk.com/example/linediagrams_files/figure-html/unnamed-chunk-6-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
</description>
    </item>
    
  </channel>
</rss>
