[R] Predicting New Data -

Benjamin Hofner benjamin.hofner at fau.de
Mon Jan 7 16:44:34 CET 2013


Sorry, but your current information doesn't help to solve your problem. Not
having explicit base-learners is not the cause of your problem, especially
as for glmboost() there are no explicit base-learners. You should definitely
provide a minimal example that helps to reproduce your error/problem. 

For me, everything works as intended:

> ## load mboost
> library(mboost)
> 
> ## set up model (in analogy to ?glmboost)
> cars.gb <- glmboost(dist ~ speed, data = cars,
+                     control = boost_control(mstop = 400))
> ## without new data
> p1 <- predict(cars.gb)
> head(p1)
          [,1]
[1,] -1.849460
[2,] -1.849460
[3,]  9.947766
[4,]  9.947766
[5,] 13.880175
[6,] 17.812584
> 
> ## now with new data
> p2 <- predict(cars.gb, newdata =  cars)
> head(p2)
          [,1]
[1,] -1.849460
[2,] -1.849460
[3,]  9.947766
[4,]  9.947766
[5,] 13.880175
[6,] 17.812584
> 
> ## now with really new data
> data <- data.frame(speed = c(1:10))
> p3 <- predict(cars.gb, newdata =  data)
> p3
            [,1]
 [1,] -13.646686
 [2,]  -9.714277
 [3,]  -5.781869
 [4,]  -1.849460
 [5,]   2.082949
 [6,]   6.015358
 [7,]   9.947766
 [8,]  13.880175
 [9,]  17.812584
[10,]  21.744993


rydood wrote
> 
> Uwe Ligges-3 wrote
>> Hard to debug given we neither have the formula nor the data.
> All I can give is that the data is in the form y, x1, x2, x3,... and the
> formula is y ~ x1+x2+x3+...
> Maybe it's because I'm not explicitly specifying the base learners.





--
View this message in context: http://r.789695.n4.nabble.com/Predicting-New-Data-Error-mboost-tp4654677p4654840.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list