verbal-autopsy-software / Tariff

R package of Tariff method for VA
0 stars 4 forks source link

CSMF not being reported in correct order #1

Closed jfiksel closed 6 years ago

jfiksel commented 6 years ago

It appears that when you use the reported csmf from the tariff function, this is not identical to calculating it directly from the most likely COD for each test subject. Furthermore, it appears that this has to do with the naming of the items:

data("RandomVA3")
test <- RandomVA3[1:200, ]
train <- RandomVA3[201:400, ]
allcauses <- unique(train$cause)
set.seed(123)
fit <- tariff(causes.train = "cause", symps.train = train, 
              symps.test = test, causes.table = allcauses)
fit$csmf
prop.table(table(fit$causes.test[,2]))

You can see above that in fact the percentages are the same, but the names associated with each one are not. This is important to know which is the right way to get the CSMF, as it may confuse users.

richardli commented 6 years ago

Oops great find! Indeed a bug there...should have fixed it in the latest commit (https://github.com/richardli/Tariff/commit/9c5fb68ee858a49cbdc151a68fd2466112b7508c). Will update version 1.0.4 to CRAN too.