Confidence interval for categorical data I have the following data about companies who respond timely or untimely and another category of the answer:
       ND  NI  SC  PI  PA
Timely  27   3   9   4   7
Untimely   24  14  14   6   8

I want to do the following:


*

*Write the multinomial model for the data and the hypothesis for the two possible categorizations.

*Do an appropriate test for independence between the two possible categorizations?

*Make a 95% independence interval for the ratio of companies in the PA-category.
My approach:
1.
I create the following models:
$$
M_0:\quad \{X_{ij}\} \sim \mathrm{Multinom}(116,\{\pi_{ij}\}) \\
\pi_{ij} \ge 0, \sum_{ij}\pi_{ij}=1
$$
$$
M_1:\quad \{X_{ij}\} \sim \mathrm{Multinom}(116,\{\pi_{ij}\}) \\
\pi_{ij}=\alpha_i\beta_j \\
\alpha_i \ge 0, \sum_{i}\alpha_i=1, \quad \beta_j \ge 0, \sum_j \beta_j=1 \\
$$
I formulate the hypothesis as the following:
$$
H_0: \quad \pi_{ij}=\alpha_i \text{ for alle } i=1,2 \text{ and } j=1,2,\dots ,5
$$
2.
I do this test in R. Since I get an expected value below 5, I use Fisher's test instead of the G test:
mat=rbind(c(27,3,9,4,7),c(24,14,14,6,8))
fisher.test(mat)

Output:
p-value = 0.1377

So I cannot reject the hypothesis that the two categories are independent.
3.
Here I have a hunch that I should find the confidence interval for a binomial distribution, but I'm stuck. I would like to calculate this in R too.
EDIT: updated question
 A: For point 3, the 'naive' approach might be to calculate individual confidence intervals for each category within each colour. 
For example:
green <- c(27,3,9,4,7)
binom.test(green[1], sum(green), alternative="two.sided", conf.level=0.95)

But the categories aren't independent, so if you had a 95% chance of getting any given proportion correct, you've got a less than 95% chance of getting ALL proportions correct (0.95^(number of categories) ~ 0.77). This is nicely described here: https://brownmath.com/stat/gof_ci.htm
There are several more sophisticated ways to go about it.  I'm not an R user so can't go in-depth, but I found a great package that calculates multiple different approaches to confidence intervals of categorical data, see: https://github.com/hrbrmstr/scimple
The example usage is self explanatory but might go something like this:
library(scimple)
library(hrbrthemes)
library(tidyverse)

green <- c(27,3,9,4,7)
z <- 0.05

scimple_ci(green, z) %>% 
  mutate(method=scimple_short_to_long[method]) -> cis

As for plotting and processing of the output, I'm afraid I can't help because of my unfamiliarity with R. 
However statsmodels in python has two implementations (Goodman or Sison-Glaz), and here's enough to calculate CIs using Sison-Glaz method and plot to compare:
from statsmodels.stats.proportion import multinomial_proportions_confint
import matplotlib.pyplot as plt
import numpy as np

green = np.array([27,3,9,4,7])
blue = np.array([24,14,14,6,8])
ci_green = multinomial_proportions_confint(green, alpha=0.05, method='sison-glaz')
ci_blue = multinomial_proportions_confint(blue, alpha=0.05, method='sison-glaz')

_=plt.fill_between(np.arange(5), ci_green[:,0], ci_green[:,1], alpha=0.5, label='Green sample', color='green')
_=plt.fill_between(np.arange(5), ci_blue[:,0], ci_blue[:,1], alpha=0.5, label='Blue sample', color='blue')
plt.ylabel('Proportion')
plt.xlabel('Category')
_=plt.xticks(np.arange(5),['ND', 'NI', 'SC',  'PI',  'PA'])
_=plt.legend()

Output:
 
I think that supports the output from your Fisher comparison. 
