gabors-data-analysis / da_case_studies

Codes for case studies for the Bekes-Kezdi Data Analysis textbook
MIT License
174 stars 158 forks source link

ch11-smoking-health-risk.R regression code potential error #103

Open osambista opened 1 year ago

osambista commented 1 year ago

In the file "ch11-smoking-health-risk.R", on line 248, is given code for a multiple regression. Running the code on line 254 to add a variable for the predictions yields an error message saying the number of predictions is less than the number of cases in the file "share". Upon checking, the regression actually threw an error: "163 observations deleted due to missingness". When these cases were examined each had an NA in one or another column. Fixed by adding "na.action=na.exclude" to the original regression.