I am trying to use bagging like this:
> bag.model <- bagging(as.factor(nextDay) ~ ., data = spi[1:1250,])
> pred = predict(bag.model, spi[1251:13500,-9])
There were 25 warnings (use warnings() to see them)> t = table(pred, spi[1251:13500,9])
> t
pred 0 1
0 42 40
1 12 22> classAgreement(t)
but I get the warning.
The warnings run like this:
> warnings()
Warning messages:
1: number of rows of result
is not a multiple of vector length (arg 2) in: cbind(1, 1:N,
predict(object$mtrees[[i]], newdata, type = "class"))
2: number of rows of result
is not a multiple of vector length (arg 2) in: cbind(1, 1:N,
predict(object$mtrees[[i]], newdata, type = "class"))
3: number of rows of result
is not a multiple of vector length (arg 2) in: cbind(1, 1:N,
predict(object$mtrees[[i]], newdata, type = "class"))
4: number of rows of result
is not a multiple of vector length (arg 2) in: cbind(1, 1:N,
predict(object$mtrees[[i]], newdata, type = "class"))
5: number of rows of result
is not a multiple of vector length (arg 2) in: cbind(1, 1:N,
predict(object$mtrees[[i]], newdata, type = "class"))
6: number of rows of result
is not a multiple of vector length (arg 2) in: cbind(1, 1:N,
predict(object$mtrees[[i]], newdata, type = "class"))
7: number of rows of result
is not a multiple of vector length (arg 2) in: cbind(1, 1:N,
predict(object$mtrees[[i]], newdata, type = "class"))
8: number of rows of result
is not a multiple of vector length (arg 2) in: cbind(1, 1:N,
predict(object$mtrees[[i]], newdata, type = "class"))
9: number of rows of result
is not a multiple of vector length (arg 2) in: cbind(1, 1:N,
predict(object$mtrees[[i]], newdata, type = "class"))
10: number of rows of result
is not a multiple of vector length (arg 2) in: cbind(1, 1:N,
predict(object$mtrees[[i]], newdata, type = "class"))
11: number of rows of result
is not a multiple of vector length (arg 2) in: cbind(1, 1:N,
predict(object$mtrees[[i]], newdata, type = "class"))
12: number of rows of result
is not a multiple of vector length (arg 2) in: cbind(1, 1:N,
predict(object$mtrees[[i]], newdata, type = "class"))
13: number of rows of result
is not a multiple of vector length (arg 2) in: cbind(1, 1:N,
predict(object$mtrees[[i]], newdata, type = "class"))
14: number of rows of result
is not a multiple of vector length (arg 2) in: cbind(1, 1:N,
predict(object$mtrees[[i]], newdata, type = "class"))
15: number of rows of result
is not a multiple of vector length (arg 2) in: cbind(1, 1:N,
predict(object$mtrees[[i]], newdata, type = "class"))
16: number of rows of result
is not a multiple of vector length (arg 2) in: cbind(1, 1:N,
predict(object$mtrees[[i]], newdata, type = "class"))
17: number of rows of result
is not a multiple of vector length (arg 2) in: cbind(1, 1:N,
predict(object$mtrees[[i]], newdata, type = "class"))
18: number of rows of result
is not a multiple of vector length (arg 2) in: cbind(1, 1:N,
predict(object$mtrees[[i]], newdata, type = "class"))
19: number of rows of result
is not a multiple of vector length (arg 2) in: cbind(1, 1:N,
predict(object$mtrees[[i]], newdata, type = "class"))
20: number of rows of result
is not a multiple of vector length (arg 2) in: cbind(1, 1:N,
predict(object$mtrees[[i]], newdata, type = "class"))
21: number of rows of result
is not a multiple of vector length (arg 2) in: cbind(1, 1:N,
predict(object$mtrees[[i]], newdata, type = "class"))
22: number of rows of result
is not a multiple of vector length (arg 2) in: cbind(1, 1:N,
predict(object$mtrees[[i]], newdata, type = "class"))
23: number of rows of result
is not a multiple of vector length (arg 2) in: cbind(1, 1:N,
predict(object$mtrees[[i]], newdata, type = "class"))
24: number of rows of result
is not a multiple of vector length (arg 2) in: cbind(1, 1:N,
predict(object$mtrees[[i]], newdata, type = "class"))
25: number of rows of result
is not a multiple of vector length (arg 2) in: cbind(1, 1:N,
predict(object$mtrees[[i]], newdata, type = "class"))
>
Can anyone tell me what is going wrong?
Stephen
[[alternative HTML version deleted]]