load("moluscos.RData")
BD_moluscos
## # A tibble: 48 × 3
## c_agua molusco cons_o
## <dbl> <chr> <dbl>
## 1 100 A 7.16
## 2 100 A 8.26
## 3 100 A 6.78
## 4 100 A 14
## 5 100 A 13.6
## 6 100 A 11.1
## 7 100 A 8.93
## 8 100 A 9.66
## 9 100 B 6.14
## 10 100 B 6.14
## # … with 38 more rows
## # ℹ Use `print(n = ...)` to see more rows
## BD_moluscos.molusco
## BD_moluscos.c_agua A B
## 50 12.17500 12.32625
## 75 7.89000 6.09500
## 100 9.93625 7.40625
##
## Welch Two Sample t-test
##
## data: y by x2
## t = 1.3189, df = 44.234, p-value = 0.194
## alternative hypothesis: true difference in means between group A and group B is not equal to 0
## 98 percent confidence interval:
## -1.154727 3.937227
## sample estimates:
## mean in group A mean in group B
## 10.000417 8.609167
##
## F test to compare two variances
##
## data: cons_o by molusco
## F = 0.66695, num df = 23, denom df = 23, p-value = 0.3383
## alternative hypothesis: true ratio of variances is not equal to 1
## 95 percent confidence interval:
## 0.2885166 1.5417410
## sample estimates:
## ratio of variances
## 0.6669467
n <- 48 # El tamaño de la muestra
media <- mean(y) # media
desv <- sd(y) # desviación estándar
nivel_de_confianza = 0.95 #vamos a suponer un error máximo del 5%
error.est <- desv/sqrt(n) # se calcula el error estándar
margen.error <- qnorm(0.025) * error.est # determina el nivel de confianza de 95%
lim.inf <- media - margen.error # definimos Límite inferior del intervalo
lim.sup <- media + margen.error # definimos Límite superior del intervalo
Intervalo= c(lim.inf,lim.sup)
Intervalo #Para la media
## [1] 10.346601 8.262983
##
## Call:
## lm(formula = cons_o ~ x1 + x2, data = BD_moluscos)
##
## Residuals:
## Min 1Q Median 3Q Max
## -6.8092 -2.2945 -0.6798 2.8297 7.3011
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 15.36948 1.91620 8.021 3.22e-10 ***
## x1 -0.07159 0.02384 -3.002 0.00436 **
## x2B -1.39125 0.97343 -1.429 0.15985
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 3.372 on 45 degrees of freedom
## Multiple R-squared: 0.1972, Adjusted R-squared: 0.1616
## F-statistic: 5.528 on 2 and 45 DF, p-value: 0.007132
## fit lwr upr
## Min. : 6.819 Min. :4.986 Min. : 8.653
## 1st Qu.: 8.211 1st Qu.:6.377 1st Qu.: 9.996
## Median : 9.305 Median :7.894 Median :10.716
## Mean : 9.305 Mean :7.620 Mean :10.990
## 3rd Qu.:10.399 3rd Qu.:8.614 3rd Qu.:12.233
## Max. :11.790 Max. :9.956 Max. :13.624
load("salinidad.RData")
BD_moluscos
## # A tibble: 48 × 3
## c_agua molusco cons_o
## <fct> <chr> <dbl>
## 1 100 A 7.16
## 2 100 A 8.26
## 3 100 A 6.78
## 4 100 A 14
## 5 100 A 13.6
## 6 100 A 11.1
## 7 100 A 8.93
## 8 100 A 9.66
## 9 100 B 6.14
## 10 100 B 6.14
## # … with 38 more rows
## # ℹ Use `print(n = ...)` to see more rows
Y1 = Salinidad$Biomasa
X0 = Salinidad$pH
X1 = Salinidad$Zinc
X2 = Salinidad$Salinidad
X3 = Salinidad$Potasio
##
## Call:
## lm(formula = Biomasa ~ pH, data = Salinidad)
##
## Residuals:
## Min 1Q Median 3Q Max
## -566.28 -89.26 -19.42 142.42 413.28
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -780.18 117.99 -6.612 4.7e-08 ***
## pH 404.08 24.72 16.346 < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 205.7 on 43 degrees of freedom
## Multiple R-squared: 0.8614, Adjusted R-squared: 0.8582
## F-statistic: 267.2 on 1 and 43 DF, p-value: < 2.2e-16
##
## Call:
## lm(formula = Biomasa ~ X1, data = Salinidad)
##
## Residuals:
## Min 1Q Median 3Q Max
## -545.6 -313.3 10.3 234.1 907.8
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 2002.147 123.247 16.245 < 2e-16 ***
## X1 -51.595 6.282 -8.213 2.37e-10 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 344.8 on 43 degrees of freedom
## Multiple R-squared: 0.6107, Adjusted R-squared: 0.6016
## F-statistic: 67.45 on 1 and 43 DF, p-value: 2.373e-10
### De acuerdo al diagrama de puntos que permite observar la correlación
de los elementos de zinc y biomasa se presenta relación entre ellas con
una tendencia negativa, esto se puede observar sobre la línea azul,
además se puede observar un intervalo de confianza bastante reducido
determinado por la franja de color gris.
##
## Call:
## lm(formula = Biomasa ~ X2, data = Salinidad)
##
## Residuals:
## Min 1Q Median 3Q Max
## -714.96 -430.58 -81.87 232.77 1296.33
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1378.112 681.333 2.023 0.0494 *
## X2 -9.778 22.347 -0.438 0.6639
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 551.4 on 43 degrees of freedom
## Multiple R-squared: 0.004433, Adjusted R-squared: -0.01872
## F-statistic: 0.1914 on 1 and 43 DF, p-value: 0.6639
##
## Call:
## lm(formula = Biomasa ~ X3, data = Salinidad)
##
## Residuals:
## Min 1Q Median 3Q Max
## -732.60 -450.49 -60.73 284.15 1218.57
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1189.3171 237.3067 5.012 9.74e-06 ***
## X3 -0.1344 0.2792 -0.481 0.633
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 551.1 on 43 degrees of freedom
## Multiple R-squared: 0.005358, Adjusted R-squared: -0.01777
## F-statistic: 0.2316 on 1 and 43 DF, p-value: 0.6328
##
## Call:
## lm(formula = Biomasa ~ pH + Potasio + Salinidad + Zinc, data = Salinidad)
##
## Residuals:
## Min 1Q Median 3Q Max
## -293.98 -88.83 -9.48 88.20 387.27
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1492.8076 453.6013 3.291 0.002091 **
## pH 262.8829 33.7304 7.794 1.51e-09 ***
## Potasio -0.1150 0.0819 -1.404 0.167979
## Salinidad -33.4997 8.6525 -3.872 0.000391 ***
## Zinc -28.9727 5.6643 -5.115 8.20e-06 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 158.9 on 40 degrees of freedom
## Multiple R-squared: 0.9231, Adjusted R-squared: 0.9154
## F-statistic: 120 on 4 and 40 DF, p-value: < 2.2e-16
Modelo1
##
## Call:
## lm(formula = Biomasa ~ pH + Potasio + Salinidad + Zinc, data = Salinidad)
##
## Coefficients:
## (Intercept) pH Potasio Salinidad Zinc
## 1492.808 262.883 -0.115 -33.500 -28.973
## fit lwr upr
## 1 1714.484 1545.635 1883.333
## Analysis of Variance Table
##
## Response: Biomasa
## Df Sum Sq Mean Sq F value Pr(>F)
## pH 1 11310631 11310631 447.9573 < 2.2e-16 ***
## Potasio 1 140077 140077 5.5477 0.0235 *
## Salinidad 1 9648 9648 0.3821 0.5400
## Zinc 1 660588 660588 26.1626 8.203e-06 ***
## Residuals 40 1009974 25249
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Study: Modelo1 ~ "pH"
##
## Duncan's new multiple range test
## for Biomasa
##
## Mean Square Error: 25249.35
##
## pH, means
##
## Biomasa std r Min Max
## 3.2 538.4607 112.54608 3 448.315 664.601
## 3.25 445.5385 58.78568 4 369.823 509.872
## 3.3 545.5380 NA 1 545.538 545.538
## 3.35 555.9440 83.64649 2 496.797 615.091
## 3.45 797.8005 28.74601 2 777.474 818.127
## 3.5 977.5150 NA 1 977.515 977.515
## 3.7 612.4470 NA 1 612.447 612.447
## 3.75 654.8250 NA 1 654.825 654.825
## 3.95 568.4550 NA 1 568.455 568.455
## 4.1 1198.3955 7.31502 2 1193.223 1203.568
## 4.15 991.8290 NA 1 991.829 991.829
## 4.2 827.6860 NA 1 827.686 827.686
## 4.25 821.0690 NA 1 821.069 821.069
## 4.4 755.0720 NA 1 755.072 755.072
## 4.45 1008.8040 NA 1 1008.804 1008.804
## 4.55 1152.3410 NA 1 1152.341 1152.341
## 4.6 1049.3065 13.67474 2 1039.637 1058.976
## 4.7 954.0170 NA 1 954.017 954.017
## 4.75 1398.8850 130.66061 2 1306.494 1491.276
## 4.85 1349.1920 NA 1 1349.192 1349.192
## 5 765.2800 NA 1 765.280 765.280
## 5.2 1331.5390 108.42351 2 1254.872 1408.206
## 5.35 1346.8800 NA 1 1346.880 1346.880
## 5.4 1137.1930 NA 1 1137.193 1137.193
## 5.5 1350.4240 179.86149 3 1145.643 1482.793
## 5.55 896.1760 NA 1 896.176 896.176
## 5.6 1895.9420 NA 1 1895.942 1895.942
## 7.1 2270.2940 NA 1 2270.294 2270.294
## 7.35 2332.2200 NA 1 2332.220 2332.220
## 7.4 2337.3260 NA 1 2337.326 2337.326
## 7.45 2192.5595 42.46671 2 2162.531 2222.588
##
## Groups according to probability of means differences and alpha level( 0.05 )
##
## Means with the same letter are not significantly different.
##
## Biomasa groups
## 7.4 2337.3260 a
## 7.35 2332.2200 a
## 7.1 2270.2940 a
## 7.45 2192.5595 a
## 5.6 1895.9420 a
## 4.75 1398.8850 b
## 5.5 1350.4240 bc
## 4.85 1349.1920 bc
## 5.35 1346.8800 bc
## 5.2 1331.5390 bc
## 4.1 1198.3955 bcd
## 4.55 1152.3410 bcd
## 5.4 1137.1930 bcde
## 4.6 1049.3065 bcdef
## 4.45 1008.8040 bcdefg
## 4.15 991.8290 bcdefg
## 3.5 977.5150 bcdefg
## 4.7 954.0170 bcdefg
## 5.55 896.1760 cdefgh
## 4.2 827.6860 defgh
## 4.25 821.0690 defgh
## 3.45 797.8005 defgh
## 5 765.2800 defgh
## 4.4 755.0720 defgh
## 3.75 654.8250 efgh
## 3.7 612.4470 fgh
## 3.95 568.4550 fgh
## 3.35 555.9440 gh
## 3.3 545.5380 gh
## 3.2 538.4607 gh
## 3.25 445.5385 h