R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.

library(readxl)
infeccion <- read_excel("D:/Modelado/8 Oct/infeccion.xlsx",sheet = "afeccion")
infeccion
## # A tibble: 81 x 4
##    enfermedad edadm pesoh17 genotipo
##    <chr>      <dbl>   <dbl> <chr>   
##  1 n              2       1 f       
##  2 n              9      13 f       
##  3 s             15       2 f       
##  4 n             15      16 f       
##  5 n             18       2 f       
##  6 n             20       9 f       
##  7 n             26      13 f       
##  8 s             42       6 f       
##  9 n             51       9 f       
## 10 s             52       6 f       
## # ... with 71 more rows
library(ggplot2)
par(mfrow=c(1,2))
boxplot(infeccion$pesoh17~infeccion$enfermedad,varwidth = TRUE, col=palette("Paired"))
boxplot(infeccion$edadm~infeccion$enfermedad,varwidth = TRUE, col=palette("Pastel 2"))

# S: si enferma 
# N: no enferma
t<-table(infeccion$enfermedad,infeccion$genotipo)
addmargins(t)
##      
##        f  m Sum
##   n   17 47  64
##   s   11  6  17
##   Sum 28 53  81
plot(infeccion$edadm,infeccion$pesoh17, col="blue")

df=data.frame(infeccion)
df$enfermedad=ifelse(df$enfermedad=="n",0,1)
models<-glm(df$enfermedad~df$edadm*df$pesoh17*df$genotipo,family = "binomial")
summary(models)
## 
## Call:
## glm(formula = df$enfermedad ~ df$edadm * df$pesoh17 * df$genotipo, 
##     family = "binomial")
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -2.1767  -0.5359  -0.2494  -0.1691   2.3149  
## 
## Coefficients:
##                                   Estimate Std. Error z value Pr(>|z|)
## (Intercept)                      -0.109124   1.375388  -0.079    0.937
## df$edadm                          0.024128   0.020874   1.156    0.248
## df$pesoh17                       -0.074156   0.147678  -0.502    0.616
## df$genotipom                     -5.969109   4.278066  -1.395    0.163
## df$edadm:df$pesoh17              -0.001977   0.002006  -0.985    0.325
## df$edadm:df$genotipom             0.038086   0.041325   0.922    0.357
## df$pesoh17:df$genotipom           0.213830   0.343265   0.623    0.533
## df$edadm:df$pesoh17:df$genotipom -0.001651   0.003419  -0.483    0.629
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 83.234  on 80  degrees of freedom
## Residual deviance: 55.706  on 73  degrees of freedom
## AIC: 71.706
## 
## Number of Fisher Scoring iterations: 6
modelr<-glm(df$enfermedad~1,family = "binomial")
summary(modelr)
## 
## Call:
## glm(formula = df$enfermedad ~ 1, family = "binomial")
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -0.6864  -0.6864  -0.6864  -0.6864   1.7671  
## 
## Coefficients:
##             Estimate Std. Error z value Pr(>|z|)    
## (Intercept)  -1.3257     0.2729  -4.859 1.18e-06 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 83.234  on 80  degrees of freedom
## Residual deviance: 83.234  on 80  degrees of freedom
## AIC: 85.234
## 
## Number of Fisher Scoring iterations: 4
anova(modelr,models,test="Chisq") # Se rechaza que el modelr es el mejor
## Analysis of Deviance Table
## 
## Model 1: df$enfermedad ~ 1
## Model 2: df$enfermedad ~ df$edadm * df$pesoh17 * df$genotipo
##   Resid. Df Resid. Dev Df Deviance  Pr(>Chi)    
## 1        80     83.234                          
## 2        73     55.706  7   27.529 0.0002676 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
models2<-glm(df$enfermedad~df$edadm*df$pesoh17+df$genotipo,family = "binomial")
summary(models2)
## 
## Call:
## glm(formula = df$enfermedad ~ df$edadm * df$pesoh17 + df$genotipo, 
##     family = "binomial")
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -2.3085  -0.5477  -0.2679  -0.2170   2.2644  
## 
## Coefficients:
##                      Estimate Std. Error z value Pr(>|z|)  
## (Intercept)         -0.607709   1.249514  -0.486   0.6267  
## df$edadm             0.029317   0.015014   1.953   0.0509 .
## df$pesoh17          -0.084943   0.124831  -0.680   0.4962  
## df$genotipom        -1.691206   0.714762  -2.366   0.0180 *
## df$edadm:df$pesoh17 -0.001719   0.001353  -1.271   0.2039  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 83.234  on 80  degrees of freedom
## Residual deviance: 58.142  on 76  degrees of freedom
## AIC: 68.142
## 
## Number of Fisher Scoring iterations: 5
anova(models2,models,test="Chisq") # El mas peque昼㸱o es el mejor
## Analysis of Deviance Table
## 
## Model 1: df$enfermedad ~ df$edadm * df$pesoh17 + df$genotipo
## Model 2: df$enfermedad ~ df$edadm * df$pesoh17 * df$genotipo
##   Resid. Df Resid. Dev Df Deviance Pr(>Chi)
## 1        76     58.142                     
## 2        73     55.706  3   2.4368   0.4868
models3<-glm(df$enfermedad~df$edadm+df$pesoh17+df$genotipo,family = "binomial")
summary(models3)
## 
## Call:
## glm(formula = df$enfermedad ~ df$edadm + df$pesoh17 + df$genotipo, 
##     family = "binomial")
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -1.9481  -0.5284  -0.3120  -0.1437   2.2525  
## 
## Coefficients:
##               Estimate Std. Error z value Pr(>|z|)    
## (Intercept)   0.609369   0.803288   0.759 0.448096    
## df$edadm      0.012653   0.006772   1.868 0.061701 .  
## df$pesoh17   -0.227912   0.068599  -3.322 0.000893 ***
## df$genotipom -1.543444   0.685681  -2.251 0.024388 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 83.234  on 80  degrees of freedom
## Residual deviance: 59.859  on 77  degrees of freedom
## AIC: 67.859
## 
## Number of Fisher Scoring iterations: 5
anova(models2,models3,test="Chisq") # El mas peque昼㸱o es el mejor
## Analysis of Deviance Table
## 
## Model 1: df$enfermedad ~ df$edadm * df$pesoh17 + df$genotipo
## Model 2: df$enfermedad ~ df$edadm + df$pesoh17 + df$genotipo
##   Resid. Df Resid. Dev Df Deviance Pr(>Chi)
## 1        76     58.142                     
## 2        77     59.859 -1  -1.7161   0.1902

