[Biomod-commits] errors in Projection.raster and Ensemble.Forecasting

Ernesto Salvatierra ernesto_salvatierra at rocketmail.com
Mon Jan 14 18:10:45 CET 2013


Dear Biomodellers,
I’m having problems with the Projection.raster and
Ensemble.Forescasting functions
All models seems to be ok when I run the Models
function but when I try to use de Projection.raster function some of them are
not working. Here are the errors:

ANN
Projection.raster(RasterProj = varclim,
Proj.name="Current",GLM=FALSE,GBM=FALSE,GAM=FALSE, CTA=FALSE,
ANN=TRUE, SRE=FALSE, quant=0.025,FDA=FALSE, MARS=FALSE, RF=FALSE,
BinKappa=TRUE, FiltKappa=TRUE, repetition.models=FALSE, stack.out=TRUE,
compress="xz")
Error
in model.frame.default(Terms, newdata, na.action = na.action, xlev =
object$xlevels) : 
  invalid type (list) for variable 'DataF'
In
addition: Warning message:
'newdata'
had 448486 rows but variable(s) found have 136 rows 
 
SRE
>
Projection.raster(RasterProj = varclim, Proj.name="Current",GLM=FALSE,GBM=FALSE,GAM=FALSE,
CTA=FALSE, ANN=FALSE, SRE=TRUE, quant=0.025,FDA=FALSE, MARS=FALSE, RF=FALSE,
BinKappa=TRUE, FiltKappa=TRUE, repetition.models=FALSE, stack.out=TRUE,
compress="xz")
 
Error
in subset.default(NewData, 1) : 'subset' must be logical
 
FDA
> Projection.raster(RasterProj = varclim, Proj.name="Current",GLM=FALSE,GBM=FALSE,GAM=FALSE,
CTA=FALSE, ANN=FALSE, SRE=FALSE, quant=0.025,FDA=TRUE, MARS=FALSE, RF=FALSE,
BinKappa=TRUE, FiltKappa=TRUE, repetition.models=FALSE, stack.out=TRUE,
compress="xz")
 
Error in model.frame.default(Terms, newdata, na.action =
na.action, xlev = object$xlevels) : 
  invalid type (list)
for variable 'DataF'
In addition: Warning message:
'newdata' had 448486 rows but variable(s) found have 136
rows
 
MARS
> Projection.raster(RasterProj = varclim,
Proj.name="Current",GLM=FALSE,GBM=FALSE,GAM=FALSE, CTA=FALSE,
ANN=FALSE, SRE=FALSE, quant=0.025,FDA=FALSE, MARS=TRUE, RF=FALSE,
BinKappa=TRUE, FiltKappa=TRUE, repetition.models=FALSE, stack.out=TRUE,
compress="xz")
 
Error in model.frame.default(Terms, newdata, na.action = na.action,
xlev = object$xlevels) : 
  invalid type (list)
for variable 'DataF'
In addition: Warning message:
'newdata' had 448486 rows but variable(s) found have 136
rows
 
Also, when I try to use the Ensemble.Forecasting or
Ensemble.Forecasting.raster functions with the models that worked I get these
errors
 
> Ensemble.Forecasting(Proj.name=  "Current",  weight.method='Roc', PCA.median=T,  binary=T,  bin.method='Roc', Test=F,  decay=1.6,  repetition.models=T, final.model.out=FALSE,  qual.th=0,  compress="xz")
 
Error in readChar(con, 5L, useBytes = TRUE) : cannot open
the connection
In addition: Warning message:
In readChar(con, 5L, useBytes = TRUE) :
  cannot open
compressed file 'C:/…../proj.Current/Proj_Current_spmodel', probable reason 'No
such file or directory'
 
Ensemble.Forecasting.raster(Proj.name=  "Current",  weight.method='Roc', PCA.median=T,  binary=T,  bin.method='Roc', Test=F,  decay=1.6,  repetition.models=T,
final.model.out=FALSE,  qual.th=0,  compress="xz")
 
Error in out[["thresholds"]][, (j - 1) * nbrep +
k] <- c(ths[[1]][length(ths[[1]])],  : 
  number of items to
replace is not a multiple of replacement length
 
Could anybody help on this? Thanks in advance!  Here are my
specifications of the models and data I used

Initial.State(Response  =  spmodel[8],  Explanatory  =  spmodel[,2:5],IndependentResponse  =  NULL, IndependentExplanatory  =  NULL)
Models(GLM  =  T,  TypeGLM  =  "simple",  Test  =  "AIC",  GBM  =  T,  No.trees  =  2000,  GAM  =  T,Spline  =  3,  CTA  =  T,  CV.tree  =  50,  ANN  =  T,  CV.ann  =  2,  SRE  =  T,  quant=0.025,  FDA  =  T,MARS  =  T,  RF  =  T,  NbRunEval  =  3,  DataSplit  =  70,  Yweights=NULL,  Roc  =  T,  Optimized.Threshold.Roc  =  T,Kappa  =  T,  TSS=T,  KeepPredIndependent  =  F,  VarImport=5,  NbRepPA=0,  strategy="circles",coor=Coord,  distance=2,  nb.absences=0)
CurrentPred(BinRoc=T, BinKappa=T, BinTSS=T,
FiltRoc=T, FiltKappa=T, FiltTSS=T)
>BIO1=raster("C:/…/BIO1.grd")
>
BIO4=raster("C:/… /BIO4.grd")
>
BIO12=raster("C:/… /BIO12.grd")
>
BIO15=raster("C:/…/BIO15.grd")
>
BIO1<-crop(BIO1, extent(-120,-30,-45,45))
>
BIO12<-crop(BIO12, extent(-120,-30,-45,45))
>
BIO15<-crop(BIO15, extent(-120,-30,-45,45))
>
BIO4<-crop(BIO4, extent(-120,-30,-45,45))
>
varclim=stack(BIO1,BIO4,BIO12,BIO15)
 
Projection.raster(RasterProj = varclim,
Proj.name="Current",GLM=TRUE,GBM=FALSE,GAM=FALSE, CTA=FALSE,
ANN=FALSE, SRE=FALSE, quant=0.025,FDA=FALSE, MARS=FALSE, RF=FALSE,
BinKappa=TRUE, FiltKappa=TRUE, repetition.models=TRUE, stack.out=TRUE,
compress="xz")


More information about the Biomod-commits mailing list