loglikCUBE {CUB}R Documentation

Log-likelihood function for CUBE models

Description

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.

Usage

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 (\pi,\xi,\phi). More generally, it has the form (\bold{\beta,\gamma,\alpha)} where, respectively, \bold{\beta},\bold{\gamma}, \bold{\alpha} 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.

See Also

logLik

Examples

#### Log-likelihood of a CUBE model with no covariate
m<-7; n<-400
pai<-0.83; csi<-0.19; phi<-0.045
ordinal<-simcube(n,m,pai,csi,phi)
loglik<-loglikCUBE(ordinal,m,param=c(pai,csi,phi))
##################################
#### Log-likelihood of a CUBE model with covariate for feeling
data(relgoods)
m<-10
nacov<-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.16
param<-c(pai,gama,phi)
loglik<-loglikCUBE(ordinal,m,param,W=W)
########## Log-likelihood of a CUBE model with covariates for all parameters
Y<-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)

[Package CUB version 1.1.5 Index]