This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Arguments: | |
# - model = a clmm model | |
# - modelAvg = a clmm model average (object of class averaging) | |
# - newdata = a dataframe of new data to apply the model to | |
# Returns a dataframe of predicted probabilities for each row and response level | |
fake.predict.clmm <- function(modelAvg, newdata) { | |
# Actual prediction function | |
pred <- function(eta, theta, cat = 1:(length(theta) + 1), inv.link = plogis) { | |
Theta <- c(-1000, theta, 1000) | |
sapply(cat, function(j) inv.link(Theta[j + 1] - eta) - inv.link(Theta[j] - eta)) |