Learn R Programming

CUB (version 0.1)

IHG: Main function for IHG models

Description

Main function to estimate and validate an Inverse Hypergeometric model, without or with covariates for explaining the preference parameter.

Usage

IHG(ordinal, m=get('m',envir=.GlobalEnv), U = 0, makeplot = TRUE, summary = TRUE)

Arguments

ordinal
Vector of ordinal responses
m
Number of ordinal categories (if omitted, it will be assigned to the number of categories specified in the global environment)
U
Matrix of covariates for explaining the preference parameter. If omitted (default), no covariate is included in the model
makeplot
Logical: if TRUE (default), the algorithm returns a graphical plot comparing fitted probabilities and observed relative frequencies for IHG models without covariates. If only one explicative dichotomous variable is included in the model, then the function returns a graphical plot comparing the distributions of the responses conditioned to the value of the covariate
summary
Logical: if TRUE (default), summary results of the fitting procedure are displayed on screen

Value

An object of the class "IHG" is a list containing the following results:
estimates
Maximum likelihood parameters estimates
loglik
Log-likelihood function at the final estimates
varmat
Variance-covariance matrix of final estimates. If no covariate is included in the model, it returns the square of the estimated standard error for the preference parameter $\theta$
BIC
BIC index for the estimated model

Details

This is the main function for IHG models (that are nested into CUBE models, see the references below), calling for the corresponding function whenever covariates are specified. The parameter $\theta$ represents the probability of observing a rating corresponding to the first category and is therefore a direct measure of preference, attraction, pleasantness toward the investigated item. This is reason why $\theta$ is customarily referred to as the preference parameter of the IHG model. The estimation procedure is not iterative, so a null result for IHG$niter is produced. The optimization procedure is run via "optim". The variance-covariance matrix (or the estimated standard error for theta if no covariate is included) is computed as the inverse of the returned numerically differentiated Hessian matrix (option: hessian=TRUE as argument for optim). If not positive definite, it returns a warning message and produces a matrix with NA entries.

References

D'Elia A. (2003). Modelling ranks using the inverse hypergeometric distribution, Statistical Modelling: an International Journal, 3, 65--78 Iannario M. (2012). CUBE models for interpreting ordered categorical data with overdispersion, Quaderni di Statistica, 14, 137--140

See Also

probihg, iniihg, loglikIHG

Examples

Run this code

data(relgoods)
m<-10
ordinal<-na.omit(relgoods[,41]) 
model<-IHG(ordinal,summary=TRUE)
theta<-model$estimates      # ML estimates for the preference parameter theta
maxlik<-model$loglik
sqerrst<-model$varmat         # Squared standard error of theta
BICIHG<-model$BIC
#################################
ordinal<-relgoods[,41]
gender<-relgoods[,9]
data<-na.omit(cbind(ordinal,gender))
modelcov<-IHG(data[,1],U=data[,2],summary=TRUE)
omega<-modelcov$estimates     #  ML estimates (intercept term: omega[1])
maxlik<-modelcov$loglik
varmat<-modelcov$varmat
BICcov<-modelcov$BIC

Run the code above in your browser using DataLab