\[\ln(p/(1-p))=0.609+0.0126e-0.228w-1.543gen\] \[p/(1-p)=\exp(0.609+0.0126e-0.228w-1.543gen)\]

\[p=\exp(0.609+0.0126e-0.228w-1.543gen)(1-p)\] \[p+p(\exp(0.609+0.0126e-0.228w-1.543gen))=\exp(0.609+0.0126e-0.228w-1.543gen)\] \[p(1+(\exp(0.609+0.0126e-0.228w-1.543gen)))=\exp(0.609+0.0126e-0.228w-1.543gen)\]

\[\hat p= \frac{\exp(0.609+0.0126e-0.228w-1.543gen)}{1+(\exp(0.609+0.0126e-0.228w-1.543gen))}\]

df$genotipo=ifelse(df$genotipo=="f",0,1)
# f seria igual a 0 
# m seria igual a 1 
pestimado<-exp(0.609+0.0126*df$edadm-0.228*df$pesoh17-1.543*df$genotipo)/(1+exp(0.609+0.0126*df$edadm-0.228*df$pesoh17-1.543*df$genotipo))
pestimado
##  [1] 0.600176361 0.096076499 0.584676265 0.054681317 0.593824864 0.233080134
##  [7] 0.116355980 0.442801491 0.309939961 0.474073275 0.200431446 0.306996224
## [13] 0.129678994 0.785969591 0.138452844 0.115986349 0.175115156 0.272812422
## [19] 0.688260608 0.555125007 0.573708979 0.328053945 0.330837414 0.729561707
## [25] 0.466301165 0.849002647 0.356130232 0.462570155 0.012850992 0.010257862
## [31] 0.025150631 0.010257862 0.048642143 0.008286554 0.020376221 0.010648823
## [37] 0.099642780 0.009043718 0.014551540 0.047434909 0.038597710 0.013323669
## [43] 0.066248347 0.014899735 0.030560789 0.030936303 0.016051046 0.017269381
## [49] 0.402899089 0.235160095 0.464708781 0.029718975 0.031978206 0.078681336
## [55] 0.033575712 0.053860125 0.068319164 0.040279478 0.040769388 0.043305685
## [61] 0.043305685 0.084246515 0.476666960 0.133889229 0.112066939 0.386701189
## [67] 0.616802889 0.508149278 0.066583171 0.188069984 0.069784783 0.061966020
## [73] 0.064199914 0.127883871 0.105722348 0.130720869 0.051115466 0.130584570
## [79] 0.108012997 0.086827612 0.350145434
tablape<-ifelse(pestimado>0.5,1,0)
q<-table(df$enfermedad,tablape);q # Matriz de cofusion 
##    tablape
##      0  1
##   0 60  4
##   1 10  7
df$estimado=pestimado
tapply(df$estimado,df$genotipo,mean) # probabiidad estimada media x genotipo
##         0         1 
## 0.3918100 0.1126742
tapply(df$enfermedad,df$genotipo,mean) # probabilidad enfermedad media x genotipo
##         0         1 
## 0.3928571 0.1132075
plot(df$enfermedad,tablape,xlim=c(-0.1,1),ylim=c(-0.15,1),type='n', xlab = "",
     ylab = "", yaxt='n', xaxt='n')
