You are on page 1of 8

EXAMEN DE INVESTIGACIÓN

SOLUCIÓN 1:
datos=read.table("sociodemographic1.csv", header=TRUE, sep=";")
#Genero vs Estatus
Genestat=table(datos$Genero,datos$Estatus)
barplot(Genestat,beside = TRUE,legend=row.names(Genestat), col =
c("yellow","red"))

#Estado vs Grado
EstGrad=table(datos$Estado,datos$Grado)
barplot(EstGrad,beside = TRUE,legend=row.names(Genestat), col =
c("yellow","red"))
text(x=1.5, y=17, "30", cex = 1)
text(x=2.5, y=7, "12", cex = 1)
text(x=4.5, y=3, "5", cex = 1)
text(x=5.5, y=5, "10", cex = 1)
text(x=7.5, y=13, "25", cex = 1)
text(x=8.5, y=8, "14", cex = 1)
#Grado vs Color
GraCol=table(datos$Grado,datos$Color)
barplot(GraCol,beside = TRUE,legend=row.names(Genestat), col =
c("yellow","red"))

#Color vs Genero
ColGen=table(datos$Color,datos$Genero)
barplot(ColGen,beside = TRUE,legend=row.names(Genestat), col =
c("yellow","red"))
SOLUCIÓN 2:
NORMANO<- 0.70
NORMAPM<- 1.50
NO<-c(0.77,0.88,0.44,0.74,0.94,0.76,0.61,0.94,0.76,0.53,0.48)
PM<-c(1.75,1.53,1.28,1.34,1.66,1.73,1.25,1.47,1.31,1.14,1.02)
t.test(NO, mu=NORMANO, conf.level = 0.90)
t.test(PM, mu=NORMAPM, conf.level = 0.90)
RESULTADOS:
> NORMANO<- 0.70
> NORMAPM<- 1.50
> NO<-c(0.77,0.88,0.44,0.74,0.94,0.76,0.61,0.94,0.76,0.53,0.48)
> PM<-c(1.75,1.53,1.28,1.34,1.66,1.73,1.25,1.47,1.31,1.14,1.02)
> t.test(NO, mu=NORMANO, conf.level = 0.90)

One Sample t-test

data: NO
t = 0.25594, df = 10, p-value = 0.8032
alternative hypothesis: true mean is not equal to 0.7
90 percent confidence interval:
0.6170698 0.8102029
sample estimates:
mean of x
0.7136364
*EL P-VALUE ES MAYOR A 0.1…0.80>0.1, OSEA NO EXISTE DIFERENCIA SIGNIFI
CATIVA AL 90% ENTRE LA NORMA Y LA MEDIA DE LOS RESULTADOS.

> t.test(PM, mu=NORMAPM, conf.level = 0.90)

One Sample t-test

data: PM
t = -1.2761, df = 10, p-value = 0.2308
alternative hypothesis: true mean is not equal to 1.5
90 percent confidence interval:
1.275571 1.538975
sample estimates:
mean of x
1.407273
**EL P-VALUE ES MAYOR A 0.1…0.23>0.1, OSEA NO EXISTE DIFERENCIA SIGNIF
ICATIVA AL 90% ENTRE LA NORMA Y LA MEDIA DE LOS RESULTADOS.

SOLUCIÓN 3:
NORMANO<- 0.70
NORMAPM<- 1.50
NO<-c(0.77,0.88,0.44,0.74,0.94,0.76,0.61,0.94,0.76,0.53,0.48)
PM<-c(1.75,1.53,1.28,1.34,1.66,1.73,1.25,1.47,1.31,1.14,1.02)
NO2<-c(0.52,0.78,0.49,0.63,0.93,0.85,0.59,0.66,0.78,0.57,0.87)
PM2<-c(1.83,1.74,1.45,1.16,1.47,1.76,1.51,1.37,1.07,0.88,1.62)
t.test(NO2, mu=NORMANO, conf.level = 0.99)
t.test(PM2, mu=NORMAPM, conf.level = 0.99)
#T-PAIRED
t.test(NO,NO2,paired = TRUE, conf.level = 0.99)
t.test(PM,PM2,paired = TRUE, conf.level = 0.99)
RESULTADOS:
> NORMANO<- 0.70
> NORMAPM<- 1.50
> NO<-c(0.77,0.88,0.44,0.74,0.94,0.76,0.61,0.94,0.76,0.53,0.48)
> PM<-c(1.75,1.53,1.28,1.34,1.66,1.73,1.25,1.47,1.31,1.14,1.02)
> NO2<-c(0.52,0.78,0.49,0.63,0.93,0.85,0.59,0.66,0.78,0.57,0.87)
> PM2<-c(1.83,1.74,1.45,1.16,1.47,1.76,1.51,1.37,1.07,0.88,1.62)
> t.test(NO2, mu=NORMANO, conf.level = 0.99)

One Sample t-test

data: NO2
t = -0.059771, df = 10, p-value = 0.9535
alternative hypothesis: true mean is not equal to 0.7
99 percent confidence interval:
0.5526628 0.8418827
sample estimates:
mean of x
0.6972727
**EL P-VALUE ES MAYOR A 0.01…0.95>0.01, OSEA NO EXISTE DIFERENCIA SIGN
IFICATIVA AL 99% ENTRE LA NORMA Y LA MEDIA DE LOS RESULTADOS.

