Beruflich Dokumente
Kultur Dokumente
UNIVERSIDAD DE CÓRDOBA
FACULTAD DE INGENIERÍA
DEPARTAMENTO DE INGENIERÍA INDUSTRIAL
ESTADISTICA II
MONTERÍA
2018
PREGUNTAS
1.Realizar un análisis básico de los datos de forma numérica y grafica las variables
(Resumen descriptivo y grafico de caja), realizar las conclusiones.
#COVARIANZA
covarianza <- cov(x,y); covarianza
#CORRELACION
correlacion <- cor(x,y); correlacion
#MODELO DE CORRELACION
modelo <- lm (y~x); modelo
# Grafica
plot (x,y, main = "Grafico de correlacion")
abline(modelo, col="blue")
boxplot(x~y, main= "Grafico de caja", col="red")
boxplot(x, col = "turquoise2")
boxplot(y, col="thistle")
#TABLA DE RESULTADOS
xx <- x^2 ; yy <- y^2 ; xy <- x*y
tabla1 <- cbind(x,y, xy, xx, yy)
tabla1
sumas <- apply(tabla1, 2, sum); sumas
# Intervalos de confianza
confint ( modelo , level = 0.95)
summary ( modelo )
modelo
#coeficiente de determinacion
summary ( modelo )
par(mfrow =c(2,2))
plot(modelo)
#PREDICCIONES
y1<- 0.2040 - -10.0435*(3);y1
y2<- 0.2040 - -10.435*(5);y2
x1<- 7.7 - 0.2040 / -10.0435;x1
CONSOLA
> library(boot)
> salinity
sal lag trend dis
1 7.6 8.2 4 23.01
2 7.7 7.6 5 22.87
3 4.3 4.6 0 26.42
4 5.9 4.3 1 24.87
5 5.0 5.9 2 29.90
6 6.5 5.0 3 24.20
7 8.3 6.5 4 23.22
8 8.2 8.3 5 22.86
9 13.2 10.1 0 22.27
10 12.6 13.2 1 23.83
11 10.4 12.6 2 25.14
12 10.8 10.4 3 22.43
13 13.1 10.8 4 21.79
14 12.3 13.1 5 22.38
15 10.4 13.3 0 23.93
16 10.5 10.4 1 33.44
17 7.7 10.5 2 24.86
18 9.5 7.7 3 22.69
19 12.0 10.0 0 21.79
20 12.6 12.0 1 22.04
21 13.6 12.1 4 21.03
22 14.1 13.6 5 21.01
23 13.5 15.0 0 25.87
24 11.5 13.5 1 26.29
25 12.0 11.5 2 22.93
26 13.0 12.0 3 21.31
27 14.1 13.0 4 20.77
28 15.1 14.1 5 21.39
> x<- salinity$trend
> y<- salinity$sal
>
>
> n<- length(y)
>
> #COVARIANZA
> covarianza <- cov(x,y); covarianza
[1] 0.6574074
>
> #CORRELACION
> correlacion <- cor(x,y); correlacion
[1] 0.1216652
>
> #MODELO DE CORRELACION
> modelo <- lm (y~x); modelo
Call:
lm(formula = y ~ x)
Coefficients:
(Intercept) x
10.044 0.204
>
> # Grafica
> plot (x,y, main = "Grafico de correlacion")
> abline(modelo, col="blue")
> boxplot(x~y, main= "Grafico de caja", col="red")
> boxplot(x, col = "turquoise2")
> boxplot(y, col="thistle")
>
> #TABLA DE RESULTADOS
> xx <- x^2 ; yy <- y^2 ; xy <- x*y
> tabla1 <- cbind(x,y, xy, xx, yy)
> tabla1
x y xy xx yy
[1,] 4 7.6 30.4 16 57.76
[2,] 5 7.7 38.5 25 59.29
[3,] 0 4.3 0.0 0 18.49
[4,] 1 5.9 5.9 1 34.81
[5,] 2 5.0 10.0 4 25.00
[6,] 3 6.5 19.5 9 42.25
[7,] 4 8.3 33.2 16 68.89
[8,] 5 8.2 41.0 25 67.24
[9,] 0 13.2 0.0 0 174.24
[10,] 1 12.6 12.6 1 158.76
[11,] 2 10.4 20.8 4 108.16
[12,] 3 10.8 32.4 9 116.64
[13,] 4 13.1 52.4 16 171.61
[14,] 5 12.3 61.5 25 151.29
[15,] 0 10.4 0.0 0 108.16
[16,] 1 10.5 10.5 1 110.25
[17,] 2 7.7 15.4 4 59.29
[18,] 3 9.5 28.5 9 90.25
[19,] 0 12.0 0.0 0 144.00
[20,] 1 12.6 12.6 1 158.76
[21,] 4 13.6 54.4 16 184.96
[22,] 5 14.1 70.5 25 198.81
[23,] 0 13.5 0.0 0 182.25
[24,] 1 11.5 11.5 1 132.25
[25,] 2 12.0 24.0 4 144.00
[26,] 3 13.0 39.0 9 169.00
[27,] 4 14.1 56.4 16 198.81
[28,] 5 15.1 75.5 25 228.01
> sumas <- apply(tabla1, 2, sum); sumas
x y xy xx yy
70.00 295.50 756.50 262.00 3363.23
>
> # Intervalos de confianza
> confint ( modelo , level = 0.95)
2.5 % 97.5 %
(Intercept) 7.9910148 12.0960131
x -0.4669598 0.8750057
>
> summary ( modelo )
Call:
lm(formula = y ~ x)
Residuals:
Min 1Q Median 3Q Max
-5.7435 -2.7796 0.7964 2.3525 4.0364
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 10.0435 0.9985 10.058 1.88e-10 ***
x 0.2040 0.3264 0.625 0.537
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
> modelo
Call:
lm(formula = y ~ x)
Coefficients:
(Intercept) x
10.044 0.204
>
> # Analisis de Varianza por minimos cuadrados del modelo
> anova ( modelo)
Analysis of Variance Table
Response: y
Df Sum Sq Mean Sq F value Pr(>F)
x 1 3.621 3.6214 0.3906 0.5374
Residuals 26 241.028 9.2703
> modelo
Call:
lm(formula = y ~ x)
Coefficients:
(Intercept) x
10.044 0.204
>
> #coeficiente de determinacion
> summary ( modelo )
Call:
lm(formula = y ~ x)
Residuals:
Min 1Q Median 3Q Max
-5.7435 -2.7796 0.7964 2.3525 4.0364
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 10.0435 0.9985 10.058 1.88e-10 ***
x 0.2040 0.3264 0.625 0.537
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
>
> par(mfrow =c(2,2))
> plot(modelo)
>
> #PREDICCIONES
> y1<- 10.0435 - -0.2040*(3);y1
[1] 10.6555
> y2<- 10.0435 - -0.2040*(5);y2
[1] 11.0635
> x1<- 7.7 - 10.0435 /-0.2040 ;x1
[1] 56.93284
1.
2.
B1
El intervalo de confianza del 95 % para el incremento esperado de la variable (Y) por la
variable (X) abarca de -0.4669598 a 0.8750057
B0
El intervalo de confianza del 95 % para el incremento esperado de la variable (Y) por la
variable (X) abarca de 7.9910148 a 12.0960131
PRUEBA DE HIPOTESIS
Como |t = −| = > t 0.0148=2.00 No hay evidencia suficiente para aceptar la hipótesis
nula, Es decir, a un nivel del 5 %, podemos afirmar que existe una relación lineal en la
salinidad
3.