Learn R Programming

CUB (version 0.1)

cube000: Main function for CUBE models without covariates

Description

Estimate and validate a CUBE model without covariates.

Usage

cube000(m, ordinal, starting, maxiter, toler, makeplot, expinform, summary)

Arguments

m
Number of ordinal categories
ordinal
Vector of ordinal responses
starting
Vector of initial estimates to start the optimization algorithm, whose length equals the number of parameters of the model
maxiter
Maximum number of iterations allowed for running the optimization algorithm
toler
Fixed error tolerance for final estimates
makeplot
Logical: if TRUE, the function returns a graphical plot comparing fitted probabilities and observed relative frequencies
expinform
Logical: if TRUE, the function returns the expected variance-covariance matrix
summary
Logical: if TRUE, summary results of the fitting procedure are displayed on screen

Value

An object of the class "CUBE"

References

Iannario, M. (2014). Modelling Uncertainty and Overdispersion in Ordinal Data, Communications in Statistics - Theory and Methods, 43, 771--786 Iannario, M. (2015). Detecting latent components in ordinal data with overdispersion by means of a mixture distribution, Quality & Quantity, 49, 977--987

Examples

Run this code
### Applying donttest option since the proposed examples require long time run for check 

data(relgoods)
m=10
ordinal=na.omit(relgoods[,37])
starting = rep(0.1, 3)                              
fitcube=cube000(m, ordinal, starting, maxiter=500, toler=1e-6, makeplot=TRUE, expinform=FALSE,
        summary=T)
param=fitcube$estimates
pai=param[1]           # ML estimate for the uncertainty parameter
csi=param[2]           # ML estimate for the feeling parameter
phi=param[3]           # ML estimate for the overdispersion parameter
maxlik=fitcube$loglik 
niter=fitcube$niter
BIC=fitcube$BIC
###################
data(univer)
m=7
ordinal=univer[,8]
starting=inibestcube(m,ordinal)    
model=cube000(m,ordinal,starting,maxiter=200,toler=1e-4,makeplot=TRUE,expinform=TRUE,summary=F)
param=model$estimates   # Final ML estimates (pai,csi,phi)
maxlik=model$loglik
model$varmat
model$niter
model$BIC

Run the code above in your browser using DataLab