Displaying 1 result from an estimated 1 matches for "ttab".
Did you mean:
tab
2011 Nov 28
1
code problem with the optim() function
...factor(r1)
if (!is.factor(r2))
r2 <- factor(r2)
ifelse (length(levels(r1)) >= length(levels(r2)),lev <- c(levels(r1),
levels(r2)), lev <- c(levels(r2), levels(r1)))
lev <- lev[!duplicated(lev)]
r1 <- factor(ratings[, 1], levels = lev)
r2 <- factor(ratings[, 2], levels = lev)
ttab <- table(r1, r2)
total<-margin.table(ttab)
pa<-(margin.table(ttab,1)/total)
pb<-(margin.table(ttab,2)/total)
ncate<-length(levels(as.factor(as.matrix(ratings))))
pp<-prop.table(ttab)
sumagr<-sum(diag(ttab))/ns
alpha<-(sumagr-sum(pa*pb))/(1-sum(pa*pb))
aickin <- functio...