1

I have the following matrix data, 3 Forms of policies by loss causes in the columns:

test=as.data.frame(matrix(c(74,10,4,4,2,6,57,19,4,8,2,10,54,19,6,8,2,11),nrow=3,byrow=T))
names(test) <- c("Wind","Water","Fire","Theft","Liab","OtherPD")
row.names(test)  <- c("FormA","FormB","FormC")

And data looks like this:

      Wind Water Fire Theft Liab OtherPD
FormA   74    10    4     4    2       6
FormB   57    19    4     8    2      10
FormC   54    19    6     8    2      11

Each row shows the percentage of losses within a Form that is attributed to the cause. For instance, 74% of losses in FormA is due to wind losses. Each row will add up to 100.

Question: please suggest a way to visualize this other than pie charts for each row such as:

pie(unlist(test[1,]),labels=c("Wind","Water","Fire","Theft","Liab","OtherPD"),main= "FormA")

A comment on the percentages is that although some numbers may look small, their corresponding underlying dollar amounts are still significant and credible. A more prominent insight I'd like to convey through visualization is how each policy forms compare against each other in losses due to all these different perils, and especially the "smaller" ones, not to be blinded by the fact that FormA has a dominant proportion of wind losses.

fika_fika
  • 111
  • 1
  • 10

1 Answers1

2

I suggest that you restructure the data. ggplot has some nice charts.

#restructure data
library(reshape2)
data <- melt(test)
data$Form <- c("FormA","FormB","FormC")
#plot with ggplot2
library(ggplot2)
ggplot(data, aes(variable, value)) + geom_bar(stat="identity") + facet_wrap(~ Form)
ggplot(data, aes(variable, value)) + geom_point() + facet_wrap(~ Form)
ggplot(data, aes(variable, value,colour=Form, group=Form)) + geom_point()
jburkhardt
  • 675
  • 1
  • 4
  • 18
  • 1
    I think the OP might be able to `reshape2::melt()` their data to get it into the appropriate form. – Ben Bolker Dec 03 '14 at 16:10
  • @user3301853 I like your plots, especially the third one `ggplot(data, aes(variable, value,colour=Form, group=Form)) + geom_point()`, because it seems to convey the message that while `FormA` has higher proportion of losses due to `Wind`, it has lower proportion of losses due to other causes - which is something I want to make the viewer of the graph easily see. – fika_fika Dec 03 '14 at 17:31
  • @Actuary Great! If you accept this as your answer remember to click the checkbox, so that others can see your issue has been resolved. – jburkhardt Dec 03 '14 at 20:07