## HAP 719: Advanced Statistics I## Logistic Regression
## Assigned Reading- Session overview YouTube►
- Read Chapter 12 in Statistical Analysis of Electronic Health Records by Farrokh Alemi, 2020
- Calculate McFadden R-squared ChatGPT►
- What to do when McFadden R-squared is negative? ChatGPT►
- Dummy coding for categorical data ChatGPT►
- Replacing logistic regression with ordinary regression Slides► YouTube► Video►
- Convert STATA code to R ChatGPT►
- Detecting interaction terms using stratification and contour plots Slides►
- Use of corner cases to specify logistic regression's coefficients Slides►
- More on missing values Read► Slides►
## Assignment on Introduction to Logistic RegressionAssignments should be submitted in Blackboard. Include a summary page. In the summary page, write statements comparing your work to answers given or videos. For example, "I got the same answers as the Teach One video for question 1." Or you can write: "There was no answer sheet available for question 2." We prefer that assignments are done in R.
In the following, calculate predicted value of a logistic regression using the following formula: - Regress the classification labels in the training set on the words, pair of consecutive words, and triplets of consecutive words in the target sentence: "He loves his patients and I can tell it's about us and not the money." Use the predicted probability of complaint to classify the target sentence. Values above 0.5 should be classified as complaints.
- Regress the classification labels in the training set on the words, pair of words, triplet of consecutive words in the target sentence "However, I am not happy with rhinoplasty revision results." Use the predicted probability of complaint to classify the target sentence. Values above 0.5 should be classified as complaints.
- Repeat the analysis but this time include all of the complaints and 50% random sample of praises in the training data set. How did the sampling procedure affect the McFadden R-square
Resources: - Labeled training data set for: "He loves his patients and I can tell it's about us and not the money." Download►
- Labeled training data set for: "However, I am not happy with rhinoplasty revision results." Download►
- How to predict response variable in logistic regression ChatGPT►
- How to drop variables that are perfectly correlated? R Code►
- Full Corpus (needed for analysis of other target comments) Download► Preprocessing ChatGPT►
- Vladimir Cardenas's Answer► R Code►
- Regina Reyes's Teach One on "However, I am happy with rhinoplasty revision results." Slides► YouTube►
- Sravya's Teach One on "He loves his patients and I can tell it's about us and not the money." Slides► YouTube►
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. The functional disabilities are probabilities that the patient has the disability. These probabilities are generated from the CCS diagnoses and demographics of the person. Use long term disabilities. These are the disabilities with suffix 365. If the disability is higher than 0.5, then assume the person is disabled. - Clean the data. Convert the disabilities to binary variables. Convert the age to decades
- Create a regression model to explain the relationship among the variables and survival.
- List the top 4 predictors of survival (list these predictors using English language and not coded data).
- Describe, in English, if the MFH program contributes to survival. Provide the evidence for your claim.
Resources: - Data Download►(Use instructor's last name as password)
- Teach One Python►
- Vladimir Cardenas's Answer► R Code► (Password protected)
- Latha Sai Mounika Kona's Teach One YouTube►
- Build a model that includes only "home test results" as independent variable. Report the percent of variation explained
- Build a model that includes age and gender, interaction of age and gender, and home test results as independent variables. Report the percent of variation explained.
- Build a model that includes age and gender, interaction of age and gender, home test results, and symptoms as independent variables. Report the percent of variation explained
- Build a model that includes includes age, gender, interaction of age and gender, symptoms, home test, and pairs of symptoms, as independent variables. Report the percent of variation explained
- What is the most accurate way of diagnosing COVID-19 at home prior to triage to clinics?
- Can a clinician learn to make these diagnoses or is the number of adjustments needed beyond human capabilities?
The following resources may be helpful: - Data Download► Dictionary►
- Include interaction terms in regression ►
- Calculate McFadden R-squared ChatGPT►
- Number of times 2 symptoms occur together for the same person Data►
- Sowmya Chakravarthy's Answer► R-code►
- Yatisha Rajanala's Teach One YouTube►
## Second Week: Assignments on Missing Values and Logistic Regression
Resources: - Data Download►
- Kavalloor's Teach One Python YouTube► Slides►
- Sowmya Chakravarthy's Answer► R Code► (Password protected)
- Cherukuri's Teach One YouTube►
- Read the data, making sure all entries are numbers.
- Calculate age at each assessment not just at first assessment.
- Clean the data, removing impossible situations (remove cases with date of assessment after death).
- Remove irrelevant cases (all cases that have only one assessment)
- Organize age at current admission into a binary variable above or below the average age at current assessment.
- Estimate missing values
- Regress death in 6-months on various current disabilities, age, gender, and pairwise interactions of these variables.
Resources: - Data Download►
- Teach One Python YouTube► Slides►
- Joo Li's SQL Code►
- Yili Lin's Answer► R-code►
- Yalin Li's Teach One YouTube►
## Third Week: Assignments on Model Building and Logistic Regression
Resources for Question 1: - Data Download►
- Sherline's Teach One YouTube►
- For an alternative method see case-based reasoning Read► Python Code► (Use Instructor's last name as password)
- Gidewon Tesfai's Answer► R-code►
- Create a binary variable that is 1 every time a variable is missing and 0 otherwise. Predict
diabetes from patterns of missing binary variables.
- Create binary variables for missing values.
- Calculate number of variables that are missing for each case
- Create a cascaded data, where cases are arranged in order of number of variables missing. Put all missing variables last.
- Create interaction terms for missing indicators so that the interaction term corresponds with patterns of missing variables in the cascaded data.
- Test the statistical significant of missing indicators and interaction among missing indicators.
- Report the percent of variation in incidence of diabetes explained by patterns of missing variables
- Regress diabetes on body systems, pairs of body systems, triplets of body systems, and statistically significant patterns of missing values. Report the coefficients and the percent of variation explained. One way to reduce the number of independent variables is to drop body systems that are always missing. When a variable is always missing, then regression software automatically drop these variables. You can save computation time by dropping the variables before analyzing the data. The plot below shows body systems and extent of missing values within them.
Resources for Question 2: - Data Download► Dictionary►
- Yili Lin's Answer► R-code►
This page is part of the HAP 819 course on Advanced Statistics by Farrokh Alemi PhD Home► Email► |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||