pkg <- c("Rmisc", "ggplot2", "knitr","reshape2", "dplyr")
sapply(pkg, library, character.only=TRUE, logical.return=TRUE)
## Rmisc ggplot2 knitr reshape2 dplyr
## TRUE TRUE TRUE TRUE TRUE
setwd("/home/epi/Dropbox/MyR/Análise otros/ISA/tese")# lab
#setwd("/media/DATA/Dropbox/MyR/Análise otros/ISA/tese") # DELL
Dataset Coeficientes angulares
# Dados planilha laboratorio
dat1 = read.csv("est_taxa.csv", dec=",", header=T, sep="\t", check.names=FALSE)
head(dat1)
## iso transf exp coef_mic
## 1 SP09839 0 1 0.5580000
## 2 PR09638 0 1 0.8958571
## 3 SP08345 0 1 0.4581429
## 4 SP09839 1 1 0.5728571
## 5 PR09638 1 1 1.1139286
## 6 SP08345 1 1 0.4128571
Ajustes lineales
m.PR09638 <- lm(coef_mic ~ transf, data = dat1, subset = iso == "PR09638")
summary(m.PR09638)
##
## Call:
## lm(formula = coef_mic ~ transf, data = dat1, subset = iso ==
## "PR09638")
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.155668 -0.024033 0.006065 0.050914 0.110596
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.038447 0.028781 36.081 <2e-16 ***
## transf 0.004707 0.004865 0.968 0.345
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.07216 on 20 degrees of freedom
## Multiple R-squared: 0.04471, Adjusted R-squared: -0.003051
## F-statistic: 0.9361 on 1 and 20 DF, p-value: 0.3448
m.SP08345 <- lm(coef_mic ~ transf, data = dat1, subset = iso == "SP08345")
summary(m.SP08345)
##
## Call:
## lm(formula = coef_mic ~ transf, data = dat1, subset = iso ==
## "SP08345")
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.128136 -0.035238 -0.007431 0.020897 0.270076
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.437878 0.031921 13.718 1.24e-11 ***
## transf 0.007747 0.005396 1.436 0.167
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.08003 on 20 degrees of freedom
## Multiple R-squared: 0.09344, Adjusted R-squared: 0.04811
## F-statistic: 2.061 on 1 and 20 DF, p-value: 0.1665
m.SP09839 <- lm(coef_mic ~ transf, data = dat1, subset = iso == "SP09839")
summary(m.SP09839)
##
## Call:
## lm(formula = coef_mic ~ transf, data = dat1, subset = iso ==
## "SP09839")
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.07822 -0.04448 -0.01990 0.03521 0.15522
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.5679562 0.0262733 21.617 2.44e-15 ***
## transf -0.0004196 0.0044410 -0.094 0.926
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.06587 on 20 degrees of freedom
## Multiple R-squared: 0.0004462, Adjusted R-squared: -0.04953
## F-statistic: 0.008929 on 1 and 20 DF, p-value: 0.9257
lmplot1 = ggplot(dat1, aes(x=transf, y=coef_mic)) + geom_point(size=1) +
facet_wrap(~iso, ncol=3, scales="fixed") +
scale_x_discrete("Transferências") + coord_cartesian(xlim=c(-1, 11)) +
scale_y_continuous("Taxa de crescimento micelial (cm/dia)")+
theme_bw(base_size = 12, base_family = "Helvetica")+
scale_shape_discrete(name ="Isolados")
lmplot1 + geom_smooth(method=lm, # Add linear regression lines
se=TRUE, # Don't add shaded confidence region
fullrange=T, colour="black")
Dataset avaliações
dat = read.csv("estab_aval.csv", dec=",", header=T, sep="\t", check.names=FALSE, na.strings=".")
head(dat)
## iso rep exp aval germ espor diam_f
## 1 PR09638 1 1 1 38.00000 4.583333 0
## 2 PR09638 2 1 1 40.35294 5.000000 0
## 3 PR09638 3 1 1 22.66667 3.333333 0
## 4 PR09638 4 1 1 35.66667 2.500000 0
## 5 PR09638 5 1 1 43.66667 5.791667 0
## 6 PR09638 6 1 1 72.66667 1.750000 0
long <- melt(dat, id.vars = c("iso", "rep", "exp", "aval"))
names(long)[5:6] = c("x","y")
long = long[complete.cases(long),]
str(long)
## 'data.frame': 695 obs. of 6 variables:
## $ iso : Factor w/ 3 levels "PR09638","SP08345",..: 1 1 1 1 1 1 1 1 1 1 ...
## $ rep : int 1 2 3 4 5 6 7 8 9 10 ...
## $ exp : int 1 1 1 1 1 1 1 1 1 1 ...
## $ aval: int 1 1 1 1 1 1 1 1 1 1 ...
## $ x : Factor w/ 3 levels "germ","espor",..: 1 1 1 1 1 1 1 1 1 1 ...
## $ y : num 38 40.4 22.7 35.7 43.7 ...
datsum <- summarySEwithin(long, measurevar="y", withinvars=c("iso","aval", "x"),
idvar="rep", na.rm=FALSE, conf.interval=.95)
## Automatically converting the following non-factors to factors: aval
datsum = arrange(datsum, x, iso, aval)
(datsum = select(datsum, variable=x, Isolado=iso, Avaliação=aval, N, media=y, se))
## variable Isolado Avaliação N media se
## 1 germ PR09638 1 20 46.3848046 5.9677291
## 2 germ PR09638 2 16 58.5841380 7.6579821
## 3 germ PR09638 3 8 67.2486928 5.8708114
## 4 germ PR09638 4 18 51.8741987 4.8672581
## 5 germ SP08345 1 19 65.9784883 5.2300070
## 6 germ SP08345 2 18 59.6212817 5.5022921
## 7 germ SP08345 3 20 69.6508188 4.3145294
## 8 germ SP08345 4 20 53.7977400 3.4207721
## 9 germ SP09839 1 18 58.5784456 5.1117636
## 10 germ SP09839 2 18 70.8487693 3.1605768
## 11 germ SP09839 3 20 76.0796736 2.5365893
## 12 germ SP09839 4 20 45.2237742 3.5822867
## 13 espor PR09638 1 20 4.0189576 0.6463480
## 14 espor PR09638 2 20 1.9338242 0.4827133
## 15 espor PR09638 3 20 0.6129909 0.4880280
## 16 espor PR09638 4 20 1.2379992 0.4697685
## 17 espor SP08345 1 20 2.6582409 0.5215256
## 18 espor SP08345 2 20 1.8508242 0.5146123
## 19 espor SP08345 3 20 1.0025742 0.4481911
## 20 espor SP08345 4 20 2.6900742 0.6108465
## 21 espor SP09839 1 20 2.5161576 0.4953396
## 22 espor SP09839 2 20 1.1171576 0.4577722
## 23 espor SP09839 3 20 1.1713242 0.4470210
## 24 espor SP09839 4 20 2.8171576 0.7268282
## 25 diam_f PR09638 1 20 0.3596576 0.4140440
## 26 diam_f PR09638 2 20 0.5621576 0.4254129
## 27 diam_f PR09638 3 20 0.2671576 0.4149046
## 28 diam_f PR09638 4 20 0.5421576 0.4149544
## 29 diam_f SP08345 1 20 1.3821576 0.4158764
## 30 diam_f SP08345 2 20 1.3896576 0.4129715
## 31 diam_f SP08345 3 20 1.0746576 0.4329701
## 32 diam_f SP08345 4 20 1.2471576 0.4259255
## 33 diam_f SP09839 1 20 0.8796576 0.4317676
## 34 diam_f SP09839 2 20 1.4171576 0.4210205
## 35 diam_f SP09839 3 20 1.1646576 0.4327277
## 36 diam_f SP09839 4 20 1.2021576 0.4105370
head(dat)
## iso rep exp aval germ espor diam_f
## 1 PR09638 1 1 1 38.00000 4.583333 0
## 2 PR09638 2 1 1 40.35294 5.000000 0
## 3 PR09638 3 1 1 22.66667 3.333333 0
## 4 PR09638 4 1 1 35.66667 2.500000 0
## 5 PR09638 5 1 1 43.66667 5.791667 0
## 6 PR09638 6 1 1 72.66667 1.750000 0
germi = select(dat, iso, rep, exp, aval, germ)
germi = germi[complete.cases(germi),]
germi = filter(germi, germ > 0)
germi$germ = (germi$germ/100) + 0.005
germi$logit= log((germi$germ))- log(1-(germi$germ))
head(germi) ; levels(germi$iso)
## iso rep exp aval germ logit
## 1 PR09638 1 1 1 0.3850000 -0.4683789
## 2 PR09638 2 1 1 0.4085294 -0.3700480
## 3 PR09638 3 1 1 0.2316667 -1.1989241
## 4 PR09638 4 1 1 0.3616667 -0.5681376
## 5 PR09638 5 1 1 0.4416667 -0.2344007
## 6 PR09638 6 1 1 0.7316667 1.0030950
## [1] "PR09638" "SP08345" "SP09839"
mod.PR09 = lm (logit ~ exp + aval, data=germi, subset = iso == "PR09638")
anova(mod.PR09)
## Analysis of Variance Table
##
## Response: logit
## Df Sum Sq Mean Sq F value Pr(>F)
## exp 1 8.828 8.8276 7.9314 0.006697 **
## aval 1 0.044 0.0445 0.0400 0.842275
## Residuals 56 62.327 1.1130
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
par(mfrow=c(2,2)); plot(mod.PR09)
mod.SP08 = lm (logit ~ exp + aval, data=germi, subset = iso == "SP08345")
anova(mod.SP08)
## Analysis of Variance Table
##
## Response: logit
## Df Sum Sq Mean Sq F value Pr(>F)
## exp 1 0.156 0.15569 0.1329 0.7165
## aval 1 2.920 2.91963 2.4914 0.1187
## Residuals 74 86.718 1.17187
par(mfrow=c(2,2)); plot(mod.SP08)
mod.SP09 = lm (logit ~ exp + aval, data=germi, subset = iso == "SP09839")
anova(mod.SP09)
## Analysis of Variance Table
##
## Response: logit
## Df Sum Sq Mean Sq F value Pr(>F)
## exp 1 1.790 1.78966 3.0254 0.08631 .
## aval 1 2.691 2.69105 4.5491 0.03639 *
## Residuals 71 42.000 0.59155
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
par(mfrow=c(2,2)); plot(mod.SP09)
(ggplot(germi, aes(x=aval, y=germ)) + geom_point(size=2) +
facet_grid(exp~iso) +
scale_x_discrete("Avaliações") +
scale_y_continuous("Conidios esporulados (%)")+
theme_bw(base_size = 12, base_family = "Helvetica")
+ geom_smooth(method=lm, # Add linear regression lines
se=TRUE, # Don't add shaded confidence region
fullrange=T, colour="black")
)
date = select(dat, iso, exp, aval, espor)
#date = filter(date, espor>0)
date = date[complete.cases(date),]
(ggplot(date, aes(x=aval, y=espor)) + geom_point(size=2) +
#facet_wrap(exp~iso, ncol=3, scales="free") +
facet_grid(exp~iso) +
scale_x_discrete("Avaliações") +
scale_y_continuous("Esporos")+
theme_bw(base_size = 12, base_family = "Helvetica")
+ geom_smooth(method=lm, # Add linear regression lines
se=TRUE, # Don't add shaded confidence region
fullrange=T, colour="black")
)
pr09_1_1 = filter(date, iso=="PR09638", aval=="1", exp =="1")
pr09_1_4 = filter(date, iso=="PR09638", aval=="4", exp =="1")
t.test(pr09_1_1$espor,pr09_1_4$espor) # where y1 and y2 are numeric
##
## Welch Two Sample t-test
##
## data: pr09_1_1$espor and pr09_1_4$espor
## t = 3.4375, df = 17.444, p-value = 0.003047
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.7793482 3.2439518
## sample estimates:
## mean of x mean of y
## 3.24500 1.23335
pr09_2_1 = filter(date, iso=="PR09638", aval=="1", exp =="2")
pr09_2_4 = filter(date, iso=="PR09638", aval=="4", exp =="2")
t.test(pr09_2_1$espor,pr09_2_4$espor) # where y1 and y2 are numeric
##
## Welch Two Sample t-test
##
## data: pr09_2_1$espor and pr09_2_4$espor
## t = 5.1032, df = 17.565, p-value = 7.999e-05
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 2.086067 5.014466
## sample estimates:
## mean of x mean of y
## 4.758600 1.208333
sp08_1_1 = filter(date, iso=="SP08345", aval=="1", exp =="1")
sp08_1_4 = filter(date, iso=="SP08345", aval=="4", exp =="1")
t.test(sp08_1_1$espor,sp08_1_4$espor)
##
## Welch Two Sample t-test
##
## data: sp08_1_1$espor and sp08_1_4$espor
## t = -1.8977, df = 16.703, p-value = 0.07516
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -2.993799 0.160466
## sample estimates:
## mean of x mean of y
## 2.050000 3.466667
sp08_2_1 = filter(date, iso=="SP08345", aval=="1", exp =="2")
sp08_2_4 = filter(date, iso=="SP08345", aval=="4", exp =="2")
t.test(sp08_2_1$espor,sp08_2_4$espor)
##
## Welch Two Sample t-test
##
## data: sp08_2_1$espor and sp08_2_4$espor
## t = 2.2993, df = 16.212, p-value = 0.0351
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.1068789 2.5991211
## sample estimates:
## mean of x mean of y
## 3.232167 1.879167
sp09_1_1 = filter(date, iso=="SP09839", aval=="1", exp =="1")
sp09_1_4 = filter(date, iso=="SP09839", aval=="4", exp =="1")
t.test(sp09_1_1$espor,sp09_1_4$espor)
##
## Welch Two Sample t-test
##
## data: sp09_1_1$espor and sp09_1_4$espor
## t = -1.004, df = 14.14, p-value = 0.3322
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -3.378180 1.222514
## sample estimates:
## mean of x mean of y
## 2.959667 4.037500
sp09_2_1 = filter(dat, iso=="SP09839", aval=="1", exp =="2")
sp09_2_4 = filter(dat, iso=="SP09839", aval=="4", exp =="2")
t.test(sp09_2_1$espor,sp09_2_4$espor)
##
## Welch Two Sample t-test
##
## data: sp09_2_1$espor and sp09_2_4$espor
## t = 0.9933, df = 15.385, p-value = 0.3359
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -0.5429992 1.4946659
## sample estimates:
## mean of x mean of y
## 2.038333 1.562500
datd = select(dat, iso, exp, aval, diam_f)
datd = datd[complete.cases(datd),]
(ggplot(datd, aes(x=aval, y=diam_f)) + geom_point(size=2) +
#facet_wrap(exp~iso, ncol=3, scales="free") +
facet_grid(exp~iso) +
scale_x_discrete("Avaliações") +
scale_y_continuous("Diâmetro da colônia")+
theme_bw(base_size = 12, base_family = "Helvetica")
+ geom_smooth(method=lm, # Add linear regression lines
se=TRUE, # Don't add shaded confidence region
fullrange=T, colour="black")
)
pr09_1_1 = filter(datd, iso=="PR09638", aval=="1", exp =="1")
pr09_1_4 = filter(datd, iso=="PR09638", aval=="4", exp =="1")
t.test(pr09_1_1$diam_f,pr09_1_4$diam_f) # where y1 and y2 are numeric
##
## Welch Two Sample t-test
##
## data: pr09_1_1$diam_f and pr09_1_4$diam_f
## t = -3.9696, df = 11.179, p-value = 0.00213
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -0.6524188 -0.1875812
## sample estimates:
## mean of x mean of y
## 0.035 0.455
pr09_2_1 = filter(datd, iso=="PR09638", aval=="1", exp =="2")
pr09_2_4 = filter(datd, iso=="PR09638", aval=="4", exp =="2")
t.test(pr09_2_1$diam_f,pr09_2_4$diam_f) # where y1 and y2 are numeric
##
## Welch Two Sample t-test
##
## data: pr09_2_1$diam_f and pr09_2_4$diam_f
## t = 0.7759, df = 17.802, p-value = 0.448
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -0.09404765 0.20404765
## sample estimates:
## mean of x mean of y
## 0.650 0.595
sp08_1_1 = filter(datd, iso=="SP08345", aval=="1", exp =="1")
sp08_1_4 = filter(datd, iso=="SP08345", aval=="4", exp =="1")
t.test(sp08_1_1$diam_f,sp08_1_4$diam_f)
##
## Welch Two Sample t-test
##
## data: sp08_1_1$diam_f and sp08_1_4$diam_f
## t = -4.2612, df = 17.145, p-value = 0.0005183
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -0.5007598 -0.1692402
## sample estimates:
## mean of x mean of y
## 1.035 1.370
sp08_2_1 = filter(datd, iso=="SP08345", aval=="1", exp =="2")
sp08_2_4 = filter(datd, iso=="SP08345", aval=="4", exp =="2")
t.test(sp08_2_1$diam_f,sp08_2_4$diam_f)
##
## Welch Two Sample t-test
##
## data: sp08_2_1$diam_f and sp08_2_4$diam_f
## t = 7.7657, df = 16.765, p-value = 5.984e-07
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.4404558 0.7695442
## sample estimates:
## mean of x mean of y
## 1.695 1.090
sp09_1_1 = filter(datd, iso=="SP09839", aval=="1", exp =="1")
sp09_1_4 = filter(datd, iso=="SP09839", aval=="4", exp =="1")
t.test(sp09_1_1$diam_f,sp09_1_4$diam_f)
##
## Welch Two Sample t-test
##
## data: sp09_1_1$diam_f and sp09_1_4$diam_f
## t = -10.0873, df = 15.133, p-value = 4.107e-08
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -1.12636 -0.73364
## sample estimates:
## mean of x mean of y
## 0.44 1.37
sp09_2_1 = filter(dat, iso=="SP09839", aval=="1", exp =="2")
sp09_2_4 = filter(dat, iso=="SP09839", aval=="4", exp =="2")
t.test(sp09_2_1$diam_f,sp09_2_4$diam_f)
##
## Welch Two Sample t-test
##
## data: sp09_2_1$diam_f and sp09_2_4$diam_f
## t = 2.3757, df = 14.332, p-value = 0.03197
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.02825831 0.54174169
## sample estimates:
## mean of x mean of y
## 1.285 1.000