Universidad Anáhuac - Cancún
Dr. David Israel Flores Granados
01 de Septiembre 2020
Contenido
The data is related with direct marketing campaigns of a Portuguese banking institution. The marketing campaigns were based on phone calls. Often, more than one contact to the same client was required, in order to access if the product (bank term deposit) would be ('yes') or not ('no') subscribed.
• Bank client data: Age (numeric).
Job : type of job (categorical: 'admin.', 'blue-collar', 'entrepreneur', 'housemaid', 'management', 'retired', 'self-employed', 'services', 'student', 'technician', 'unemployed', 'unknown').
o Marital : marital status (categorical: 'divorced', 'married', 'single', 'unknown' ; note: 'divorced' means divorced or widowed)
o Education (categorical: 'basic.4y', 'basic.6y', 'basic.9y', 'high.school', 'illiterate', 'professional.course', 'university.degree', 'unknown').
o Default: has credit in default? (categorical: 'no', 'yes', 'unknown').
o Housing: has housing loan? (categorical: 'no', 'yes', 'unknown').
o Loan: has personal loan? (categorical: 'no', 'yes', 'unknown')
• Related with the last contact of the current campaign:
o Contact: contact communication type (categorical: 'cellular','telephone')
o Month: last contact month of year (categorical: 'jan', 'feb', 'mar', …, 'nov', 'dec')
o Dayofweek: last contact day of the week (categorical: 'mon','tue','wed','thu','fri')
o Duration: last contact duration, in seconds (numeric). Important note: this attribute highly affects the output target (e.g., if duration=0 then y='no'). Yet, the duration is not known before a call is performed. Also, after the end of the call y is obviously known.
• Other attributes:
o Campaign: number of contacts performed during this campaign and for this client (numeric, includes last contact).
o Pdays: number of days that passed by after the client was last contacted from a previous campaign (numeric; 999 means client was not previously contacted)
o Previous: number of contacts performed before this campaign and for this client (numeric)
o Poutcome: outcome of the previous marketing campaign (categorical:'failure','nonexistent','success')
• Social and economic context atributes o Emp.var.rate: employment variation rate - quarterly indicator(numeric) o Cons.price.idx: consumer price index - monthly indicator (numeric) o Cons.conf.idx: consumer confidence index - monthly indicator(numeric) o Euribor3m: euribor 3 month rate - daily indicator (numeric) o Nr.employed: number of employees - quarterly indicator (numeric)
#importar primero el dataset
bank.additional.fullA <- read.csv("/cloud/project/bank-additional-fullA.csv", stringsAsFactors=TRUE)
# después trabajar con un dataframe con nombre corto
bk = bank.additional.fullA
# ahora convertir las cadenas de porcentaje a número
age = bk$age[!is.na(bk$age)]
max(age) - min(age)
[1] 81
range(age)
[1] 17 98
Para hallar cualquier índice de un cuantil p
\[ i = (\frac{p}{100})n \]
En el caso del índecie de \( Q_1 \) \[ i = (\frac{25}{100})n \]
En el caso del índice de \( Q_3 \) \[ i = (\frac{75}{100})n \]
quantile(age)
0% 25% 50% 75% 100%
17 32 38 47 98
quantile(age,c(0.33,0.66))
33% 66%
34 43
IQR(age)
[1] 15
# Se comprueba con Q3 - Q1
Q1 = as.numeric(quantile(age)[2])
Q3 = as.numeric(quantile(age)[4])
Q3 - Q1
[1] 15
boxplot(age)
age_bx = boxplot(age)

(out_min = Q1 - 1.5*IQR(age))
[1] 9.5
(out_max = Q3 + 1.5*IQR(age))
[1] 69.5

var(age)
[1] 108.6028
sd(age)
[1] 10.42127