loglikCUSH: Log-likelihood function for CUSH models

Description Usage Arguments Details See Also Examples

View source: R/loglikCUSH.R

Description

Compute the log-likelihood function for CUSH models with or without covariates to explain the shelter effect.

Usage

1
loglikCUSH(ordinal,m,param,shelter,X=0)

Arguments

ordinal

Vector of ordinal responses

m

Number of ordinal categories

param

Vector of parameters for the specified CUSH model

shelter

Category corresponding to the shelter choice

X

Matrix of selected covariates to explain the shelter effect (default: no covariate is included in the model)

Details

If no covariate is included in the model, then param is the estimate of the shelter parameter (delta), otherwise param has length equal to NCOL(X) + 1 to account for an intercept term (first entry). No missing value should be present neither for ordinal nor for X.

See Also

GEM, logLik

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## Log-likelihood of CUSH model without covariates
n<-300
m<-7
shelter<-2; delta<-0.4
ordinal<-simcush(n,m,delta,shelter)
loglik<-loglikCUSH(ordinal,m,param=delta,shelter)
#####################
## Log-likelihood of CUSH model with covariates
data(relgoods)
m<-10
naord<-which(is.na(relgoods$SocialNetwork))
nacov<-which(is.na(relgoods$Gender))
na<-union(nacov,naord)
ordinal<-relgoods$SocialNetwork[-na]; cov<-relgoods$Gender[-na]
omega<-c(-2.29, 0.62)
loglikcov<-loglikCUSH(ordinal,m,param=omega,shelter=1,X=cov)

CUB documentation built on March 31, 2020, 5:14 p.m.