casallas / ordinal

git mirror of Rune Haubo Christensen's ordinal package (https://r-forge.r-project.org/scm/viewvc.php/pkg/ordinal/?root=ordinal)
Other
0 stars 0 forks source link

clm2.predict doesn't work with nominal values #2

Closed casallas closed 9 years ago

casallas commented 9 years ago

Running the example from the doc:

options(contrasts = c("contr.treatment", "contr.poly"))

## More manageable data set for less voluminous printing:
(tab26 <- with(soup, table("Product" = PROD, "Response" = SURENESS)))
dimnames(tab26)[[2]] <- c("Sure", "Not Sure", "Guess", "Guess", "Not Sure", "Sure")
dat26 <- expand.grid(sureness = as.factor(1:6), prod = c("Ref", "Test"))
dat26$wghts <- c(t(tab26))
dat26

mN1 <-  clm2(sureness ~ 1, nominal = ~prod, data = dat26,
            weights = wghts)
predict(mN1)

yields

Error in model.frame.default(Terms, newdata, na.action = function(x) x) : 
  object is not a matrix
In addition: Warning message:
'newdata' had 72 rows but variable found had 1 row

This only affects the predict branch, not the master