R version 2.8.1 (2008-12-22) Copyright (C) 2008 The R Foundation for Statistical Computing ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. Natural language support but running in an English locale R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > # Set working directory > setwd("D:/BIOMOD/Biomod_runs") > > library(BIOMOD) Loading required package: reshape Loading required package: plyr Loading required package: ade4 Attaching package: 'ade4' The following object(s) are masked from package:base : within Loading required package: nnet Loading required package: rpart Loading required package: Hmisc Attaching package: 'Hmisc' The following object(s) are masked from package:plyr : is.discrete, summarize The following object(s) are masked from package:base : format.pval, round.POSIXt, trunc.POSIXt, units Loading required package: Design Loading required package: survival Loading required package: splines Attaching package: 'survival' The following object(s) are masked from package:Hmisc : untangle.specials Design library by Frank E Harrell Jr Type library(help='Design'), ?Overview, or ?Design.Overview') to see overall documentation. Attaching package: 'Design' The following object(s) are masked from package:survival : Surv, survfit Loading required package: MASS Loading required package: gbm Loading required package: lattice Loaded gbm 1.6-3 Loading required package: mda Loading required package: class Attaching package: 'class' The following object(s) are masked from package:reshape : condense Loading required package: randomForest randomForest 4.5-30 Type rfNews() to see new features/changes/bug fixes. Attaching package: 'randomForest' The following object(s) are masked from package:Hmisc : combine Loading required package: gam Loading required package: akima Attaching package: 'BIOMOD' The following object(s) are masked from package:rpart : printcp Warning message: package 'BIOMOD' was built under R version 2.9.1 > > # Load data > env_na <- read.table ("env_na.txt",header=TRUE,dec=".") > > # Replace some special "missing" values by NA > env_na[env_na==-3.40282346638529e+038] <- NA > env_na[env_na==-3.40e+038]<- NA > > # Discard rows containing missing values > env_na <- na.omit(env_na) > > # Extract the coordinates to coord_na > coord_na <- env_na[,2:3] > > # Let's see... > head(env_na) Idw x y loc bio2 bio4 bio8 bio10 bio15 1 1 -130.05 57.95 1097.729 120.8750 9417.417 91.95139 101.27080 37.08333 2 2 -129.95 57.95 1359.681 117.5903 9092.611 80.53472 89.25694 35.02778 3 3 -129.85 57.95 1394.458 117.1319 9094.813 79.18750 87.94444 34.61111 4 4 -129.75 57.95 1078.743 120.3264 9567.833 93.32639 102.90280 36.10417 5 5 -129.65 57.95 1009.764 120.4236 9707.785 96.46528 106.45140 35.95139 6 6 -129.55 57.95 1105.375 119.2431 9624.973 92.52084 102.25000 35.11806 bio16 bio17 bio18 bio19 species 1 159.7014 52.96528 32.69835 0.5971074 0 2 168.9375 61.35417 39.14463 0.7975206 0 3 170.5625 62.90972 35.75413 0.2665289 0 4 163.1042 56.11806 55.30165 12.4318199 0 5 162.5208 56.35417 60.25000 9.9235535 0 6 165.3819 59.09722 61.66116 6.6363640 0 > dim(env_na) [1] 176456 14 > # ... okay, looks fine. > > # Initialise > Initial.State (Response = env_na[, c(14)], sp.name = "Species1", + Explanatory = env_na[,4:13], IndependentResponse = NULL, + IndependentExplanatory = NULL) > > # View data > str(DataBIOMOD) 'data.frame': 176456 obs. of 11 variables: $ loc : num 1098 1360 1394 1079 1010 ... $ bio2 : num 121 118 117 120 120 ... $ bio4 : num 9417 9093 9095 9568 9708 ... $ bio8 : num 92 80.5 79.2 93.3 96.5 ... $ bio10 : num 101.3 89.3 87.9 102.9 106.5 ... $ bio15 : num 37.1 35 34.6 36.1 36 ... $ bio16 : num 160 169 171 163 163 ... $ bio17 : num 53 61.4 62.9 56.1 56.4 ... $ bio18 : num 32.7 39.1 35.8 55.3 60.2 ... $ bio19 : num 0.597 0.798 0.267 12.432 9.924 ... $ Species1: int 0 0 0 0 0 0 0 0 0 0 ... > > # Run a model > Models(GLM = TRUE, TypeGLM = "quad", Test = "AIC", + GBM = TRUE, No.trees = 3000, + GAM = TRUE, + CTA = TRUE, CV.tree = 50, + ANN = TRUE, CV.ann = 2, + SRE = TRUE, Perc025=TRUE, Perc05=FALSE, + MDA = TRUE, + MARS = TRUE, + RF = TRUE, + NbRunEval = 2, DataSplit = 80, + Yweights=NULL, Roc=TRUE, Optimized.Threshold.Roc=TRUE, + Kappa=TRUE, TSS=TRUE, KeepPredIndependent = FALSE, VarImport=5, + NbRepPA=2, strategy="circles", coor=coord_na, distance=2, + nb.absences=1000) ##### Species1 ##### ##### pseudo-absence run 1 ##### Model=Artificial Neural Network 2 Fold Cross Validation + 3 Repetitions Calibration and evaluation phase: Nb of cross-validations: 2 Evaluating Predictor Contributions in ANN ... Model=Classification tree 50 Fold Cross-Validation Evaluating Predictor Contributions in CTA ... Model=GAM spline 3 Degrees of smoothing Evaluating Predictor Contributions in GAM ... Model=Generalised Boosting Regression 3000 maximum different trees and lambda Fold Cross-Validation Evaluating Predictor Contributions in GBM ... Model=GLM quadratic Stepwise procedure using AIC criteria Evaluating Predictor Contributions in GLM ... Model=Multiple Adaptive Regression Splines Evaluating Predictor Contributions in MARS ... Model=Mixture Discriminant Analysis Evaluating Predictor Contributions in MDA ... Model=Breiman and Cutler's random forests for classification and regression Evaluating Predictor Contributions in RF ... Model=Surface Range Envelop Evaluating Predictor Contributions in SRE ... ##### pseudo-absence run 2 ##### Model=Artificial Neural Network 2 Fold Cross Validation + 3 Repetitions Calibration and evaluation phase: Nb of cross-validations: 2 Evaluating Predictor Contributions in ANN ... Model=Classification tree 50 Fold Cross-Validation Evaluating Predictor Contributions in CTA ... Model=GAM spline 3 Degrees of smoothing Evaluating Predictor Contributions in GAM ... Model=Generalised Boosting Regression 3000 maximum different trees and lambda Fold Cross-Validation Evaluating Predictor Contributions in GBM ... Model=GLM quadratic Stepwise procedure using AIC criteria Evaluating Predictor Contributions in GLM ... Model=Multiple Adaptive Regression Splines Evaluating Predictor Contributions in MARS ... Model=Mixture Discriminant Analysis Evaluating Predictor Contributions in MDA ... Model=Breiman and Cutler's random forests for classification and regression Evaluating Predictor Contributions in RF ... Model=Surface Range Envelop Evaluating Predictor Contributions in SRE ... There were 50 or more warnings (use warnings() to see the first 50) > > load("pred/Pred_Species1") > dim(Pred_Species1) [1] 2953 9 3 2 > dim(env_na) [1] 176456 14 > # ? > > level.plot(Pred_Species1[,"GLM",2,1], coord_na, show.scale=FALSE, title="probabilities by GLM") Error in level.plot(Pred_Species1[, "GLM", 2, 1], coord_na, show.scale = FALSE, : data and coordinates should be of the same length > > # Help?!