library(CUB)
## CUB models with no covariates
model<-GEM(Formula(Walking~0|0|0),family="cub",data=relgoods)
coef(model,digits=5) # Estimated parameter vector (pai,csi)
logLik(model) # Log-likelihood function at ML estimates
vcov(model,digits=4) # Estimated Variance-Covariance matrix
cormat(model) # Parameter Correlation matrix
fitted(model) # Fitted probability distribution
makeplot(model)
################
## CUB model with shelter effect
model<-GEM(Formula(officeho~0|0|0),family="cub",shelter=7,data=univer)
BICshe<-BIC(model,digits=4)
################
## CUB model with covariate for uncertainty
modelcovpai<-GEM(Formula(Parents~Smoking|0|0),family="cub",data=relgoods)
fitted(modelcovpai)
makeplot(modelcovpai)
################
## CUB model with covariates for both uncertainty and feeling components
data(univer)
model<-GEM(Formula(global~gender|freqserv|0),family="cub",data=univer,maxiter=50,toler=1e-2)
param<-coef(model)
bet<-param[1:2] # ML estimates of coefficients for uncertainty covariate: gender
gama<-param[3:4] # ML estimates of coefficients for feeling covariate: lage
##################
## CUBE models with no covariates
model<-GEM(Formula(MeetRelatives~0|0|0),family="cube",starting=c(0.5,0.5,0.1),
data=relgoods,expinform=TRUE,maxiter=50,toler=1e-2)
coef(model,digits=4) # Final ML estimates
vcov(model)
fitted(model)
makeplot(model)
summary(model)
##################
## IHG with covariates
modelcov<-GEM(willingn~freqserv,family="ihg",data=univer)
omega<-coef(modelcov) ## ML estimates
maxlik<-logLik(modelcov) ##
makeplot(modelcov)
summary(modelcov)
###################
## CUSH models without covariate
model<-GEM(Dog~0,family="cush",shelter=1,data=relgoods)
delta<-coef(model) # ML estimates of delta
maxlik<-logLik(model) # Log-likelihood at ML estimates
summary(model)
makeplot(model)
Run the code above in your browser using DataLab