tag:blogger.com,1999:blog-5220653442850638179.post8179612277631865956..comments2022-03-29T07:43:56.867-07:00Comments on Emma Gertlowitz: Using Logistic Regression in RGrahamhttp://www.blogger.com/profile/13753503494242735958noreply@blogger.comBlogger3125tag:blogger.com,1999:blog-5220653442850638179.post-64409885840248488092013-07-23T04:24:57.030-07:002013-07-23T04:24:57.030-07:00One of the contestants in the kaggle competition m...One of the contestants in the kaggle competition made the suggestion that extracting the titles from the passenger names would be a good way to impute values for those passengers whose age was missing. <br /><br />I used excel to extract the titles - I've posted a screenshot to show the formulas I used ( http://graham-twitterlinks.blogspot.com.au/2013/07/screenshot-of-excel.html ).<br /><br />The idea is that, for example, the title "Master" indicates with some degree of accuracy the passenger's age. Someone with title Master is most likely under 18. Same thing applies to a lesser degree for "Miss". A woman with the title "Mrs" is probably at least 18.<br /><br />So it's simply a case of calculating the mean or median age for each title group - where age is available - and using the value to represent the age for that title group where age is missing.<br /><br />I left the original age variable as is, and created a new variable containing either the age as given or the age calculated as above.<br /><br />So there is no R code I can show you - all the data munging was done in excel, and then I used R to do the logistic regression from that point on.<br /><br />Hope that answers your question.Grahamhttps://www.blogger.com/profile/13753503494242735958noreply@blogger.comtag:blogger.com,1999:blog-5220653442850638179.post-84549392270462428102013-07-19T08:02:25.714-07:002013-07-19T08:02:25.714-07:00Hi Emma,
Thanks for this post ,its really helpful ...Hi Emma,<br />Thanks for this post ,its really helpful and easy to follow.<br />could you also explain the R code for missing age values based on the titles?Anonymoushttps://www.blogger.com/profile/05241128505078643201noreply@blogger.comtag:blogger.com,1999:blog-5220653442850638179.post-67323110090936467722013-06-22T01:06:15.479-07:002013-06-22T01:06:15.479-07:00Great post Graham!Great post Graham!Stephen Oateshttps://www.blogger.com/profile/05483601804514142442noreply@blogger.com