df=read_sav("datosMaria.sav") %>% as_factor()
ggplot(df,aes(y=kidneyindex,x=sexo))+geom_boxplot()+
  facet_grid(season~habitat)
## Warning: Removed 65 rows containing non-finite values (stat_boxplot).

ggplot(df,aes(y=sqrt(kidneyindex),x=sexo))+geom_boxplot()+
  facet_grid(season~habitat)
## Warning: Removed 65 rows containing non-finite values (stat_boxplot).

ggplot(df,aes(y=peso,x=sexo))+geom_boxplot()+
  facet_grid(season~habitat)
## Warning: Removed 24 rows containing non-finite values (stat_boxplot).

ggplot(df,aes(y=peso,x=sexo))+geom_boxplot()+
  facet_grid(season~habitat)
## Warning: Removed 24 rows containing non-finite values (stat_boxplot).

mod1=lm(peso ~season+sexo+habitat, data=df)
summary(mod1)
## 
## Call:
## lm(formula = peso ~ season + sexo + habitat, data = df)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -2.02089 -0.32925  0.06737  0.40266  1.86633 
## 
## Coefficients:
##                                   Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                        3.49367    0.09443  36.998   <2e-16 ***
## seasonWet                         -0.10164    0.07297  -1.393   0.1646    
## sexoMacho                         -0.14765    0.07310  -2.020   0.0443 *  
## habitatPlv. MontaƱa 800-1800      -0.19277    0.09652  -1.997   0.0467 *  
## habitatBosq. AraliƔceas 1800-2500 -0.21285    0.10874  -1.957   0.0512 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.6382 on 315 degrees of freedom
##   (215 observations deleted due to missingness)
## Multiple R-squared:  0.04001,    Adjusted R-squared:  0.02782 
## F-statistic: 3.282 on 4 and 315 DF,  p-value: 0.01175
res=residuals(mod1)
qqnorm(res)

hist(res)

mod1=lm(sqrt(kidneyindex) ~season+sexo+habitat, data=df)
summary(mod1)
## 
## Call:
## lm(formula = sqrt(kidneyindex) ~ season + sexo + habitat, data = df)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -3.9832 -2.4005 -0.0209  1.8305  8.3050 
## 
## Coefficients:
##                                   Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                         1.9517     0.4197   4.650 5.03e-06 ***
## seasonWet                           1.1036     0.3300   3.344 0.000934 ***
## sexoMacho                          -0.6548     0.3323  -1.971 0.049725 *  
## habitatPlv. MontaƱa 800-1800        0.9280     0.4362   2.127 0.034229 *  
## habitatBosq. AraliƔceas 1800-2500   0.2169     0.4882   0.444 0.657107    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 2.787 on 292 degrees of freedom
##   (238 observations deleted due to missingness)
## Multiple R-squared:  0.05805,    Adjusted R-squared:  0.04515 
## F-statistic: 4.499 on 4 and 292 DF,  p-value: 0.00153
res=residuals(mod1)
qqnorm(res)

hist(res)