points(c(0,0,1,1),c(0,1,0,1),cex=c(60,4,10,7)*0.2,col=c("gold","blue","cyan","yellow"),pch=19)

Modelando proporciones

lote1=ifelse(round(rexp(n = 100,rate = 1.2))>=1,0,1)
prop.table(table(lote1))
## lote1
##    0    1 
## 0.59 0.41
lote2=ifelse(round(rexp(n = 144,rate = 1.5))>=1,0,1)
prop.table(table(lote2))
## lote2
##         0         1 
## 0.4930556 0.5069444
prevprome<-(0.36+0.486)/2 ; prevprome # erronea
## [1] 0.423
prevpromb<-(36+70)/(100+144) ; prevpromb # correcto
## [1] 0.4344262
machos<-c(0,1,3,4,33,80,158,365)
hembras<-c(1,3,7,18,22,41,52,79)
densidad<-c(1,4,10,22,55,121,210,444)
y<-cbind(machos,hembras);y
##      machos hembras
## [1,]      0       1
## [2,]      1       3
## [3,]      3       7
## [4,]      4      18
## [5,]     33      22
## [6,]     80      41
## [7,]    158      52
## [8,]    365      79
summary(glm(y~densidad,family=binomial))
## 
## Call:
## glm(formula = y ~ densidad, family = binomial)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -3.4619  -1.2760  -0.9911   0.5742   1.8795  
## 
## Coefficients:
##              Estimate Std. Error z value Pr(>|z|)    
## (Intercept) 0.0807368  0.1550376   0.521    0.603    
## densidad    0.0035101  0.0005116   6.862 6.81e-12 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 71.159  on 7  degrees of freedom
## Residual deviance: 22.091  on 6  degrees of freedom
## AIC: 54.618
## 
## Number of Fisher Scoring iterations: 4
summary(glm(y~log(densidad),family=binomial))
## 
## Call:
## glm(formula = y ~ log(densidad), family = binomial)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -1.9697  -0.3411   0.1499   0.4019   1.0372  
## 
## Coefficients:
##               Estimate Std. Error z value Pr(>|z|)    
## (Intercept)   -2.65927    0.48758  -5.454 4.92e-08 ***
## log(densidad)  0.69410    0.09056   7.665 1.80e-14 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 71.1593  on 7  degrees of freedom
## Residual deviance:  5.6739  on 6  degrees of freedom
## AIC: 38.201
## 
## Number of Fisher Scoring iterations: 4

