Robert, sorry. Yes, myData is my gbm object. Also, I figured out what I had done wrong. The raster stack I created specified a data set name that was lowercase and the the gbm model was specifying upper case for the same raster layer. Once I use the correct name, it worked.
Thank you for the response. Mike --- On Thu, 11/4/10, Robert J. Hijmans <r.hijm...@gmail.com> wrote: > From: Robert J. Hijmans <r.hijm...@gmail.com> > Subject: Re: [R-sig-Geo] raster package and predict for GBM models > To: "Michael ODonnell" <odonn...@yahoo.com> > Cc: r-sig-geo@stat.math.ethz.ch > Date: Thursday, November 4, 2010, 10:58 AM > Hi Mike, > > I cannot know from what you send, but the second argument > should be > your gbm object, and from your name "myData" I am guessing > it is not > (unless it really is referring to youModel). > One of the two vignettes of the 'dismo' package is about > 'gbm' > (boosted regression trees) and 'raster' . So in principle > it should > work. > > Robert > > > On Thu, Nov 4, 2010 at 7:34 AM, Michael ODonnell <odonn...@yahoo.com> > wrote: > > Hello, > > > > I have little experience using the raster package and > I am currently trying to develop a predicted surface based > on a gradient boosted model (gbm package). > > > > The basic steps I am using include the following: > > > > # Creating a raster stack of independent variables > > USHGT <- raster("ushgt.asc", package="raster") > > ... (other variables omitted for post) > > ras_stk <- stack(USHGT, HYELB, T1TO5LE, URBD_D, > SG_UNIT, MINTEMP, ANNPCP, TC_B04, TC_B07) > > > > # Create the prediction model > > ... I am using a separate script that creates the gbm > object and due to the length I will not include. The outcome > is a gbm object. > > > > .. Now I use the following, which fails: > > r <- predict(ras_stk, myData, filename=OutFile, > na.rm=TRUE, overwrite=TRUE, n.trees=myData$n.trees, > type="response", progress="window") > > > > Error: > > Error in > model.frame.default(terms(reformulate(object$var.names)), > newdata, :object is not a matrix > > > > The raster package manual states that the predict > function will work on any model that a predict method has > been implemented. > > > > Does anyone have experience with this or possibly an > idea on how I might solve the issue. > > > > Thank you, > > mike > > > > _______________________________________________ > > R-sig-Geo mailing list > > R-sig-Geo@stat.math.ethz.ch > > https://stat.ethz.ch/mailman/listinfo/r-sig-geo > > > _______________________________________________ R-sig-Geo mailing list R-sig-Geo@stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-geo