[Biomod-commits] error in projections

Raquel A. Garcia raquel.garcia at mncn.csic.es
Thu Jul 7 11:29:46 CEST 2011



Hi, 

I'm getting this error message when I run my projections on future climate data: 

In predict.lm(object, newdata, se.fit, scale = 1, type = ifelse(type ==  ... :
  prediction from a rank-deficient fit may be misleading 

I wonder if anyone can help?  I paste my code below. 

Many thanks, 

Raquel  

### CALIBRATION AND VALIDATION ############################## 

path <- "C:/Raquel_Garcia/fourthRun"
taxa <- c("frogs","snakes","mammals","birds") 
library(BIOMOD)
source("C:/Raquel_Garcia/ModelsH.r")
source("C:/Raquel_Garcia/thirdRun/Ensemble.Forecasting.r")
clim <- c("clust1_4160a2",  "clust2_4160a2",  "clust3_4160a2",  "clust1_4160a1b",
"clust2_4160a1b", "clust3_4160a1b", "clust1_4160b1",  "clust2_4160b1", 
"clust3_4160b1",  "clust1_8100a2",  "clust2_8100a2",  "clust3_8100a2", 
"clust1_8100a1b", "clust2_8100a1b", "clust3_8100a1b", "clust1_8100b1", 
"clust2_8100b1",  "clust3_8100b1")

for (tx in 1:4)
  {
#dir.create(paste(path, taxa[tx], sep="/"))
taxapath <- paste(path, taxa[tx],sep="/")

### CALIBRATION ################################################################
setwd(paste(path,"Data",sep="/")) 
species<-read.table(paste(taxa[tx],"_1851cells_spp15.txt",sep=""),h=T,sep="\t")    
sppnames <- names(species)
clim6190<-get(load("var6190_1851cells_3var"))      # present climate table 
coor<-read.table(paste("coorXY_1851cells.txt",sep=""),h=T,sep="\t")               
coorXY <- coor[,2:3]

for (f in 1:length(sppnames))
  {
  dir.create(paste(taxapath, "/", sppnames[f], sep=""))
  setwd(paste(taxapath, "/", sppnames[f], sep="")) 

  Initial.State(Response=species[,f], Explanatory=clim6190[,4:6], IndependentResponse=NULL, IndependentExplanatory=NULL,sp.name=sppnames[f])
  ModelsH(GLM = T, TypeGLM = "poly", Test = "AIC", GBM = T, No.trees = 2000, GAM = T,
  Spline = 3, CTA = F, CV.tree = 50, ANN = T, CV.ann = 5, SRE = F, q=0.0025, FDA = T,
  MARS = T, RF = T, NbRunEval = 5, DataSplit = 75, Yweights=NULL, Roc = T, Optimized.Threshold.Roc = T,
  Kappa = F, TSS=T, KeepPredIndependent = F, VarImport=5, NbRepPA=2, strategy="random",
  coor=coorXY, nb.absences=1/3(dim(species)[1]))

# saving Pseudo-Absence data  
save(Biomod.PA.data, file=paste(Biomod.material$species.names, "PAdata", sep="_"))
save(Biomod.PA.sample, file=paste(Biomod.material$species.names, "PAsample", sep="_"))

### PREDICTIONS ################################################################ 
  #Predictions on the original dataset 

  CurrentPred(GLM=T, GBM=T, GAM=T, CTA=F, ANN=T, SRE=F, FDA=T, MARS=F, RF=T,
  BinRoc=T, BinKappa=F, BinTSS=T, FiltKappa=F)
  PredictionBestModel(GLM=T,GBM=T, GAM=T, CTA=F, ANN=T, FDA=T, MARS=F, RF=T, SRE=F,
  method='all', Bin.trans = T, Filt.trans = T)

# saving evaluation results 
  save(Evaluation.results.TSS,file=paste("eval.TSS","_",Biomod.material$species.names,sep=""))
  save(Evaluation.results.Roc,file=paste("eval.ROC","_",Biomod.material$species.names,sep=""))

# saving VarImportance

  save(VarImportance,file=paste("VarImportance","_",Biomod.material$species.names,sep=""))

### CURRENT PROJECTIONS #########################################################

  Projection(Proj = clim6190[,4:6], Proj.name='CurrentF',
  GLM = T, GBM = T, GAM = T, CTA = F, ANN = T, SRE = F, q=0.0025, FDA =T, MARS = T,
  RF = T, BinRoc=T, BinKappa=F, BinTSS=T, FiltRoc=T, FiltKappa=F, FiltTSS=T, repetition.models=T)
  Ensemble.Forecasting(Proj.name= "CurrentF", weight.method='TSS', PCA.median=T,
  binary=T, bin.method='TSS', Test=T, decay=1.6, repetition.models=T, final.model.out=F)

### FUTURE PROJECTIONS ######################################################### 
  for (d in 1:18)        
      {
      future <- read.table(paste(datapath, "/", clim[d], "_3var.txt", sep=""), header=T, sep="\t")
      Projection(Proj = future, Proj.name=paste(clim[d],"F",sep=""), GLM = T, GBM = T, GAM = T,
      CTA = F, ANN = T, SRE = F, q=0.0025, FDA =T, MARS = T, RF = T,
      BinRoc = T, BinKappa = F, BinTSS = T, FiltRoc = T, FiltKappa = F, FiltTSS = T,
      repetition.models=T)
      ProjectionBestModel(Proj.name=paste(clim[d],"F",sep=""), Bin.trans=T, Filt.trans=T, method='all') 

### ENSEMBLE FORECASTING (SDMs) ################################################ 
      Ensemble.Forecasting(Proj.name= paste(clim[d],"F",sep=""), weight.method='TSS', PCA.median=T,
      binary=T, bin.method='TSS', Test=T, decay=1.6, repetition.models=T, final.model.out=F)
      }

### CLEANING UP ################################################################ 

# saving workspace 
save.image(file=paste(sppnames[f],"_workspace.RData",sep="")) 

# remove objects not needed 
  t= c("path", "taxapath", "datapath", "sppnames", "varlist", "species", "clim6190", "coorXY", "ModelsH", "Ensemble.Forecasting")      
  Rem = ls()
  rm(list=(Rem[is.na(match(Rem, t))]))

  }
}   

................
Raquel A. Garcia
Integrative Biology and Global Change Group
www.ibiochange.mncn.csic.es
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/biomod-commits/attachments/20110707/b5c700b7/attachment.htm>


More information about the Biomod-commits mailing list