Lecture: Logistic Regression  


Assigned Reading

  • Logistic regression Read►
  • Replacing logistic regression with ordinary regression Slides►


Question 1: What is the logit of probability 0.75?

Question 2: Regress survival in next 6 months on comorbidities of the patients, age of patients, gender of patients and whether they  participated in the medical foster home program. MFH is an intervention for nursing home patients.  In this program, nursing home patients are diverted to a community home and health care services are delivered within the community home.  The resident eats with the family and relies on the family members for socialization, food and comfort.  It is called "foster" home because the family previously living in the community home is supposed to act like the resident's family. Enrollment in MFH is indicated by a variable MFH=1. 

Survival is reported in two variables.  One variable indicates survival in 6 months.  Another reports days known to survive, if the patient has died and otherwise null.  Thus a null value in this latter variable indicates the patient did not die.  

CCS in these data refers to Clinical Classification System of Agency for Health Care Research and Quality.  These data indicate the comorbidities of the patient.  When null, it is assumed the patient did not have the comorbidity.  When data are entered it is assumed that the patient had the comorbidity and the reported value is the first (maximum) or last (minimum) number of days till admission to either the nursing home or the MFH. Thus an entry of 20 under the minimum CCS indicates that from the most recent occurrence of the comorbidity till admission was 20 days.  An entry of 400 under the Maximum CCS indicates that from the first time the comorbidity occurred till admission was 400 days. You choose what data (minimum, maximum, occurrence) is relevant for the analysis and you use what you think should be used. Keep in mind the possibility that for acute illness the most recent event may be predictive while for chronic illness the first occurrence may be predictive of cost.

The functional disabilities are probabilities that the patient has the disability.  These probabilities are generated from the CCS diagnoses and demographics of the person.

  1. Clean the data using SQL. There are a number of cases that repeat and should be deleted from the analysis.  There are many null values.  The treatment of null value changes with the type of variable.  In some variables, null values indicate zero.  In others they can be estimated from the mode.  In still others, they should be treated as separate variable.  In completing this assignment follow these steps:
  2. Describe the data using univariate analysis. 
  3. Check the distribution of the survival variable.
  4. Check the impact of the interaction of age and gender on survival.
  5. Create a regression model to explain the relationship among the variables and survival.  Manalac's Stata►
  6. Use plots of residuals to test regression assumptions.
  7. Explain the fit of the model to the data.
  8. List the top 4 predictors of survival (list these predictors using English language and not coded data). 
  9. Describe, in English, if the MFH program contributes to survival.  Provide the evidence for your claim.

Use the instructor's last name as the password for the data.    Data► CCS► Kanfer and Lavanya's Answer►

Question 3: The following data provide the length of stay of patients seen by Dr. Smith (Variable Dr Smith=1) and his peer group (variable Dr. Smith = 0).  Does Dr. Smith see a different set of patients than his peer group?  In particular, what is the probability of patients being seen by Dr. Smith.  Regress the choice of provider on the 9 diagnoses provided.  Data►   Kavalloor's Teach One►

Question 4:  In a nursing home, data were collected on residents' survival and disabilities.  The data are listed in the following order: ID, age, gender (M for male, F for Female), number of assessments completed on the person, number of days followed, days since first assessment, days to last assessment, unable to eat, unable to transfer, unable to groom, unable to toilet, unable to bathe, unable to walk, unable to dress, unable to bowel, unable to urine, dead (1) or alive (0), and assessment number.  Predict from the patient's assessments (i.e. their age and current disabilities at time of assessment) if the patient is likely to have an eating disorder within the next 6 months. Here are the steps in this analysis:  Data► Joo Li's Teach One► Joo Li's SQL Code►

  1. Read the data, making sure all entries are numbers.  Calculate age at each assessment not just at first assessment. 
  2. Clean the data, removing impossible situations (remove cases with date of assessment after death). 
  3. Remove irrelevant cases (all cases that have only one assessment)
  4. For each assessment, remove all assessments that are more than 6 months older. 
  5. Organize age at current admission into a binary variable above or below the average age at current assessment.
  6. Calculate a new variable for each assessment that checks if the person would have an eating in the next 6 months.  This requires you to join the data for each person with itself (excluding all assessments prior or including current assessment). 
  7. Group the data based on current disabilities, gender, and age.  Count the number of residents who died within 6 months of assessment for combination of disabilities, gender and age.  To do this, first assess the number of days from first assessment for the death.  Then examine if the assessment time is within 180 days of day of death. 
  8. Use ordinary regression to regress the logit of odds of dying on various current disabilities, age, gender, and pair wise interactions of these variables. 
  9. Identify what is the Markov Blanket of feeding disability in 6 months. 

Question 5: Repeat question 4 but now predict 6 month likelihood of first occurence of walking disorders instead of death.  In this analysis, exclude all assessments that occur after walking disability has occurred. Data►


For additional information (not part of the required reading), please see the following links:

  1. Regression using R Read►
  2. Statistical learning with R Read►
  3. Open introduction to statistics Read►

This page is part of the course on Comparative Effectiveness by Farrokh Alemi PhD Home►  Email►