In this you earn be using the churn axioms: churn_data.txt
Read axioms into a axioms create using the portio learn.csv() delay the forthcoming options:
Assume that you saved the perfect churn_data.txt in C:/Datasets folder. Then you can learn perfect into a axioms create as follows:
churnData=read.csv(file, stringsAsFactors = FALSE,header = TRUE)
A) Imstereotype the call of the posts.
Hint: colnames() portio.
B) Imstereotype the reckon of rows and posts
C) Count the reckon calls per aver.
Hint: table() portio.
D) Confront balance, median,trutination failure, and hostility of dark jaw, the post Night.Charge in the axioms.
The R portios to be used are balance(), median(), sd(), var().
E) Confront consummation and stint esteems of interpolitical jaw (Intl.Charge), customer utility calls (CustServ.Calls), and daily jaw(Day.Charge).
F) Use compendium() portio to imimstereotype notification about the dispensation of the forthcoming features:
"Eve.Charge" "Night.Mins" "Night.Calls" "Night.Charge" "Intl.Mins" "Intl.Calls"
What are the min and max esteems imprinted by the compendium() portio for these features?
Check quotationbook page 34 for a specimen.
G) Use unique() portio to imimstereotype the dissimilar esteems of the forthcoming posts:
State, Area.Code, and Churn.
H) Extract the subset of axioms for the churned customers(i.e., Churn=True). How numerous rows are in the subset?
Hint: Use subset() portio. Check exhortation notes and quotationbook for specimens.
I) Extract the subset of axioms for customers that made further than 3 customer utility calls(CustServ.Calls). How numerous rows are in the subset?
J) Extract the subset of churned customers delay no interpolitical contrivance (Int.l,Plan) and no tone mail contrivance (VMail.Plan). How numerous rows are in the subset?
K) Extract the axioms for customers from California (i.e., Aver is CA) who did not churn but made further than 2 customer utility calls.
L) What is the balance of customer utility calls for the customers that did not churn (i.e., Churn=False)?
question2 connected to overhead
In this ,we earn defy the churn axioms using graphics and visualization. One of the earliest reasons for performing exploratory axioms decomposition (EDA) is to defy the waverings, weigh the dispensations of the absolute waverings, face at the histograms of the numeric waverings, and defy the relationships shapeless sets of waverings.
Although we are not going to enunciate any models for this purpose, in a real-world purpose our drudgery is to substantiate patterns in the axioms that earn succor to classify the dispensation of churners.
We earn use the similar axioms set we had in Week 2 assignment:
Data perfect: churn_data.txt
All graphics in this assignment feel to be conspireted using ggplot2 library. So, you nonproduction to induct ggplot2 library for graphs:
Before using any methods from the libraries, you nonproduction to impeach these libraries into the R jurisprudence using
Here is how you can learn axioms into a axioms create calld churnData:
churnData <- learn.csv(filePath, stringsAsFactors = FALSE,header = TRUE)
where perfectPath is the dregs of the churn_data.txt perfect. For specimen, if you saved perfect in C:/tmp, then you should use C:/tmp/churn_data.txt
The waverings in the perfect churn_data.txt are
State: Categorical, for the 50 avers and the District of Columbia.
Account length: Integer-valued, how crave totality has been erratic.
Area jurisprudence: Categorical
Phone reckon: Essentially a surrogate for customer ID.
International contrivance: Dichotomous absolute, yes or no.
Voice mail contrivance: Dichotomous absolute, yes or no.
Number of tone mail messages: Integer-valued.
Total day minutes: Continuous, minutes customer used utility during the day.
Total day calls: Integer-valued.
Total day charge: Continuous, perchance inveterate on overhead two waverings.
Total eve minutes: Continuous, minutes customer used utility during the slumbering.
Total eve calls: Integer-valued.
Total eve charge: Continuous, perchance inveterate on overhead two waverings.
Total misunderstanding minutes: Continuous, minutes customer used utility during the misunderstanding.
Total misunderstanding calls: Integer-valued.
Total misunderstanding charge: Continuous, perchance inveterate on overhead two waverings.
Total interpolitical minutes: Continuous, minutes customer used utility to make
Total interpolitical calls: Integer-valued.
Total interpolitical charge: Continuous, perchance inveterate on overhead two waverings.
Number of calls to customer utility: Integer-valued.
Churn: Target. Indicator of whether the customer has left the order (penny or fib).
Part 1. Bar Charts
A bar chart is a histogram for discrete axioms: it history the reckon of perfect esteem of a absolute wavering.
1.) Vertical Bar Charts
Plot the bar charts of State, Area.Code, Int.l.Plan, VMail.Plan, CustServ.Calls, and Churn.
Use the Nursing essay() portio to shift the quotation greatness, dregs, varnish, etc.. (An specimen is absorbed in the quotationbook on page 61)
The forthcoming is the bar chart for State. As an specimen, the x-axis labels are brave, and rotated 90 degrees which can be set in the Nursing essay() portio using
axis.text.x = element_text(face="bold",angle=90,vjust=0.5, greatness=11).
Similarly, the parameter colour="#990000" is used for the varnish of the x-axis designation. So, the forthcoming options for axis.title.x and axis.text.x in Nursing essay() portio evidence the designation and quotation of x-axis as shown in the condition below:
axis.title.x = element_text(face="bold", colour="#990000", greatness=12), axis.text.x = element_text(face="bold",angle=90,vjust=0.5, greatness=11)
2.) Tame Bar Charts
Create the tame bar chart of CustServ.Calls.
Hint: Textbook page 49.
3.) Tame Bar Charts delay Reserved Categories
Create tame bar chart where the reckon of calls are reserved for CustServ.Calls.
Hint: Textbook pages 50-51
Part 2: Histograms and Shortsightedness Plots
The histogram and the shortsightedness conspire are two visualizations that succor you at-once weigh the dispensation of a numerical wavering.
A basic histogram bins a wavering into fixed-width buckets and receipts the reckon of axioms points that falls into each bucket. You can meditate of a shortsightedness conspire as a “true histogram” of a wavering, bar the area inferior the shortsightedness conspire is resembling to 1.
1.) Conspire the histograms of Account.Length, VMail.Message, Day.Mins, Intl.Calls, and VMail.Message.
Based on the histograms, interpret on whether any of them feel outliers, cease to the Normal Distribution, multi-modal, or skewed.
The histogram for Account.Length is shown below:
2.) Conspire the shortsightedness conspires of Account.Length, VMail.Message, Day.Mins, Intl.Calls, and VMail.Message.
Based on the shortsightedness conspires, interpret on whether any of them feel outliers, cease to the Normal Distribution, multi-modal, or skewed.
As a specimen, the shortsightedness conspire for VMail.Message is shown below:
Part 3. Plant Plots
In restoration to examining waverings in detachment, you’ll frequently nonproduction to face at the relationship betwixt two waverings.
Plot the plant conspires for spans Eve.Mins - Day.Mins, Day.Mins-Day.Charge, Eve.Mins-Eve.Charge, Day.Mins-Day.Calls.
Based on the conspires, are there any relationships betwixt the span of features conspireted?
The plant conspire of Eve.Mins vs Day.Mins is absorbed below:
For the plant conspires in portio A, add varnish to evidence churn and no-churn axioms points. Simply add aes(color=Churn) to the geom_point() portio as shown below:
Part 4. Box Plots
A box-and-whiskers conspire describes the dispensation of a true wavering by conspireting its five-reckon compendium: the stint, inferior quartile (25th percentile), median (50th percentile), upper quartile (75th percentile), and consummation.
Plot the box conspires of CustServ.Calls, Night.Calls, and Intl.Charge by Churn.
Which of the features feel outliers? (can you spot them in the box conspire?)
What is the median of Night.Calls for customers that did not churn? (from the box conspire)
The forthcoming is the box conspire of CustServ.Calls.
Hint:You can confront elaborate notification and specimens of box conspire at
Part 5. Dodged and Stacked Bar Charts
A) Evidence a dodged bar chart of Int.l.Plan by Churn.
Hint: Textbook pages 60-61.
B) Evidence a stacked bar chart of CustServ.Calls and Churn.