


Prepara tus exámenes y mejora tus resultados gracias a la gran cantidad de recursos disponibles en Docsity
Gana puntos ayudando a otros estudiantes o consíguelos activando un Plan Premium
Esta página no es visible en la vista previa
¡No te pierdas las partes importantes!



PROYECTO INNOVA DOCENTIA: Internacionalización de los recursos educativos de la asignatura de Ecología y adaptación al Espacio Superior de Educación Europeo (EEES). (Ref 240; http//web.bioucm.es/innovadoc)
In this practice you will learn how to use different numerical techniques to identify plant communities, in the site of study (Morata de Tajuña). You will use statistical inference such as Chi-square and correlation tests, taking species by pairs, in each slope. Remember, that the null hypothesis, H0, is the independence (no association between species).
IMPORTANT: In this practice you will only consider the following species: Carex halleriana, Cistus clusii, Genista scorpius, Jasminum fruticans, Stipa tenacissima, Quercus coccifera, Rosmarinus officinalis, Teucrium pseudochamaepitys and Thymus spp.
Activity 1.- Quantifying the association between species
By means of the analysis of contingency tables through Chi-square, you will test whether there is a significant association (positive or negative) between pairs of species. Contingency tables are built using presence/absence data of plant species (categorical data), so first of all you must convert your quantitative data (lineal cover) into categorical data.
Now, let’s start!!
Double click in the file called “Session 9”, inside the folder “INNOVA”
Save this file with your own name: filesave asOKselect folderwrite the name
First, you must load your data matrix typing the following command:
setwd("C:/Users/Prácticas/Desktop/INNOVA") ### Write the route of the folder where you will keep and read your data. data<-read.table("data.txt",header=TRUE) ### read your main matrix View(data) ### visualize the matrix (you can repeat this command whenever you want to visualize matrices) north<-subset(data,transect=="north") ### create a sub-matrix of the north slope View(north) ### visualize the matrix south<-subset(data,transect=="south") ### create a sub-matrix of the south slope View(south) ### visualize the matrix
Now, let’s start the analysis of the north slope (just the north!!!)
north_P<-as.data.frame(ifelse(north<0.001,0,1)) ### create a new matrix transforming quantitative data in data of presence (1), absence (0).
Let’s do an example with a pair of species ( Carex halleriana and Cistus clusii )
chi<-chisq.test(north_P$car_hal,north_P$cis_clu) ### Analyze presence, absence data by means of chi square test of two species chi ### summary of the analysis chi$observed ### see table of observed values
1
chi$expected ### see table of expected frequencies
Using R, you can save time by comparing all species with all species with just a few commands. Great, isn’t it?
First you must prepare the data
drop.factors<-c("plot","transect","slope") ### Tell which factors must be removed north_P1<-north_P[ , !(names(north_P) %in% drop.factors)] ### Remove factors drop.species.north<-c("gen_sco","que_coc","ros_off") ### Tell which species are absent or present in all observations of the north slope, and must be removed. north_P2<-north_P1[ , !(names(north_P1) %in% drop.species.north)] ### Remove species that you told in the command above View(north_P2) ### check that these species and factors have been removed. chinorth<- combn(ncol(north_P2),2) ### create a matrix combining the species two by two, by pairs. install.packages ("plyr") ### install a package that has the function “adply”, You can use this function to do the chi square test for all combinations of species at the same time. YOU SAVE TIME!!!! AND TIME IS MONEY!!!$$$$ If you want more information, you can type: help(plyr) library ("plyr") ### load the library
Now, let’s do the loop
allchinorth<-adply(chinorth, 2, function(x) { test <- chisq.test(north_P2[, x[1]], north_P2[, x[2]]) out <- data.frame("Row" = colnames(north_P2)[x[1]] ,"Column" = colnames(north_P2[x[2]]) ,"Chi.Square" = test$statistic ,"df"= test$parameter ,"p.value" = test$p.value ,"observed"=test$observed ,"expected"=test$expected) return(out) })
Let’s see the results and interpret the associations between species of the north slope
View(allchinorth)
REMEMBER REPEATING THIS ANALYSIS FOR SPECIES OF THE SOUTH SLOPE!!!! To do this, you must create new matrices: south_P, south_P1, south_P (removing species of the south slope*), chisouth AND allchisouth
2
write.table(corr.N$P,"p value north.txt") ### IDEM
SLOPE!!!! To do this, you must create new matrices: south_C, corr_S, corr.S$r, corr.S $P.
You can create a table similar to the one you have made with the association results.
4