varmatCUBE {CUB} | R Documentation |
Variance-covariance matrix for CUBE models
Description
Compute the variance-covariance matrix of parameter estimates for CUBE models when no covariate is specified, or when covariates are included for all the three parameters.
Usage
varmatCUBE(ordinal,m,param,Y=0,W=0,Z=0,expinform=FALSE)
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) |
expinform |
Logical: if TRUE and no covariate is included in the model, the function returns the expected variance-covariance matrix (default is FALSE: the function returns the observed variance-covariance matrix) |
Details
The function checks if the variance-covariance matrix is positive-definite: if not,
it returns a warning message and produces a matrix with NA entries. No missing value should be present neither
for ordinal
nor for covariate matrices: thus, deletion or imputation procedures should be preliminarily run.
References
Iannario, M. (2014). Modelling Uncertainty and Overdispersion in Ordinal Data,
Communications in Statistics - Theory and Methods, 43, 771–786
Piccolo D. (2015). Inferential issues for CUBE models with covariates,
Communications in Statistics. Theory and Methods, 44(23), 771–786.
See Also
Examples
m<-7; n<-500
pai<-0.83; csi<-0.19; phi<-0.045
ordinal<-simcube(n,m,pai,csi,phi)
param<-c(pai,csi,phi)
varmat<-varmatCUBE(ordinal,m,param)
##########################
### Including covariates
data(relgoods)
m<-10
naord<-which(is.na(relgoods$Tv))
nacov<-which(is.na(relgoods$BirthYear))
na<-union(naord,nacov)
age<-2014-relgoods$BirthYear[-na]
lage<-log(age)-mean(log(age))
Y<-W<-Z<-lage
ordinal<-relgoods$Tv[-na]
estbet<-c(0.18,1.03); estgama<-c(-0.6,-0.3); estalpha<-c(-2.3,0.92)
param<-c(estbet,estgama,estalpha)
varmat<-varmatCUBE(ordinal,m,param,Y=Y,W=W,Z=Z,expinform=TRUE)