Revision 046c9d496594d3f75d377aa6370e7c5a15bf7d64 authored by Patrick Mair on 03 March 2020, 15:33:57 UTC, committed by cran-robot on 03 March 2020, 15:33:57 UTC
1 parent 6d8426a
plist.internal.R
# computes a list of expected probabilities for objects of class Rm
# with 0th category included!
plist.internal <- function(object, theta){
X <- object$X
mt_vek <- apply(X, 2L, max, na.rm = TRUE) # number of categories - 1 for each item
mt_ind <- rep(seq_along(mt_vek), mt_vek)
#--------compute list matrix of probabilites for fixed theta)
p.list <- tapply(object$betapar, mt_ind, function(beta.i){
beta.i <- c(0, beta.i)
ind.h <- 0:(length(beta.i)-1)
theta.h <- tcrossprod(ind.h, theta) # ind.h %*% t(theta) # multiply category with
tb <- exp(theta.h + beta.i)
denom <- colSums(tb)
pi.mat <- apply(tb, 1L, function(y){ y/denom })
return(pi.mat)
})
return(p.list)
}
Computing file changes ...