[R] Not getting any result from 'gbm'?

David Winsemius dwinsemius at comcast.net
Sun Oct 6 00:02:16 CEST 2013


On Oct 5, 2013, at 8:37 AM, Mary Kindall wrote:

> Sorry David, 
> The formula that I use here is 
> 
> fmla = as.formula(Y ~ x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8)
> 
> Thanks 
> 
> 
> 
> 
> 
> On Sat, Oct 5, 2013 at 2:02 AM, David Winsemius <dwinsemius at comcast.net> wrote:
> 
> On Oct 3, 2013, at 3:07 PM, Mary Kindall wrote:
> 
> > In the reproducible example given below, why I am not getting any result
> > with generalized boosted model (gbm).  Other methods does show me the
> > desired result.
> > In the example data file (attached) example.txt, the predictors x3 and x4
> > are correlated with response Y.
> >
> >
> >
> > tmpData = read.table("Desktop/example.txt", sep="\t",header=TRUE)
> > head(tmpData)
> > fmla = getTheFormulaFromDataFrame(tmpData)
> 
> > fmla = getTheFormulaFromDataFrame(tmpData)
> Error: could not find function "getTheFormulaFromDataFrame"
> 
> 
> > fmla
> > gbm(fmla, distribution = "bernoulli", data = tmpData) #doesn't work

With the modifications proposed above I now get:

gbm(formula = fmla, distribution = "bernoulli", data = tmpData)
A gradient boosted model with bernoulli loss function.
100 iterations were performed.
There were 8 predictors of which 1 had non-zero influence.

So you need to do as suggested by the Posting Guide and report what sessionInfo() returns.

-- 
David.
> >
> > #All the following works
> > bagging(fmla,  data=tmpData, control=control, coob=TRUE)
> > rpart(fmla,  dat=tmpData, method = "class", control=control )
> > glm(fmla, family="binomial", data = tmpData)
> >
> >
> > Thanks
> >
> >
> >
> > --
> > -------------
> > Mary Kindall
> > Yorktown Heights, NY
> > USA
> > <example.txt>______________________________________________
> > R-help at r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> 
> David Winsemius
> Alameda, CA, USA
> 
> 
> 
> 
> -- 
> -------------
> Mary Kindall 
> Yorktown Heights, NY
> USA

David Winsemius
Alameda, CA, USA



More information about the R-help mailing list