680 likes | 761 Views
Now you DO think quite a bit!. And you drive quite independently!. Mini Reports. Purpose: Stop and realize what you have done in R. Biologically interpret results. Instead of compulsory attendance. Correct severe misstakes or misconceptions. Additional benefit:
E N D
Now you DO think quite a bit! And you drive quite independently!
Mini Reports • Purpose: • Stop and realize what you have done in R. • Biologically interpret results. • Instead of compulsory attendance. • Correct severe misstakes or misconceptions. • Additional benefit: • You are trained in writing scientifically. • They ARE getting better! Can you feel that?!
Save your code! • Compile your own manuals! • Be able to redo graphs and analyses in seconds! • Use word or Notepad++. • Remember history(Inf) # Correlated x-variabels x11() par(mfrow=c(1,2),mar=c(5,5,2,1)) plot(y~xcont,pch=19,col=c("green2","darkslategray")[xcat],cex=2,cex.axis=1.8,cex.lab=1.8,xlab="Tree size (circumference in cm)",ylab="Lichen size (diameter in cm)",main=paste("Variance Inflation Factor = ",signif(vif(mod.both)[1],2))) abline(lm(y[xcat=="Non-polluted"]~xcont[xcat=="Non-polluted"]), lwd=2,col="green2") abline(lm(y[xcat=="Polluted"]~xcont[xcat=="Polluted"]), lwd=2,col="darkslategray") legend("topright", c("Clean air","Polluted air"), lwd=2,pch=19,col=c("green2","darkslategray"),cex=1.5) stripchart(xcont~xcat,method="jitter",jitter=0.1,vertical=T,pch="",cex=1.5,cex.axis=1.8,cex.lab=1.8,ylab="Tree size") points(xcont~jitter(as.numeric(xcat),.3),col=c("green2","darkslategray")[xcat],pch=19,cex=1.5) medel<-tapply(xcont,xcat,mean) s<-tapply(xcont,xcat,sd) n<-tapply(xcont,xcat,length) a<-length(levels(xcat)) konf<-c(qt(0.975,(n-1))*(s/sqrt(n))) segments(1:a-.05,medel, 1:a+.05,medel, col="red",lwd=8, lend=2) arrows(1:a,medel+konf,1:a,medel-konf,angle=90,code=3,length=.1, col="red",lwd=2)
6560000 6558000 north 6556000 6554000 6552000 Isoëtes Presence Absence 1582000 1584000 1586000 1588000 1590000 1592000 east
m3 <- Isoëtes ~ log(area) + conn mint <- Isoëtes ~ log(area) + conn + log(area):conn
m3 <- Isoëtes ~ log(area) + conn mint <- Isoëtes ~ log(area) + conn + log(area):conn p = 0.68
m3 <- Isoëtes ~ log(area) + conn mint <- Isoëtes ~ log(area) + conn + log(area):conn p = 0.68
m3 <- Isoëtes ~ log(area) + conn mint <- Isoëtes ~ log(area) + conn + log(area):conn m3 <- Isoëtes ~ log(area) + conn m1 <- Isoëtes ~ log(area) p = 0.68
m3 <- Isoëtes ~ log(area) + conn mint <- Isoëtes ~ log(area) + conn + log(area):conn m3 <- Isoëtes ~ log(area) + conn m1 <- Isoëtes ~ log(area) p = 0.68 p = 0.036
m3 <- Isoëtes ~ log(area) + conn mint <- Isoëtes ~ log(area) + conn + log(area):conn m3 <- Isoëtes ~ log(area) + conn m1 <- Isoëtes ~ log(area) p = 0.68 p = 0.036
m3 <- Isoëtes ~ log(area) + conn mint <- Isoëtes ~ log(area) + conn + log(area):conn m3 <- Isoëtes ~ log(area) + conn m1 <- Isoëtes ~ log(area) m3 <- Isoëtes ~ log(area) + conn m2 <- Isoëtes ~ conn p = 0.68 p = 0.036
m3 <- Isoëtes ~ log(area) + conn mint <- Isoëtes ~ log(area) + conn + log(area):conn m3 <- Isoëtes ~ log(area) + conn m1 <- Isoëtes ~ log(area) m3 <- Isoëtes ~ log(area) + conn m2 <- Isoëtes ~ conn p = 0.68 p = 0.036 p < 0.0001
m3 <- Isoëtes ~ log(area) + conn mint <- Isoëtes ~ log(area) + conn + log(area):conn m3 <- Isoëtes ~ log(area) + conn m1 <- Isoëtes ~ log(area) m3 <- Isoëtes ~ log(area) + conn m2 <- Isoëtes ~ conn p = 0.68 p = 0.036 p < 0.0001
m3 <- Isoëtes ~ log(area) + conn mint <- Isoëtes ~ log(area) + conn + log(area):conn m3 <- Isoëtes ~ log(area) + conn m1 <- Isoëtes ~ log(area) m3 <- Isoëtes ~ log(area) + conn m2 <- Isoëtes ~ conn m3 <- Isoëtes ~ log(area) + conn p = 0.68 p = 0.036 p < 0.0001
m3 <- Isoëtes ~ log(area) + conn mint <- Isoëtes ~ log(area) + conn + log(area):conn m3 <- Isoëtes ~ log(area) + conn m1 <- Isoëtes ~ log(area) m3 <- Isoëtes ~ log(area) + conn m2 <- Isoëtes ~ conn m1 <- Isoëtes ~ log(area) m0 <- Isoëtes ~ 1 m2 <- Isoëtes ~ conn m0 <- Isoëtes ~ 1 p = 0,68 p = 0,036 p < 0,0001 p < 0,0001 p = 0,82
Anova table on logged Xanthoria Anova(log.mod) Response: log.apo Sum Sq Df F value Pr(>F) log.lich.mm 6.6403 1 27.5230 7.066e-06 *** species 7.5111 1 31.1324 2.535e-06 *** log.lich.mm:species 0.8477 1 3.5134 0.06901 . Residuals 8.6855 36
Anodev table on poisson Xanthoria poimod<-glm(apo~lich.mm*species,poisson) Anova(poimod) Response: apo LR Chisq Df Pr(>Chisq) lich.mm 1199.50 1 < 2.2e-16 *** species 166.93 1 < 2.2e-16 *** lich.mm:species 18.22 1 1.967e-05 ***
summary table on poisson Xanth poimod<-glm(apo~lich.mm*species,poisson) summary(poimod) … … Residual deviance: 703.65 on 36 degrees of freedom
Anodev table on quasipoisson Xan qpoimod<-glm(apo~lich.mm*species,quasipoisson) Anova(qpoimod,test=”F”) Response: apo LR Chisq Df Pr(>Chisq) lich.mm 49.416 1 2.071e-12 *** species 6.877 1 0.008731 ** lich.mm:species 0.751 1 0.386270
Anova table on logged Xanthoria Anova(log.mod) Response: log.apo Sum Sq Df F value Pr(>F) log.lich.mm 6.6403 1 27.5230 7.066e-06 *** species 7.5111 1 31.1324 2.535e-06 *** log.lich.mm:species 0.8477 1 3.5134 0.06901 . Residuals 8.6855 36
Curvilinjear relationships y ~ x + x2 Predation ~ no. flowering plants y ~ x log10(no. flowering plants)
Curvilinjear relationships y ~ x + x2 Predation ~ no. flowering plants y ~ x Cred to Petra log10(no. flowering plants)
Organic 1 0.8 0.6 Probability for organic milk 0.4 0.2 Ordinary 0 20 30 40 50 60 Ålder Age and organic milk
Organic 1 0.8 0.6 Probability for organic milk 0.4 0.2 Ordinary 0 20 30 40 50 60 Ålder Age and organic milk p = 0.016
Break? or?
MANY response variables • Multivariate statistics • Example: • Do people have different values in different countries? • ”Values” is composed of many response variables: • How important is a high salary? • How important is religion? • Do men and women have the same responsibility for children? etc…
2.0 Japan Sweden 1.5 East Germany Estonia Norway Bulgaria China Czech Russia West Germany 1.0 Denmark S Korea Ukraine Netherlands Lithuania Finland Slovenia Montenegro Switzerland Taiwan Latvia Greece 0.5 Serbia France Albania Slovakia Luxembourg Moldova Iceland Hungary Belgium Austria Israel Italy Great Britain Bosnia 0 Croatia Spain New Zealand Georgia Azerbadzjan Canada Armenia Uruguay Australia Romania -0.5 Poland N.Ireland U.S.A India Vietnam Turkey -1.0 Portugal Ireland Indonesia Chile Argentina Phillipines Bangladesh Dominican republic Iran Peru South Africa -1.5 Pakistan Brazil Jordan Uganda Mexico Ghana Nigeria Zimbabwe Algeria Egypt Venezuela Morocco Tanzania Colombia -2.0 Puerto Rico El Salvador -2.0 -1.5 -1.0 -0.5 0 0.5 1.0 1.5 2.0
How the **** do you make such a graph? • Making 2D of 3D: • A very simple example: • Which countries are closest to each other? • Values based on: • How important is money? (from 1-5, mean per country) • How important is religion? (from 1-5, mean per country) • How important is gender equality? (from 1-5, mean per country)
PC 1 PC 2