Nothing
#' @title Log-likelihood function for a CUSH model with covariates
#' @aliases loglikcushcov
#' @description Compute the log-likelihood function for a CUSH model
#' with covariates for the given ordinal responses.
#' @usage loglikcushcov(m, ordinal, X, omega, shelter)
#' @param m Number of ordinal categories
#' @param ordinal Vector of ordinal responses
#' @param X Matrix of selected covariates for explaining the shelter parameter
#' @param omega Vector of parameters for explaining the shelter effect,
#' with length equal to NCOL(X)+1 to account for an intercept term (first entry of omega)
#' @param shelter Category corresponding to the shelter choice
#' @keywords internal
#'
loglikcushcov <-function(m,ordinal,X,omega,shelter){
if (is.factor(ordinal)){
ordinal<-unclass(ordinal)
}
X<-as.matrix(X)
deltavett<-logis(X,omega)
dummy<-ifelse(ordinal==shelter,1,0)
probi<-deltavett*(dummy-1/m)+1/m
return(sum(log(probi)))
}
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.