Individual Project 2

title: “Individual Project 2”
author: ”
word_document: default

html_document: default

“`{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)

{r seed}

{r libraries}

{r constants}

{r functions}

{r load_data}

{r explore_data, eval = FALSE}

{r clean_data}

# Instructions {.tabset}

## Overview

Your new client is a health insurance company.  After a lengthy review of their business, the insurance company has decided to prioritize improvements in medication adherence.  For our initial work, we will focus on patients with heart disease and how well they take their medications.

Your team has received some modest training from a physician.  Here are the basic facts you need to know.  Heart disease is one of the most pervasive health problems, especially for older patients.  The initial diagnosis typically occurs too late.  Most patients only become aware that they have heart disease after experiencing an acute episode.  This can be limited to moderate symptoms, which might be treated by either medications or a light procedure.  In more severe cases, the patient might suffer a major event such as a myocardial infarction (heart attack) or need a significant surgical operation.  Whether minor or major, these events often include a hospitalization.  After the initial diagnosis, patients are typically prescribed a range of medications.  Three primary therapies include ACE inhibitors, beta blockers, and statins.

The insurance company has helpfully compiled data on a large number of patients.  They have included a number of important clinical factors about their baseline conditions.  Then, starting from the time of their initial diagnoses of heart disease, the patients were tracked based upon which medications were filled at the pharmacy.  The medication records are presented in the form of panel data.  A single patient's records are linked by a unique identifier.  The time measurements represent the number of days since baseline.  Prescriptions are typically filled for 30 or 90 days of medications.  For this study, you may assume that the patients qualified for our study and reasonably could have been expected to be prescribed all of the medicines we are tracking.

In this project, you will develop an approach to working with the information.  The client company has provided a list of questions they would like to address.  In addition to building the report, our team would also like you to present recommendations on how to improve upon the infrastructure.  We also want you to identify opportunities for the client to make use of the information you're working with in novel ways.

This project is divided into 4 parts:

* **Part 1:**  Summarizing the data.

* **Part 2:**  Answering specific questions about medication adherence.

* **Part 3:**  Generalizing and automating the reporting infrastructure for use beyond the current version.

* **Part 4:**  Identifying opportunities.

Please click on the other tabs for additional information.

## Part 1:  Summary {.tabset}

How would you summarize the data?  For each table, write 2-4 sentences with relevant information.  Briefly describe what is measured in the data and provide a summary of the information.  You can show a table or graphic, but keep things short.

This part of the report will be directed to your internal team at the consulting company.  It is intended to document the sources of information that were used in the project.  It will also describe the data in less technical terms to team members who are not data scientists.  If another member of the team joins the project later, they will rely on your descriptions to gain familiarity with the data.  To that end, we recommend providing some instructions that will help other consultants use the information more effectively.

Click on the tabs below for further instructions.

### Baseline Information {.tabset}

{r baseline}

### Adherence {.tabset}

{r Adherence}

## Part 2:  Specific Questions {.tabset}

In addition to your summary, our team has identified specific questions of interest.  Please provide these answers in output that is easy to read (e.g. tables).

This part of the report will be directed to medical case management teams throughout the client's company.  The idea is to give them the useful information they need to act on the specific questions they posed.  Plan your communication accordingly.

**Notes**:  Using data.table, most of these calculations can be solved in a moderate number of steps.  Many of the questions may require information from multiple tables.  Use the **merge** function to combine tables as needed.  HTML-friendly tables can be constructed using the **datatable** function in the **DT** package.

These questions were carefully crafted based upon the client's needs.  It is important to answer them based on what is stated.  To that end, please **read each question closely** and answer it accordingly.

The questions are listed in the tabs below.

### Q1 {.tabset}

What was the median length of followup?  What percentage of the patients had at least 1 year of records?

{r q1}

### Q2

For patients with at least 1 year of follow-up, their **one-year adherence** to a medication is the proportion of days in the first year after diagnosis during which the medication was possessed.  For each medication, what was the average one-year adherence for the population?  Use only the patients with at least 1 year of follow-up records.

{r q2}

### Q3

How many medications are the patients taking?  For patients with at least one year of follow-up, use their records during the first year after the initial diagnosis.  Calculate the overall percentage distribution of the days that the patients are taking 0, 1, 2, and all 3 medications.

{r q3}

### Q4 {.tabset}

What is the impact of age, sex, region, diabetes, and baseline condition on the one-year adherence to each medication?  Use only the patients with at least 1 year of follow-up records.  Fit separate linear regression models for each medicine.  Then briefly comment on the results.

{r one.year.adherence.model.dat}

#### ACE Inhibitors

{r q4_ace}

#### Beta Blockers

{r q4_bb}

#### Statins

{r q4_statin}

### Q5

For each medicine, what percentage of the patients filled a prescription in the first two weeks after their initial diagnoses?

{r q5}

### Q6 {.tabset}

Now let's compare those who filled a prescription for a statin in the first two weeks after diagnosis to those who did not.  Do these two groups have different baseline covariates?  Compare the groups based on their ages.  Then compare the distribution of baseline conditions in the two groups. For continuous variables, compare their means using a t-test.  For the categorical variables, compare their distributions using a chi-squared test.  

#### Age

{r q6_age}

#### Baseline Conditions

{r q6_baseline.condition}

### Q7 {.tabset}

How do the variables of age, sex, region, diabetes, and baseline condition impact the likelihood of initiating a medication within 14 days?  For each medicine, fit a logistic regression model and comment on the results.

{r q7}

#### ACE Inhibitors

{r q7_ace}

#### Beta Blockers

{r q7_bb}

#### Statins

{r q7_statins}

### Q8 {.tabset}

For those who did fill their prescriptions within 2 weeks, how long does it typically take to fill that first prescription after the initial diagnosis?  For each medicine, provide the mean, median, and standard deviation in units of days.

{r q8}

#### ACE Inhibitors

{r q8_ace}

#### Beta Blockers

{r q8_bb}

#### Statins

{r q8_statin}

### Q9 {.tabset}

How does filling a prescription in the first two weeks impact adherence?  If we want to see that a medicine is working, we need to start the observation after the patient has had a chance to fill the prescription.  To answer this question, we will follow a number of steps:

1.  Identify which patients filled a prescription in the first two weeks.

2.  Then, for each patient with at least 379 days of followup, measure the one-year adherence rate (see Question 2) **starting at two weeks after the initial diagnosis**.  This interval will begin at day 14 and last for 365 days.

3.  Fit a linear regression model of this one-year adherence including the baseline covariates (age, sex, region, diabetes, baseline condition) and an indicator of whether this patient filled a prescription for the medicine in the first two weeks.

Perform this analysis for each medicine and comment on the results.

{r q9}

#### ACE Inhibitors

{r q9_ace}

#### Beta Blockers

{r q9_bb}

#### Statins

{r q9_statin}

### Q10 {.tabset}

Once a patient starts a medication, how long do they continuously have a filled prescription?  For each patient who filled a medication, start with the first filled prescription and count the duration of days until a gap occurs or follow-up ends.  Then provide the mean, median, and standard deviation for these durations.  Do this separately for each medicine.

{r q10}

#### ACE Inhibitors

{r q10_ace}

#### Beta Blockers

{r q10_bb}

#### Statins

{r q10_statin}


Part 3: Generalization {.tabset}

This part of the report will be directed internally to your team’s engagement manager. The idea is to present these approaches to your team. The work will then be conveyed to the client’s technical team and middle managers who are working closely with you on the project. Plan your communication accordingly.


Did you see any problems with the data set? If so, whom would you report them to, and what would you do to address them? What would be different about the next version of the data?


If the organization wants to monitor this kind of information over time, what would they need to provide, and at what frequency?


How would you build on the reporting capabilities that you have created? What would you design next?

Part 4: Opportunities {.tabset}

This part of the report will be directed externally to your client’s senior leadership. Your work will help to determine the future direction of the project and the company’s contract with this client. Plan your communication accordingly.


What are some opportunities to learn valuable information and inform strategic decisions? List a number of questions that you might explore.


What kind of interventions would you build to help improve medication adherence? Which populations would you work with? How would you help them?


How would you approach other decisionmakers within the organization to assess their priorities and help them better utilize the available information?


Video Submission: Make a 2-minute pitch to the client with a proposal for the next phase of work. Include in your request a budget, a time frame, and staffing levels. Explain why this proposal would be valuable for the client and worth the investment in your consulting services. Please submit this answer as a short video recording. You may use any video recording program you feel comfortable with. The only requirements are that you are visible and audible in the video. You may also submit a file of slides if that is part of your pitch

What do you think?

Related Post


Corporate Social Responsibility Analysis Worksheet Student: Industry/Company: What is the company mission statement? • Does it have any implications for CSR? The mission statement of PepsiCo is to provide consumers