O'Reilly logo

Practical Predictive Analytics by Ralph Winters

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating and verifying the new simulated variables

This section simulates the independent variables Xeducation, Xgender, Xsatisfaction, Xpurch.last.month, and Xmonthly.charges. The code uses the sample() function to generate slightly different data for each of those two data frames based upon a probability vector. Some of the generated data distributions will have only slight differences between the churners and non-churners (for example, education levels), while other variables will be generated specifically to show the differences between members who stayed and who left (tenure2, and purchases last month):

#create new vars====# set the seed for reproduceabilityset.seed(1)#set the gender and Education Vectors.ed.vector <- c("Bachelor's ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required