library("PlackettLuce")
source("https://raw.githubusercontent.com/AgrDataSci/ClimMob-analysis/master/R/functions.R")
R <- matrix(c(1, 2, 0, 0, 3,
4, 1, 0, 0, 2,
2, 1, 0, 0, 3,
1, 2, 0, 4, 3,
2, 1, 0, 3, 4,
4, 1, 0, 0, 2,
2, 1, 0, 0, 3,
1, 2, 0, 1, 3,
2, 0, 0, 0, 1,
0, 0, 0, 1, 2), nrow = 10, byrow = TRUE)
colnames(R) <- c("apple", "banana", "orange", "pear", "grape")
R <- as.rankings(R)
# take rows 9 and 10 supposing that it belongs to a different fold in a
# cross-validation
R <- R[-c(9:10), ]
G <- group(R, index = 1:length(R))
p <- data.frame(p = rep(1, length(G)))
dt <- cbind(G, p)
pl <- pltree(G ~ p, data = dt)
# it does not work as shown in issue #25
predict(pl, newdata = dt)
AIC(pl, newdata = dt)
# but works with vcov = FALSE for predict()
predict(pl, newdata = dt, vcov = FALSE)
# and still dont work for AIC
AIC(pl, newdata = dt, vcov = FALSE)
# this because orange got off of the network when we sampled the folds
a <- adjacency(R)
plot(network(a))
# the issue still persists even if we increase npseudo
pl2 <- pltree(G ~ p, data = dt, npseudo = 0.8)
The question is, do you think that this problem can be solved with npseudo (eventually) or should we deal with it by passing vcov = FALSE to the predict() method?
Dear Heather,
Here comes an issue that may be related to issue #25. But now I think we have a better clue on where is the problem, which arrises mostly when we are performing cross-validations and pltree() is exposed to a set of data with a weak network.
Here is an example
The question is, do you think that this problem can be solved with npseudo (eventually) or should we deal with it by passing vcov = FALSE to the predict() method?
Thanks in advance