title: R AUC with ROCR from Biomod2
body: <p>I have to get AUC (area under the ROC curve) to evaluate my models.
  I am using the SRE model with Biomod2 package.</p>
  
  <p>Biomod2 gives me AUC value through <em>evaluate()</em> function which is nice. Then I tried to check AUC with ROCR package, and I got a big problem : AUC values from evaluate() (Biomod2) and ROCR weren't the same.
  (For some other models not implemented on Biomod2, I have to use ROCR package so that's why I am anxious.)</p>
  
  <p>Now I am trying to find the problem using a reproducible example (code from Biomod2 package), but I get an error.</p>
  
  <p>First, the code from Biomod2 package (reproducible example):</p>
  
  <pre><code>     library(biomod2)
       library(ROCR)
  
       # species occurrences
       DataSpecies &lt;- read.csv(system.file("external/species/mammals_table.csv",
                                  package="biomod2"), row.names = 1)
       head(DataSpecies)
  
       # the name of studied species
       myRespName &lt;- 'GuloGulo'
  
       # the presence/absences data for our species 
       myResp &lt;- as.numeric(DataSpecies[,myRespName])
  
       # the XY coordinates of species data
       myRespXY &lt;- DataSpecies[,c("X_WGS84","Y_WGS84")]
  
  
       # Environmental variables extracted from BIOCLIM (bio_3, bio_4,     bio_7, bio_11 &amp; bio_12)
       myExpl = stack( system.file( "external/bioclim/current/bio3.grd", 
                           package="biomod2"),
              system.file( "external/bioclim/current/bio4.grd", 
                           package="biomod2"), 
              system.file( "external/bioclim/current/bio7.grd", 
                           package="biomod2"),  
              system.file( "external/bioclim/current/bio11.grd", 
                           package="biomod2"), 
              system.file( "external/bioclim/current/bio12.grd", 
                           package="biomod2"))
  
       # 1. Formatting Data
       myBiomodData &lt;- BIOMOD_FormatingData(resp.var = myResp,
                                   expl.var = myExpl,
                                   resp.xy = myRespXY,
                                   resp.name = myRespName)
  
       # 2. Defining Models Options using default options.
       myBiomodOption &lt;- BIOMOD_ModelingOptions()
  
       # 3. Doing Modelisation
  
       myBiomodModelOut &lt;- BIOMOD_Modeling( myBiomodData, 
                                   models = c('SRE'), 
                                   models.options = myBiomodOption, 
                                   NbRunEval=1, 
                                   DataSplit=80, 
                                   Yweights=NULL, 
                                   VarImport=3, 
                                   models.eval.meth = c('TSS'),
                                   SaveObj = TRUE,
                                   rescal.all.models = FALSE,
                                   do.full.models = FALSE,
                                   modeling.id='test')
  
       # 4. Evaluate model over another dataset (here the full one)
  
       ## creation of suitable dataset
       data &lt;- cbind(GuloGulo=get_formal_data(myBiomodModelOut,'resp.var'), 
                     get_formal_data(myBiomodModelOut,'expl.var'))
  
       ## evaluation
       evaluate(myBiomodModelOut, data=data, stat=c('ROC','TSS'))
  </code></pre>
  
  <p>Then, the part to get AUC from ROCR :</p>
  
  <pre><code>    # 4.1 Projection on current environemental conditions
  
      myBiomodProjection &lt;- BIOMOD_Projection(modeling.output = myBiomodModelOut,
                                      new.env = myExpl,
                                      proj.name = 'current',
                                      selected.models = 'all',
                                      binary.meth = 'TSS',
                                      compress = FALSE,
                                      build.clamping.mask = FALSE)
  
  
      myBiomod_raster &lt;- get_predictions(myBiomodProjection) #, as.data.frame=TRUE
  
  
      spp_occ &lt;- myResp
      sauv_p &lt;- as.vector(as.matrix(myBiomod_raster))
  
      ROC_curve &lt;- data.frame(result=sauv_p, spp=spp_occ) #préparation
      ROC_curve &lt;- prediction(ROC_curve$result, ROC_curve$spp) #run
  
      AUC &lt;- performance( ROC_curve, "auc" )@y.values
      print(AUC[[1]])
  </code></pre>
  
  <p>The problem I have is I can't create a data.frame from myResp and myBiomod_raster, because <code>length(myResp)</code> = 2488 and length for myBiomod_raster is 5640.</p>
  
  <p>The error is : <em>Arguments imply differing number of rows</em></p>
  
  <p>Do you know how I could do to have the same number of rows, using the datas from this Biomod2 package example?</p>
  
  <p>Thanks a lot!</p>