Modelo

\[\ln(p/(1-p))=-2.66+0.69\ln(density)\]

Estimando probabilidades

pobservado<-machos/(machos+hembras)
plot(log(densidad),pobservado,pch=16,col="green3")

pestimado<-exp(-2.66+0.69*log(densidad))/(1+exp(-2.66+0.69*log(densidad)))
pobservado/pestimado
## [1] 0.0000000 1.6232257 1.1756783 0.4898453 1.1401624 1.0066236 1.0211194
## [8] 0.9972337
plot(pobservado,pestimado,col="blue3")

plot(log(densidad),pobservado,pch=16,col="blue")
points(log(densidad),pestimado,pch=16,col="cyan")
segments(x0 =log(densidad)[4] ,y0 =pobservado[4] ,x1 =log(densidad)[4] ,y1 =pestimado[4])
text(3.8,0.25, "M攼㸱ximo \n residual")

res<-pobservado-pestimado
boxplot(res, col = "cyan")

outliers::dixon.test(res)
## 
##  Dixon test for outliers
## 
## data:  res
## Q = 0.4712, p-value = 0.2132
## alternative hypothesis: lowest value -0.189356501197036 is an outlier

Hipotesis nula: el valor mas bajo no es un atipico Hipotesis alterna: el valor mas bajo es un atipico Por lo tanto no se rechaza la hipotesis nula (No es un atipico)

library(mvoutlier)
## Loading required package: sgeostat
## Registered S3 method overwritten by 'GGally':
##   method from   
##   +.gg   ggplot2
## sROC 0.1-2 loaded
z <- cbind(log(densidad),pobservado)
# execute:
color.plot(z, quan=0.95)

## $outliers
## [1] FALSE FALSE FALSE  TRUE FALSE FALSE FALSE FALSE
## 
## $md
## [1] 1.3644872 1.3103553 0.9787861 6.9571001 1.0225690 0.5371411 0.7275172
## [8] 1.1303935
## 
## $euclidean
## [1] 0.1420777 1.1793198 1.5883896 1.6629228 2.8765799 3.2845987 3.6866598
## [8] 4.1048014
corr.plot(z[,1],z[,2])

## $cor.cla
## [1] 0.9488771
## 
## $cor.rob
## [1] 0.9925565
library(readxl)
germination <- read_excel("D:/Modelado/8 Oct/germination.xlsx", sheet = "germinacion")
germination
## # A tibble: 21 x 4
##    nogerm sigerm tiempo extracto
##     <dbl>  <dbl>  <dbl>    <dbl>
##  1     10     39     40        1
##  2     23     62     40        1
##  3     23     81     40        1
##  4     26     51     40        1
##  5     17     39     40        1
##  6      5      6     40        2
##  7     53     74     40        2
##  8     55     72     40        2
##  9     32     51     40        2
## 10     46     79     40        2
## # ... with 11 more rows
germination$pgermi<-germination$sigerm/(germination$nogerm+germination$sigerm)
boxplot(germination$pgermi, col = "green")

