[Biomod-commits] Projection.raster error?

jason b mackenzie jasonbmackenzie at gmail.com
Wed Feb 8 02:03:34 CET 2012


I am getting an error (below) using the Projection.raster function. 

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 5711 rows but variable(s) found have 1131 rows

I thought part of the problem might relate to differences in the naming of my explanatory variables, but they appear to be the same in both my presence-absence site data (='SP.ENV') and my RasterStack (='CurrentStack').

> colnames(SP.ENV[,4:11])
[1] "bio_1"      "bio_3"      "bio_4"      "bio_5"      "bio_12"     "bio_14"     "bio_15"     "soil_aws"
> layerNames(CurrentStack)
[1] "bio_1"      "bio_3"      "bio_4"      "bio_5"      "bio_12"     "bio_14"     "bio_15"     "soil_aws"

Also, the row flags noted in the warning message don't correspond with dimensions of either dataset?

> dim(SP.ENV)
[1] 1742   75
> dim(CurrentStack)
[1] 232 238   8

Any suggestions? FYI, I am running the latest versions of R (2.14.1) and BIOMOD (1.1.7) and my calls are pasted below.



Jason MacKenzie, PhD
Senior Conservation Fellow
The Nature Conservancy
201 Mission Street, 4th Floor
San Francisco, CA 94105
jmackenzie at tnc.org
jasonbmackenzie        [skype]


SP.ENV <- read.table("SPENV_veg4.txt",  h=T, sep="\t")
COORxy <- read.table("CoorXY_veg4.txt", h=T, sep="\t")

Initial.State(Response=SP.ENV[,12:13], Explanatory=SP.ENV[,4:11], IndependentResponse=NULL, IndependentExplanatory=NULL)
Models(GLM=F, TypeGLM="quad", Test="AIC", GAM=T, Spline=4, GBM=T, No.trees=3000, CTA=T, CV.tree=50, ANN=T, CV.ann=3, 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=2, strategy="sre", nb.absences=1000)

CurrentPred(GLM=F, GAM=T, GBM=T, CTA=T, ANN=T, SRE=T, FDA=T, MARS=T, RF=T, BinRoc=T,  BinKappa=T,  BinTSS=T, FiltRoc=T, FiltKappa=T, FiltTSS=T) 
PredictionBestModel(method='all', Bin.trans=T, Filt.trans=T)	
files <- list.files("~/Documents/R/R_data/SD/raster/current", pattern='asc', full.names=T)
CurrentStack <- stack(files[c(1,13,14,15,4,6,7,20)])

Projection.raster(RasterProj = CurrentStack, Proj.name='CurrentRaster', GLM=F, GAM=T, GBM=T, CTA=T, ANN=T, SRE=T, quant=0.025, FDA=T, MARS=T, RF=T, BinRoc=T, BinKappa=T, BinTSS=T, FiltRoc=T, FiltKappa=T, FiltTSS=T, repetition.model=T, stack.out=T, compress="gzip")

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/biomod-commits/attachments/20120208/3f60d494/attachment.html>

More information about the Biomod-commits mailing list