Compute the log-likelihood function for CUBE models. It is possible to include covariates in the model for explaining the feeling component or all the three parameters.
loglikCUBE(ordinal,m,param,Y=0,W=0,Z=0)
Arguments
ordinal: Vector of ordinal responses
m: Number of ordinal categories
param: Vector of parameters for the specified CUBE model
Y: Matrix of selected covariates to explain the uncertainty component (default: no covariate is included in the model)
W: Matrix of selected covariates to explain the feeling component (default: no covariate is included in the model)
Z: Matrix of selected covariates to explain the overdispersion component (default: no covariate is included in the model)
Details
If no covariate is included in the model, then param has the form (π,ξ,ϕ). More generally, it has the form (β,γ,α) where, respectively, β,γ, α
are the vectors of coefficients explaining the uncertainty, the feeling and the overdispersion components, with length NCOL(Y)+1, NCOL(W)+1, NCOL(Z)+1 to account for an intercept term in the first entry. No missing value should be present neither for ordinal nor for covariate matrices: thus, deletion or imputation procedures should be preliminarily run.
Examples
#### Log-likelihood of a CUBE model with no covariatem<-7; n<-400pai<-0.83; csi<-0.19; phi<-0.045ordinal<-simcube(n,m,pai,csi,phi)loglik<-loglikCUBE(ordinal,m,param=c(pai,csi,phi))###################################### Log-likelihood of a CUBE model with covariate for feelingdata(relgoods)m<-10nacov<-which(is.na(relgoods$BirthYear))naord<-which(is.na(relgoods$Tv))na<-union(nacov,naord)age<-2014-relgoods$BirthYear[-na]lage<-log(age)-mean(log(age))ordinal<-relgoods$Tv[-na]; W<-lage
pai<-0.63; gama<-c(-0.61,-0.31); phi<-0.16param<-c(pai,gama,phi)loglik<-loglikCUBE(ordinal,m,param,W=W)########## Log-likelihood of a CUBE model with covariates for all parametersY<-W<-Z<-lage
bet<-c(0.18,1.03); gama<-c(-0.6,-0.3); alpha<-c(-2.3,0.92)param<-c(bet,gama,alpha)loglik<-loglikCUBE(ordinal,m,param,Y=Y,W=W,Z=Z)