RAPLER / dst-1

Combine basic probability assignments with Dempster's rule of combination
6 stars 3 forks source link

How to calculate belief of a subset that's not one of the subsets given by belplau? #7

Closed garyzhubc closed 1 year ago

garyzhubc commented 1 year ago

How to calculate belief of a subset that's not one of the subsets given by belplau?

RAPLER commented 1 year ago

Use function addTobca, which has been designed for this purpose. augmented_bca <- addTobca(x = your_bca, tt = "description matrix of the subsets to add"). Then do: belplau(augmented_bca).

garyzhubc commented 1 year ago

How to retrieve these subsets that I want from the belplau table if I have a lot of other subsets? Is there a given order how these subsets are sorted in belplau?

RAPLER commented 1 year ago

Function "belplau" does no sort. The order is the one of the tt matrix of the bca submitted to belplau.

If you have added subsets via function addTobca, these subsets will appear first. If you want to retrieve specific subsets from your bca, you can do this way:

  1. Let result <- belplau(your_bca)
  2. suppose there is 3 subsets you want to retrieve from "result". You can use the labels of the subsets to locate them in the bca. Suppose their names are "label1", "label2", "label3". Use functions "outer" and "apply" to find the row numbers of these labels.

2.1 Do: table <- outer(c("label1", "label2", "label3"), rownames(result), "==") 2.2 Do: rownumbers <- (apply(table, 2, sum) ) * 1:nrow(result)

  1. Finally ask for: result[rownumbers,]
garyzhubc commented 1 year ago

Hmm...

I've got zero beliefs on these three subsets. Let me see if there's better ways to use plausible inference.

RAPLER commented 1 year ago

Which three subsets do you speak of?

If your three subsets are part of a bca obtained from the repeated application of Dempster's Rule on your data, they cannot have zero mass.

If you add a new subset A to your bca (with addTobca function), it has zero mass by definition. It will have a positive belief value if your bca contains one or more subsets of A.

RAPLER commented 1 year ago

Was this issue resolved by using addTobca function?

garyzhubc commented 1 year ago

Yes, and the right way to retrieve only these subsets as mentioned in a different post.

# select input hypotheses
bel_plau_df_ <- cbind(bel_plau, bpa$spec)
bel_plau_df_selected <- as.data.frame(bel_plau_df_[which(bel_plau_df_[,ncol(bel_plau_df_)] == 1),])