Showing posts with label maxent. Show all posts
Showing posts with label maxent. Show all posts

Tuesday, February 26, 2013

Thinking it doesn't make any sense that BIO_13 precipitation of the warmest month is most important. I also included BIO_18 precipitation of the warmest quarter.

Due to correlation values, you have to make a decision when the going gets rough. I am now going to include BIO_12 [Annual Precipitation], keep 16, get rid of 13 and 14.

R script:
#load packages
library(raster)
library(maptools)
library(dismo)
library(rJava) #also make sure to put maxent.jar into R dismo library folder

#convert to raster
altitude<-raster("/Volumes/LOLOYOHE BA/Merged_layers/alt_seasia9tile.grd")
bio2<-raster("/Volumes/LOLOYOHE BA/Merged_layers/bio2_seasia9tile.grd")

bio2<-raster("/Volumes/LOLOYOHE BA/Merged_layers/bio2_seasia9tile.grd")
bio5<-raster("/Volumes/LOLOYOHE BA/Merged_layers/bio5_seasia9tile.grd")
bio8<-raster("/Volumes/LOLOYOHE BA/Merged_layers/bio8_seasia9tile.grd")
bio12<-raster("/Volumes/LOLOYOHE BA/Merged_layers/bio12_seasia9tile.grd")
bio15<-raster("/Volumes/LOLOYOHE BA/Merged_layers/bio15_seasia9tile.grd")
bio16<-raster("/Volumes/LOLOYOHE BA/Merged_layers/bio16_seasia9tile.grd")
bio18<-raster("/Volumes/LOLOYOHE BA/Merged_layers/bio18_seasia9tile.grd")
bio19<-raster("/Volumes/LOLOYOHE BA/Merged_layers/bio19_seasia9tile.grd")


#stack the layers into one raster and name the layers within the stack

stacked.layers<-stack(altitude, bio2, bio5, bio8, bio12, bio15, bio16, bio18, bio19)
names(stacked.layers)<-c("altitude", "bio2", "bio5", "bio8", "bio12", "bio15", "bio16", "bio18", "bio19")
#remove the original rasters for space
rm(altitude, bio2, bio5, bio8, bio12, bio15, bio16, bio18, bio19)

#read locality points for first species: alcippe peracensis

peracensis.pts<-readShapePoints("/Volumes/LOLOYOHE BA/Vietnam Data/maxent_models/alcippe_peracensis_all.shp")

#run maxent for first species
maxent.peracensis<-maxent(stacked.layers, coordinates(peracensist.pts)[,1:2])

#see graph of important variables

plot(maxent.peracensis)

#see the response curves
response(maxent.peracensis)

#make raster from predictions
r.peracensis<-predict(maxent.peracensis, stacked.layers, progress = "window")


These are my models for six species showing differences between before and after changing the BIOCLIM variables to include. Notice the before is run using the maxent.jar applet rather than with R so I am still figuring out how to get all the same outputs

Alcippe peracensis Mountain fulvetta
Before:

After:

Garrulax chinensis Black-throated laughingthrush
Before:

VariablePercent contributionPermutation importance
bio13_seasia9tile53.752.6
bio15_seasia9tile25.718.2
bio14_seasia9tile64.3
bio8_seasia9tile5.51
_bio2_seasia9tile41.3
_bio5_seasia9tile3.917.4
_alt_seasia9tile1.15.2
After:


Garrulax leucolophus White-crested laughingthrush
Before: 

VariablePercent contributionPermutation importance
bio13_seasia9tile58.629.3
_bio5_seasia9tile11.36.5
_alt_seasia9tile918.8
_bio2_seasia9tile7.613.1
bio14_seasia9tile5.57.1
bio15_seasia9tile5.11.5
bio8_seasia9tile2.923.7
After:


Pellorneum albiventre Spot-throated babbler
Before:

After:

Pomatorhinus ruficollis Streak-breasted scimitar babbler
Before:

VariablePercent contributionPermutation importance
bio13_seasia9tile58.629.3
_bio5_seasia9tile11.36.5
_alt_seasia9tile918.8
_bio2_seasia9tile7.613.1
bio14_seasia9tile5.57.1
bio15_seasia9tile5.11.5
bio8_seasia9tile2.923.7

After:


Pteruthius
Should I even bother including in my analysis anymore? (No longer a babbler)

Questions to discuss:

  1. Is it okay to rerun models with new set of BIOCLIM variables even if you have already run it once and just notice the first one does not seem biologically true? What if these new variables don't seem right either? Is it okay to keep trying to rerun the models?
  2. What does it mean when only one variable is giving strong response?
  3. Precipitation of the Wettest Month (BIO13) was removed as we had thought this didn't make much biological sense due to the way the rainy season works in SE Asia (May/June-Sept/October). We thought it made more sense if Precipitation of the Wettest Quarter were included instead (BIO 16). However, this only seemed to be important for P. ruficollis (as well as altitude). Annual precipitation seemed to be the only important variable (BIO 12) for all other species and nothing else. How can we interpret this?
  4. How do I make the ROC curve in R?
  5. I want to validate the model and move forward from this.

Wednesday, January 16, 2013

Installing compiler on mac (for the millionth time!!)
http://www.mkyong.com/mac/how-to-install-gcc-compiler-on-mac-os-x/

To install DIVA-GIS
-Installed WineBottler
-To get WineBottler to work--had to install wget command: http://www.mactricksandtips.com/2008/07/installing-wget-on-your-mac-for-terminal.html
-WineBottler was missing WineTricks to install missing libraries with DIVA-GIS: http://code.google.com/p/winetricks/wiki/Installing
NEVERMIND--gave up on this. Could never figure out how to install the two missing libraries in winetricks in order for WineBottler to run properly.
--ended up installing DIVA-GIS on PC for now.

Setting up data for DIVA-GIS and maxent
http://www.bioversityinternational.org/fileadmin/bioversity/publications/pdfs/1431_Training_manual_on_spatial_analysis_of_plant_diversity_and_distribution.final.pdf

------------------------------------------
Running this in R.

Import data point

file name: "C:/PROGRA~1/R/R-211~1.1/library/dismo/ex/garrulax_chinensis_all.csv"

#plot map of SE asia
plot(wrld_simpl, xlim=c(80-110), ylim=c(-20,30) axes=TRUE,col='light yellow')


------------------------------------------
What I want my paper to be like:
http://www.plosone.org/article/info%3Adoi%2F10.1371%2Fjournal.pone.0009612
and maybe this:
http://phylodiversity.net/fslik/index_files/BiolCon2012.pdf

Wednesday, January 9, 2013

Ran MAXENT for 6 species (see file Babblers_AllMuseumDistribution.xlsx):
G. leucolophus, G. chinensis, A. peracensis, P. albiventre, P. ruficollis, and P. flaviscapis

1) Convert .xls file to .csv file with three columns for each species--species name, longitude, latitude

2) Add .csv file to MAXENT

3) Also add 19 BIOCLIM variables. Need to figure out how I had put them in the correct format--something to do with DIVA-GIS.

Output was interesting results. Probably meaningless until BIOCLIM variables are correlated.

Tomorrow (Thursday, 10 Jan):

  • Correlate the BIOCLIM variables and rerun MAXENT
  • Load layers into qGIS
  • Download and add land use data