germination$germi1<-sqrt(germination$pgermi)
germination$germi2<-asin(germination$germi1)
m1<-aov(germination$pgermi~germination$extracto*germination$tiempo)
summary(m1)
##                                         Df  Sum Sq Mean Sq F value  Pr(>F)   
## germination$extracto                     1 0.07685 0.07685  11.518 0.00345 **
## germination$tiempo                       1 0.02685 0.02685   4.024 0.06105 . 
## germination$extracto:germination$tiempo  1 0.00522 0.00522   0.783 0.38868   
## Residuals                               17 0.11343 0.00667                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
germination$trt=interaction(germination$tiempo,germination$extracto)
bartlett.test(germination$pgermi,germination$trt)
## 
##  Bartlett test of homogeneity of variances
## 
## data:  germination$pgermi and germination$trt
## Bartlett's K-squared = 8.374, df = 3, p-value = 0.03888
shapiro.test(m1$residuals)
## 
##  Shapiro-Wilk normality test
## 
## data:  m1$residuals
## W = 0.90092, p-value = 0.03646
m2<-aov(germination$germi1~germination$extracto*germination$tiempo)
summary(m2)
##                                         Df  Sum Sq  Mean Sq F value  Pr(>F)   
## germination$extracto                     1 0.02749 0.027487  12.802 0.00232 **
## germination$tiempo                       1 0.00954 0.009538   4.442 0.05021 . 
## germination$extracto:germination$tiempo  1 0.00244 0.002436   1.135 0.30169   
## Residuals                               17 0.03650 0.002147                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
bartlett.test(germination$germi1,germination$trt)
## 
##  Bartlett test of homogeneity of variances
## 
## data:  germination$germi1 and germination$trt
## Bartlett's K-squared = 6.7777, df = 3, p-value = 0.07933
shapiro.test(m2$residuals)
## 
##  Shapiro-Wilk normality test
## 
## data:  m2$residuals
## W = 0.92054, p-value = 0.08897
# Usando la segunda transformaci昼㸳n 
m3<-aov(germination$germi2~germination$extracto*germination$tiempo)
summary(m3)
##                                         Df  Sum Sq Mean Sq F value Pr(>F)  
## germination$extracto                     1 0.12622 0.12622   6.867 0.0179 *
## germination$tiempo                       1 0.05257 0.05257   2.860 0.1090  
## germination$extracto:germination$tiempo  1 0.00036 0.00036   0.019 0.8910  
## Residuals                               17 0.31248 0.01838                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
bartlett.test(germination$germi2,germination$trt)
## 
##  Bartlett test of homogeneity of variances
## 
## data:  germination$germi2 and germination$trt
## Bartlett's K-squared = 17.59, df = 3, p-value = 0.0005343
shapiro.test(m3$residuals)
## 
##  Shapiro-Wilk normality test
## 
## data:  m3$residuals
## W = 0.77241, p-value = 0.0002558
AIC(m1);AIC(m2);AIC(m3)
## [1] -40.04684
## [1] -63.85815
## [1] -18.76702
pred2<-m2$fitted.values
plot(germination$pgermi,pred2, col = "red")

Usando Modelo Lineal Generalizado GLM

