Learn R Programming

CUB (version 0.1)

logscore: Logarithmic score

Description

Compute the logarithmic score of a CUB model with covariates both for the uncertainty and the feeling parameters.

Usage

logscore(m, ordinal, Y, W, bet, gama)

Arguments

m
Number of ordinal categories
ordinal
Vector of ordinal responses
Y
Matrix of covariates for explaining the uncertainty component
W
Matrix of covariates for explaining the feeling component
bet
Vector of parameters for the uncertainty component, with length NCOL(Y)+1 to account for an intercept term (first entry of bet)
gama
Vector of parameters for the feeling component, with length NCOL(W)+1 to account for an intercept term (first entry of gama)

References

Tutz, G. (2012). Regression for Categorical Data, Cambridge University Press, Cambridge

Examples

Run this code
data(relgoods)
m<-10
gender<-relgoods[,2]
smoking<-relgoods[,12]
ordinal<-relgoods[,40]
nona<-na.omit(cbind(ordinal,gender,smoking))
ordinal<-nona[,1]
gender<-nona[,2]
smoking<-nona[,3]
bet<-c(-0.45,-0.48)
gama<-c(-0.55,-0.43)
logscore(m, ordinal, Y=smoking, W=gender, bet, gama)

Run the code above in your browser using DataLab