[Biomod-commits] Models(...) output shorter than my data

Wilfried Thuiller wilfried.thuiller at ujf-grenoble.fr
Tue Aug 11 15:35:49 CEST 2009

Dear Dirk,

Please use the latest version of BIOMOD and R.

I run the example from ?Models with 2 runs of PA. I did not get the same 
dimensions between Sp.Env and the predictions using PA

 > load("pred/Pred_Sp290")
 > dim(Pred_Sp290)
[1] 1773    9    3    1
 > dim(Sp.Env)
[1] 2264   18

As you spotted this is obviously logical (1000 absences + 773 
presences). Perhaps you have run an example without pseudo-absence 
(NbRepPA=0). In that case, your absences are true absences, you do not 
need to use the PA selection. Then, the predictions will be done on the 
overall data. The predictions will have the same number of rows than the 
initial data.

However, you can still use the "level.plot" function even in the case of 
pseudo-absence selection.
If you type "ls", you should see that a list called "Biomod.PA.sample" 
is present in your RData. This list contains the samples (row indices) 
which have been used for each run for each species.

For instance, if you want the rows used for the first species and the 
first PA run: Biomod.PA.sample$Sp290$PA1

In the BIOMOD example that I run, I used the following. It works well.

level.plot(Pred_Sp290[,"GLM",2,1], CoorXY[Biomod.PA.sample$Sp290$PA1,] , 
show.scale=FALSE, title="probabilities by GLM")

In your example, try this the following. It should work.

coord_na[Biomod.PA.sample$Species1$PA1,], show.scale=FALSE, 
title="probabilities by GLM")

Finally concerning the fact that it is recommended to add the name of a 
species when you model only one species. It is simply a matter of how R 
names vector and matrix. When you pass one species (ex: Sp.Env[, 15] or 
Sp.Env$Sp290) in the Initial.State function. R converts it as a vector 
and remove the name. It is lost. Then, your output will not have the 
name, abbreviation or code of the species modelled but probably a X or 
V. In case you would like to re-run BIOMOD for another species, it will 
do the same think, and the previous outputs will be overwritten. Giving 
a name, even a fake one, ensure the outputs will not be overwritten if 
you rerun another species with another name.
When you modelled two species or more, you deal with matrices or 
dataframes which do not have this problem of column name.

Hope it helps,

Dirk Amsel a écrit :
> Dear Wilfried, hello all!
> I have worked the examples from the Help files, such as ?Models and 
> ?Projection, and they run without problems.
> However, when I apply the very same commands to my data, something 
> goes wrong.
> Essentially, after the call to Models(..., sp.name = "Species1") (btw, 
> why do I have to name a single species, when two unnamed species are 
> acceptable?), I have
> > load("pred/Pred_Species1")
> > dim(Pred_Species1)
> [1] 2953    9    3    2
> > dim(env_na) # env_na is my data matrix ("Sp.Env" in ?Models)
> [1] 176456     14
> > # ?
> where 2953 == 1953 + 1000 == number of presences + nb.absences. 
> Finally, level.plot complains about these different dimensions, 2953 
> vs. 176456. But in the example from ?Models, these dimension match.
> What is going wrong -- any ideas?
> Best regards,
> Dirk
> p.s. I have attached the full transcript of my R session
> ------------------------------------------------------------------------
> _______________________________________________
> Biomod-commits mailing list
> Biomod-commits at lists.r-forge.r-project.org
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/biomod-commits

Wilfried Thuiller
Laboratoire d'Ecologie Alpine, UMR-CNRS 5553
Université J. Fourier
BP 53, 38041 Grenoble Cedex 9, France
Tel: +33 (0)4 76 63 54 53
Fax: +33 (0)4 76 51 42 79

Email: wilfried.thuiller at ujf-grenoble.fr
Home page: http://www.will.chez-alice.fr
Website: http://www-leca.ujf-grenoble.fr/equipes/tde.htm

FP6 European MACIS project: http://www.macis-project.net
FP6 European EcoChange project: http://www.ecochange-project.eu

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.r-forge.r-project.org/pipermail/biomod-commits/attachments/20090811/48220c1b/attachment.htm 

More information about the Biomod-commits mailing list