> t.test(PM2, mu=NORMAPM, conf.level = 0.99)


One Sample t-test
data: PM2
t = -0.63739, df = 10, p-value = 0.5382
alternative hypothesis: true mean is not equal to 1.5
99 percent confidence interval:
1.152521 1.731116
sample estimates:
mean of x
1.441818
**EL P-VALUE ES MAYOR A 0.01…0.538>0.01, OSEA NO EXISTE DIFERENCIA SIG
NIFICATIVA AL 99% ENTRE LA NORMA Y LA MEDIA DE LOS RESULTADOS.

> #T-PAIRED
> t.test(NO,NO2,paired = TRUE, conf.level = 0.99)

Paired t-test

data: NO and NO2


t = 0.30093, df = 10, p-value = 0.7696
alternative hypothesis: true difference in means is not equal to 0
99 percent confidence interval:
-0.1559719 0.1886992
sample estimates:
mean of the differences
0.01636364
**EL P-VALUE ES MAYOR A 0.01…0.769>0.01, OSEA NO EXISTE DIFERENCIA SIG
NIFICATIVA AL 99% ENTRE LA MEDIA DE LOS RESULTADOS DE LA UNI Y UPEU.

> t.test(PM,PM2,paired = TRUE, conf.level = 0.99)

Paired t-test

data: PM and PM2


t = -0.43352, df = 10, p-value = 0.6738
alternative hypothesis: true difference in means is not equal to 0
99 percent confidence interval:
-0.2870900 0.2179991
sample estimates:
mean of the differences
-0.03454545
*EL P-VALUE ES MAYOR A 0.01…0.67>0.01, OSEA NO EXISTE DIFERENCIA SIGNI
FICATIVA AL 90% ENTRE LA MEDIA DE LOS RESULTADOS DE LA UNI Y UPEU.

SOLUCIÓN 4:
# ANOVA

anova<-read.table("anova.csv",header = TRUE,sep=",")

aov(CONCENTRACIÓN~RÍOS, data=anova)

resanova<-aov(CONCENTRACIÓN~RÍOS, data=anova)

summary(resanova)

Resultados
> anova<-read.table("anova.csv",header = TRUE,sep=",")
> View(anova)
> aov(CONCENTRACIÓN~RÍOS, data=anova)
Call:
aov(formula = CONCENTRACIÓN ~ RÍOS, data = anova)
Terms:
RÍOS Residuals
Sum of Squares 3.75475 14.60300
Deg. of Freedom 3 36

Residual standard error: 0.6368979


Estimated effects may be unbalanced
> resanova<-aov(CONCENTRACIÓN~RÍOS, data=anova)
> summary(resanova)
Df Sum Sq Mean Sq F value Pr(>F)
RÍOS 3 3.755 1.2516 3.085 0.0393 *
Residuals 36 14.603 0.4056
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

#TUKEY
> TukeyHSD(resanova)
Tukey multiple comparisons of means
95% family-wise confidence level

Fit: aov(formula = CONCENTRACIÓN ~ RÍOS, data = anova)

$RÍOS
diff lwr upr p adj
Huallaga-Amazonas 0.86 0.09288977 1.6271102 0.0229487
MANTARO-Amazonas 0.36 -0.40711023 1.1271102 0.5912618
Rimac-Amazonas 0.35 -0.41711023 1.1171102 0.6130126
MANTARO-Huallaga -0.50 -1.26711023 0.2671102 0.3110605
Rimac-Huallaga -0.51 -1.27711023 0.2571102 0.2943724
Rimac-MANTARO -0.01 -0.77711023 0.7571102 0.9999841

#CUADRO DE CAJAS
> boxplot(CONCENTRACIÓN~RÍOS, data=anova,col=c("pink","red","yellow"))

CUADRO 2

#ANOVA

anova<-read.table("anova2.csv",header = TRUE,sep=",")

aov(Concentración~Ríos, data=anova)
resanova<-aov(Concentración~Ríos, data=anova)

summary(resanova)

Resultados
> anova<-read.table("anova2.csv",header = TRUE,sep=",")
> aov(Concentración~Ríos, data=anova)
Call:
aov(formula = Concentración ~ Ríos, data = anova)

Terms:
Ríos Residuals
Sum of Squares 1.165807 0.805780
Deg. of Freedom 2 27

Residual standard error: 0.1727533


Estimated effects may be unbalanced
> resanova<-aov(Concentración~Ríos, data=anova)
> summary(resanova)
Df Sum Sq Mean Sq F value Pr(>F)
Ríos 2 1.1658 0.5829 19.53 5.67e-06 ***
Residuals 27 0.8058 0.0298
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

#TUKEY

TukeyHSD(resanova)

Resultados
> TukeyHSD(resanova)
Tukey multiple comparisons of means
95% family-wise confidence level

Fit: aov(formula = Concentración ~ Ríos, data = anova)

$Ríos
diff lwr upr p adj
Piura-Ene -0.425 -0.6165539 -0.2334461 0.0000231
Tumbes-Ene -0.014 -0.2055539 0.1775539 0.9820717
Tumbes-Piura 0.411 0.2194461 0.6025539 0.0000375

#BOXPLOT
> boxplot(Concentración~Ríos, data=anova,col=c("pink","red","yellow"))

You might also like