setwd("~/Dropbox/Clases_UPJ/BiologÃa de poblaciones/A_Ecopo/Ciclo 1730/Clases/TP_1")
crece<-read.table("growth.csv", sep = ",", header=T)
crece
## horas masa
## 1 1416 0.1481
## 2 1416 0.1954
## 3 1416 0.2204
## 4 1416 0.1207
## 5 1419 0.2920
## 6 1419 0.3892
## 7 1419 0.3837
## 8 1419 0.2994
## 9 1422 0.2892
## 10 1422 0.1347
## 11 1422 0.2254
## 12 1440 0.7405
## 13 1440 0.4069
## 14 1440 0.1213
## 15 1440 0.2477
## 16 1442 0.3641
## 17 1442 0.4780
## 18 1442 0.3243
## 19 1442 0.7489
## 20 1444 0.8562
## 21 1444 0.5270
## 22 1444 0.4817
## 23 1444 0.3918
## 24 1446 0.3449
## 25 1446 0.3349
## 26 1446 0.6067
## 27 1446 0.5888
## 28 1464 1.0516
## 29 1464 0.4802
## 30 1466 1.7754
## 31 1466 1.4030
## 32 1468 0.9107
## 33 1468 0.5893
## 34 1470 1.2156
## 35 1470 1.3592
## 36 1488 1.8306
## 37 1488 1.6102
## 38 1490 1.6628
## 39 1490 1.3939
## 40 1492 1.8325
## 41 1492 1.7633
## 42 1494 1.2809
## 43 1494 1.7984
## 44 1512 2.0020
## 45 1512 1.4276
## 46 1514 1.9924
## 47 1514 1.8784
## 48 1516 1.2773
## 49 1516 1.2808
## 50 1518 1.7115
## 51 1518 1.9192
## 52 1536 1.6359
## 53 1536 2.8007
## 54 1538 2.7597
## 55 1538 2.2568
## 56 1540 1.9971
## 57 1540 1.4329
## 58 1542 2.8216
## 59 1542 2.4322
## 60 1562 2.8792
## 61 1562 1.7876
## 62 1566 1.8798
## 63 1566 2.0045
## 64 1586 2.6742
## 65 1586 2.9516
## 66 1590 2.4495
## 67 1590 2.9953
## 68 1610 2.3608
## 69 1614 3.1235
## 70 1638 3.1728
## 71 1662 3.0080
## 72 1686 3.9043
## 73 1710 3.8536
## 74 1734 4.9471
## 75 1758 3.3347
## 76 1782 4.9931
## 77 1464 0.9834
## 78 1464 1.2531
## 79 1466 0.8680
## 80 1466 1.1197
## 81 1468 1.0167
## 82 1468 1.3540
## 83 1470 1.8440
## 84 1470 1.1583
## 85 1488 1.4967
## 86 1488 1.4209
## 87 1490 1.5471
## 88 1490 0.7599
## 89 1492 2.4725
## 90 1492 1.0097
## 91 1494 1.7194
## 92 1494 1.9900
## 93 1512 1.7484
## 94 1512 0.8221
## 95 1514 2.1259
## 96 1514 1.5582
## 97 1516 1.1170
## 98 1516 1.3397
## 99 1518 1.6475
## 100 1518 1.3037
## 101 1536 1.6586
## 102 1536 1.6086
## 103 1538 2.1021
## 104 1538 2.2497
## 105 1540 1.6863
## 106 1540 2.4327
## 107 1542 1.5602
## 108 1542 1.8178
## 109 1562 1.9473
## 110 1562 2.1227
## 111 1566 2.5310
## 112 1566 2.1990
## 113 1586 2.7956
## 114 1586 1.3617
## 115 1590 2.5855
## 116 1590 1.8011
## 117 1610 1.8224
## 118 1614 2.2646
## 119 1638 3.1698
## 120 1662 3.0866
## 121 1686 2.3654
## 122 1710 2.1446
## 123 1734 3.5218
## 124 1758 4.2132
## 125 1782 3.4072
attach(crece)
plot (horas, masa)
fit1<-lm(masa~horas)
abline(fit1)
segments(horas, fitted(fit1), horas, masa)

summary(fit1)
##
## Call:
## lm(formula = masa ~ horas)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.54105 -0.29986 -0.03274 0.33362 1.15251
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -1.487e+01 7.546e-01 -19.71 <2e-16 ***
## horas 1.085e-02 4.944e-04 21.95 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.4677 on 123 degrees of freedom
## Multiple R-squared: 0.7966, Adjusted R-squared: 0.795
## F-statistic: 481.8 on 1 and 123 DF, p-value: < 2.2e-16
layout(matrix(1:4,2,2))
plot(fit1)

layout(1)
shapiro.test(fit1$residuals)
##
## Shapiro-Wilk normality test
##
## data: fit1$residuals
## W = 0.98757, p-value = 0.3157
crece.tra<-transform(crece,masa=log(masa))
detach(crece)
attach(crece.tra)
plot (horas, masa)
fit2<-lm(masa~horas)
abline(fit2)
segments(horas, fitted(fit2), horas, masa)

summary(fit2)
##
## Call:
## lm(formula = masa ~ horas)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.7066 -0.3414 0.1307 0.3918 0.9080
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -1.148e+01 8.649e-01 -13.28 <2e-16 ***
## horas 7.694e-03 5.667e-04 13.58 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.5361 on 123 degrees of freedom
## Multiple R-squared: 0.5998, Adjusted R-squared: 0.5965
## F-statistic: 184.3 on 1 and 123 DF, p-value: < 2.2e-16
layout(matrix(1:4,2,2))
plot(fit2)

layout(1)
shapiro.test(fit1$residuals)
##
## Shapiro-Wilk normality test
##
## data: fit1$residuals
## W = 0.98757, p-value = 0.3157