y2<-cbind(germination$nogerm,germination$sigerm)
summary(glm(y2~germination$tiempo*germination$extracto,family = binomial))
## 
## Call:
## glm(formula = y2 ~ germination$tiempo * germination$extracto, 
##     family = binomial)
## 
## Deviance Residuals: 
##      Min        1Q    Median        3Q       Max  
## -1.63783  -0.85274   0.03306   0.51772   1.37050  
## 
## Coefficients:
##                                         Estimate Std. Error z value Pr(>|z|)
## (Intercept)                             -0.78122    0.77575  -1.007    0.314
## germination$tiempo                      -0.02141    0.02225  -0.962    0.336
## germination$extracto                    -0.04883    0.46690  -0.105    0.917
## germination$tiempo:germination$extracto  0.01690    0.01333   1.267    0.205
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 33.870  on 20  degrees of freedom
## Residual deviance: 13.079  on 17  degrees of freedom
## AIC: 105.05
## 
## Number of Fisher Scoring iterations: 4
mo1<-glm(y2~germination$tiempo*germination$extracto,family = quasibinomial)
summary(mo1)
## 
## Call:
## glm(formula = y2 ~ germination$tiempo * germination$extracto, 
##     family = quasibinomial)
## 
## Deviance Residuals: 
##      Min        1Q    Median        3Q       Max  
## -1.63783  -0.85274   0.03306   0.51772   1.37050  
## 
## Coefficients:
##                                         Estimate Std. Error t value Pr(>|t|)
## (Intercept)                             -0.78122    0.64788  -1.206    0.244
## germination$tiempo                      -0.02141    0.01858  -1.152    0.265
## germination$extracto                    -0.04883    0.38994  -0.125    0.902
## germination$tiempo:germination$extracto  0.01690    0.01114   1.517    0.148
## 
## (Dispersion parameter for quasibinomial family taken to be 0.697491)
## 
##     Null deviance: 33.870  on 20  degrees of freedom
## Residual deviance: 13.079  on 17  degrees of freedom
## AIC: NA
## 
## Number of Fisher Scoring iterations: 4
mo2<-glm(y2~germination$tiempo+germination$extracto,family = quasibinomial)
summary(mo2)
## 
## Call:
## glm(formula = y2 ~ germination$tiempo + germination$extracto, 
##     family = quasibinomial)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -1.5431  -0.5006  -0.1852   0.3968   1.4796  
## 
## Coefficients:
##                       Estimate Std. Error t value Pr(>|t|)    
## (Intercept)          -1.695438   0.263091  -6.444  4.6e-06 ***
## germination$tiempo    0.005641   0.005687   0.992 0.334391    
## germination$extracto  0.523241   0.106982   4.891 0.000118 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for quasibinomial family taken to be 0.7522366)
## 
##     Null deviance: 33.870  on 20  degrees of freedom
## Residual deviance: 14.678  on 18  degrees of freedom
## AIC: NA
## 
## Number of Fisher Scoring iterations: 4
anova(mo1,mo2,test="F")
## Analysis of Deviance Table
## 
## Model 1: y2 ~ germination$tiempo * germination$extracto
## Model 2: y2 ~ germination$tiempo + germination$extracto
##   Resid. Df Resid. Dev Df Deviance      F Pr(>F)
## 1        17     13.079                          
## 2        18     14.678 -1  -1.5995 2.2933 0.1483
mo3<-glm(y2~germination$extracto,family = quasibinomial)
summary(mo3)
## 
## Call:
## glm(formula = y2 ~ germination$extracto, family = quasibinomial)
## 
## Deviance Residuals: 
##      Min        1Q    Median        3Q       Max  
## -1.59555  -0.69284  -0.04085   0.51537   1.25485  
## 
## Coefficients:
##                      Estimate Std. Error t value Pr(>|t|)    
## (Intercept)           -1.5061     0.1791  -8.408 7.95e-08 ***
## germination$extracto   0.5244     0.1064   4.927 9.36e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for quasibinomial family taken to be 0.7450712)
## 
##     Null deviance: 33.870  on 20  degrees of freedom
## Residual deviance: 15.422  on 19  degrees of freedom
## AIC: NA
## 
## Number of Fisher Scoring iterations: 4
anova(mo3,mo2,test="F")
## Analysis of Deviance Table
## 
## Model 1: y2 ~ germination$extracto
## Model 2: y2 ~ germination$tiempo + germination$extracto
##   Resid. Df Resid. Dev Df Deviance     F Pr(>F)
## 1        19     15.422                         
## 2        18     14.678  1  0.74394 0.989 0.3332
mo3$fitted.values
##         1         2         3         4         5         6         7         8 
## 0.2725599 0.2725599 0.2725599 0.2725599 0.2725599 0.3876404 0.3876404 0.3876404 
##         9        10        11        12        13        14        15        16 
## 0.3876404 0.3876404 0.3876404 0.2725599 0.2725599 0.2725599 0.2725599 0.2725599 
##        17        18        19        20        21 
## 0.3876404 0.3876404 0.3876404 0.3876404 0.3876404
plot((germination$nogerm/(germination$nogerm+germination$sigerm)),mo3$fitted.values, col = "blue2")

plot((germination$sigerm/(germination$nogerm+germination$sigerm)),mo3$fitted.values, col = "green4")