setwd("~/Dropbox/Clases_UPJ/BiologÃa de poblaciones/Alumnos_EcoPo/Clases/TP_3")
afid<-read.table("afido.csv", sep = ",", header=T)
afid
## semana afidos
## 1 1 0.02
## 2 2 0.50
## 3 3 1.50
## 4 4 5.00
## 5 5 14.50
attach(afid)
plot(semana, afidos)

afid.tra<-transform(afid, afidos=log(afidos))
detach(afid)
attach(afid.tra)
plot(semana, afidos)
fit1<-lm(afidos~semana)
abline(fit1)

summary(fit1)
##
## Call:
## lm(formula = afidos ~ semana)
##
## Residuals:
## 1 2 3 4 5
## -0.83381 0.83757 0.38869 0.04517 -0.43761
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -4.6257 0.7991 -5.789 0.01025 *
## semana 1.5475 0.2409 6.423 0.00765 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.7619 on 3 degrees of freedom
## Multiple R-squared: 0.9322, Adjusted R-squared: 0.9096
## F-statistic: 41.26 on 1 and 3 DF, p-value: 0.007649
predict.lm(fit1)
## 1 2 3 4 5
## -3.0782094 -1.5307165 0.0167763 1.5642691 3.1117620
m.time1 <-function (r, N=40){(log(N)+4.626)/r}
rs<-c(1.547, 2, 3)
m.time1(rs)
## [1] 5.374841 4.157440 2.771626