You are on page 1of 5

library('tidyverse')

library('scales')
library('ggpubr')
ds.examen <- read.csv( file = 'C:/Users/RYZEN
3/Desktop/ESTOCASTICOS/DATA/exams.csv')
str(ds.examen)
#historigrama
num.obs.completas <- complete.cases(ds.examen)
num.obs.completas <-data.frame( obs.completas = num.obs.completas)
ggplot( data = num.obs.completas, aes( x= obs.completas , fill= obs.completas,
color = obs.completas))+
geom_bar(alpha=0.4)+ ggtitle( ' GRAFICA DE NOTAS')+ ylab('Numero De
Observaciones')+ xlab('OBSERVACION CON DATOS FALTANTES')
ds.comp.examen <-ds.examen[complete.cases(ds.examen),]

str(ds.comp.examen)
ds.comp.examen <-ds.comp.examen %>% #pipeline
rename( Sexo = gender,
Raza = race.ethnicity,
Nivel.Educativo = parental.level.of.education,
Comida = lunch,
Examenes = test.preparation.course,
Matematicas = math.score,
Lectura = reading.score,
Escritura = writing.score,)

ds.comp.examen$Sexo <- factor(ds.comp.examen$Sexo)


ds.comp.examen$Raza <- factor(ds.comp.examen$Raza)
ds.comp.examen$Nivel.Educativo <- factor(ds.comp.examen$Nivel.Educativo, levels =
c('some high school','high school','some college', 'bachelor\'s
degree','associate\'s degree', 'master\'s degree')
, ordered = TRUE)
ds.comp.examen$Comida <- factor(ds.comp.examen$Comida)
ds.comp.examen$Examenes <- factor(ds.comp.examen$Examenes)
levels(ds.comp.examen$Nivel.Educativo)
str(ds.comp.examen)
tbl.obs.diagnostico <- table(ds.comp.examen)
tbl.obs.diagnostico

ggplot(data=ds.comp.examen, aes(x=Sexo ,Y=Matematicas, fill=Sexo )) +


geom_boxplot( alpha = 0.9 , outlier.alpha = 0.2)+
ggtitle('SEXO vs NOTAS MATEMATICAS')
stat_summary( fun ='mean')

ggplot(data=ds.comp.examen, aes(x = Matematicas , fill= Sexo )) +


geom_histogram( binwidth = 9, alpha=0.4)+
ggtitle('SEXO vs NOTAS MATEMATICAS')+
ylab( ' TOTAL DE OBSERVACIONES')

tbl.obs.matematicas <- table(ds.comp.examen$Matematicas,ds.comp.examen$Sexo)


tbl.obs.matematicas

ds.race.groupS <- ds.comp.examen [ds.comp.examen$Raza=="group A",]


#ds.race.groupS <- ds.comp.examen [ds.comp.examen$Raza=="group B",]
#ds.race.groupS <- ds.comp.examen [ds.comp.examen$Raza=="group C",]
#ds.race.groupS <- ds.comp.examen [ds.comp.examen$Raza=="group D",]
#ds.race.groupS <- ds.comp.examen [ds.comp.examen$Raza=="group E",]
max(ds.race.groupS$Matematicas)
min(ds.race.groupS$Matematicas)
mean(ds.race.groupS$Matematicas)
median(ds.race.groupS$Matematicas)
IQR(ds.race.groupS$Matematicas)
sd(ds.race.groupS$Matematicas)
max(ds.race.groupS$Matematicas)- min(ds.race.groupS$Matematicas)

#ds.race.groupS <- ds.comp.examen [ds.comp.examen$Raza=="group A",]


#ds.race.groupS <- ds.comp.examen [ds.comp.examen$Raza=="group B",]
#ds.race.groupS <- ds.comp.examen [ds.comp.examen$Raza=="group C",]
#ds.race.groupS <- ds.comp.examen [ds.comp.examen$Raza=="group D",]
#ds.race.groupS <- ds.comp.examen [ds.comp.examen$Raza=="group E",]
max(ds.race.groupS$Lectura)
min(ds.race.groupS$Lectura)
mean(ds.race.groupS$Lectura)
median(ds.race.groupS$Lectura)
IQR(ds.race.groupS$Lectura)
sd(ds.race.groupS$Lectura)
max(ds.race.groupS$Lectura)- min(ds.race.groupS$Lectura)

#ds.race.groupS <- ds.comp.examen [ds.comp.examen$Raza=="group A",]


#ds.race.groupS <- ds.comp.examen [ds.comp.examen$Raza=="group B",]
#ds.race.groupS <- ds.comp.examen [ds.comp.examen$Raza=="group C",]
#ds.race.groupS <- ds.comp.examen [ds.comp.examen$Raza=="group D",]
#ds.race.groupS <- ds.comp.examen [ds.comp.examen$Raza=="group E",]
max(ds.race.groupS$Escritura)
min(ds.race.groupS$Escritura)
mean(ds.race.groupS$Escritura)
median(ds.race.groupS$Escritura)
IQR(ds.race.groupS$Escritura)
sd(ds.race.groupS$Escritura)
max(ds.race.groupS$Escritura)- min(ds.race.groupS$Escritura)

ggplot(data=ds.comp.examen, aes(x = Matematicas ,Y= Raza , fill= Raza )) +


geom_histogram(alpha = 11, outlier.alpha = 1)+
ggtitle('RAZA vs NOTAS MATEMATICAS')+
ylab('TOTAL DE OBSERVACIONES')
tbl.obs.matematicas <- table(ds.comp.examen$Matematicas,ds.comp.examen$Raza)
tbl.obs.matematicas

ggplot(data= ds.comp.examen, aes(x = Matematicas ,Y= Raza, fill= Raza)) +


geom_boxplot( alpha = 0.9 , outlier.alpha = 1)+
ggtitle('RAZA vs NOTAS MATEMATICAS')

ggplot(data=ds.comp.examen, aes(x = Matematicas ,Y= Nivel.Educativo , fill=


Nivel.Educativo )) +
geom_histogram(alpha = 11, outlier.alpha = 1)+
ggtitle('NIVEL EDUCATIVO vs NOTAS MATEMATICAS')+
ylab('TOTAL DE OBSERVACIONES')

ggplot(data= ds.comp.examen, aes(x = Matematicas ,Y= Nivel.Educativo, fill=


Nivel.Educativo)) +
geom_boxplot( alpha = 0.9 , outlier.alpha = 1)+
ggtitle('nivel educativo vs NOTAS MATEMATICAS')
tbl.obs.matematicas <-
table(ds.comp.examen$Matematicas,ds.comp.examen$Nivel.Educativo)
tbl.obs.matematicas

ggplot(data=ds.comp.examen, aes(x = Matematicas ,Y= Comida , fill= Comida )) +


geom_histogram(alpha = 11, outlier.alpha = 1)+
ggtitle('COMIDA vs NOTAS MATEMATICAS')+
ylab('TOTAL DE OBSERVACIONES')

ggplot(data= ds.comp.examen, aes(x = Matematicas ,Y= Comida, fill= Comida)) +


geom_boxplot( alpha = 0.9 , outlier.alpha = 1)+
ggtitle('COMIDA vs NOTAS MATEMATICAS')
tbl.obs.matematicas <- table(ds.comp.examen$Matematicas,ds.comp.examen$Comida)
tbl.obs.matematicas

ggplot(data=ds.comp.examen, aes(x = Matematicas ,Y=Examenes , fill= Examenes)) +


geom_histogram(alpha = 11, outlier.alpha = 1)+
ggtitle('Examenes vs NOTAS MATEMATICAS')+
ylab('TOTAL DE OBSERVACIONES')

ggplot(data= ds.comp.examen, aes(x = Matematicas ,Y= Examenes, fill= Examenes)) +


geom_boxplot( alpha = 0.9 , outlier.alpha = 1)+
ggtitle('Examenes vs NOTAS MATEMATICAS')
tbl.obs.matematicas <- table(ds.comp.examen$Matematicas,ds.comp.examen$Examenes)
tbl.obs.matematicas

ggplot(data=ds.comp.examen, aes(x = Lectura ,Y= Raza , fill= Raza )) +


geom_histogram(alpha = 11, outlier.alpha = 1)+
ggtitle('RAZA vs NOTAS Lectura')+
ylab('TOTAL DE OBSERVACIONES')
tbl.obs.matematicas <- table(ds.comp.examen$Lectura,ds.comp.examen$Raza)
tbl.obs.matematicas

ggplot(data= ds.comp.examen, aes(x = Lectura ,Y= Raza, fill= Raza)) +


geom_boxplot( alpha = 0.9 , outlier.alpha = 1)+
ggtitle('RAZA vs NOTAS Lectura')

ggplot(data=ds.comp.examen, aes(x = Lectura ,Y= Nivel.Educativo , fill=


Nivel.Educativo )) +
geom_histogram(alpha = 11, outlier.alpha = 1)+
ggtitle('NIVEL EDUCATIVO vs NOTAS Lectura')+
ylab('TOTAL DE OBSERVACIONES')

ggplot(data= ds.comp.examen, aes(x = Lectura ,Y= Nivel.Educativo, fill=


Nivel.Educativo)) +
geom_boxplot( alpha = 0.9 , outlier.alpha = 1)+
ggtitle('nivel educativo vs NOTAS Lectura')
tbl.obs.matematicas <- table(ds.comp.examen$Lectura,ds.comp.examen$Nivel.Educativo)
tbl.obs.matematicas

ggplot(data=ds.comp.examen, aes(x = Lectura ,Y= Comida , fill= Comida )) +


geom_histogram(alpha = 11, outlier.alpha = 1)+
ggtitle('COMIDA vs NOTAS Lectura')+
ylab('TOTAL DE OBSERVACIONES')

ggplot(data= ds.comp.examen, aes(x = Lectura ,Y= Comida, fill= Comida)) +


geom_boxplot( alpha = 0.9 , outlier.alpha = 1)+
ggtitle('COMIDA vs NOTAS Lectura')
tbl.obs.matematicas <- table(ds.comp.examen$Lectura,ds.comp.examen$Comida)
tbl.obs.matematicas

ggplot(data=ds.comp.examen, aes(x = Lectura ,Y=Examenes , fill= Examenes)) +


geom_histogram(alpha = 11, outlier.alpha = 1)+
ggtitle('Examenes vs NOTAS Lectura')+
ylab('TOTAL DE OBSERVACIONES')

ggplot(data= ds.comp.examen, aes(x = Lectura ,Y= Examenes, fill= Examenes)) +


geom_boxplot( alpha = 0.9 , outlier.alpha = 1)+
ggtitle('Examenes vs NOTAS Lectura')
tbl.obs.matematicas <- table(ds.comp.examen$Lectura,ds.comp.examen$Examenes)
tbl.obs.matematicas

ggplot(data=ds.comp.examen, aes(x = Escritura ,Y= Raza , fill= Raza )) +


geom_histogram(alpha = 11, outlier.alpha = 1)+
ggtitle('RAZA vs NOTAS Escritura')+
ylab('TOTAL DE OBSERVACIONES')
tbl.obs.matematicas <- table(ds.comp.examen$Escritura,ds.comp.examen$Raza)
tbl.obs.matematicas

ggplot(data= ds.comp.examen, aes(x = Escritura ,Y= Raza, fill= Raza)) +


geom_boxplot( alpha = 0.9 , outlier.alpha = 1)+
ggtitle('RAZA vs NOTAS Escritura')

ggplot(data=ds.comp.examen, aes(x = Escritura ,Y= Nivel.Educativo , fill=


Nivel.Educativo )) +
geom_histogram(alpha = 11, outlier.alpha = 1)+
ggtitle('NIVEL EDUCATIVO vs NOTAS Escritura')+
ylab('TOTAL DE OBSERVACIONES')

ggplot(data= ds.comp.examen, aes(x = Escritura ,Y= Nivel.Educativo, fill=


Nivel.Educativo)) +
geom_boxplot( alpha = 0.9 , outlier.alpha = 1)+
ggtitle('nivel educativo vs NOTAS Escritura')
tbl.obs.matematicas <-
table(ds.comp.examen$Escritura,ds.comp.examen$Nivel.Educativo)
tbl.obs.matematicas

ggplot(data=ds.comp.examen, aes(x = Escritura ,Y= Comida , fill= Comida )) +


geom_histogram(alpha = 11, outlier.alpha = 1)+
ggtitle('COMIDA vs NOTAS Escritura')+
ylab('TOTAL DE OBSERVACIONES')

ggplot(data= ds.comp.examen, aes(x = Escritura ,Y= Comida, fill= Comida)) +


geom_boxplot( alpha = 0.9 , outlier.alpha = 1)+
ggtitle('COMIDA vs NOTAS Escritura')
tbl.obs.matematicas <- table(ds.comp.examen$Escritura,ds.comp.examen$Comida)
tbl.obs.matematicas

ggplot(data=ds.comp.examen, aes(x =Escritura ,Y=Examenes , fill= Examenes)) +


geom_histogram(alpha = 11, outlier.alpha = 1)+
ggtitle('Examenes vs NOTAS Escritura')+
ylab('TOTAL DE OBSERVACIONES')

ggplot(data= ds.comp.examen, aes(x = Escritura ,Y= Examenes, fill= Examenes)) +


geom_boxplot( alpha = 0.9 , outlier.alpha = 1)+
ggtitle('Examenes vs NOTAS Escritura')
tbl.obs.matematicas <- table(ds.comp.examen$Escritura,ds.comp.examen$Examenes)
tbl.obs.matematicas

You might also like