Hypothesis Testing towards multi-group proportion I have an experiment where there are observed frequencies of different groups and the corresponding expected proportions. I need to test the claim that the observed frequencies agree with the proportions that were expected. So which kinds of tests should I carry out? If possible please provide the python solution!
Data is like:

 A: You can perform a proportion test, or a chi-square test:
In R:
x <- c(99, 36, 48, 9)
n <- c(192, 192, 192, 192)
p <- c(0.5625, 0.1875, 0.1875, 0.0625)

prop_test(x=x, n=n, p=p)

chisq.test(x=x, p=p)

Output:
     n statistic    df     p p.signif
* <dbl>     <dbl> <int> <dbl> <chr>   
1   768      7.44     4 0.115 ns

    Chi-squared test for given probabilities

data:  x
X-squared = 5.5, df = 3, p-value = 0.1386

On a side note, with a p-value > 0.05 (as is the case here), we can only fail to reject the null hypothesis of equality of proportions ($H_0$), not accept it. It is therefore plausible that the observed frequencies match the expected proportions, but we do not have direct evidence in favour of $H_0$.
As far as I am aware, Python does not seem to offer the possibility to compare frequencies to the expected probabilities out of the box. However, we can "cheat" by calling R from Python:
import rpy2.robjects.numpy2ri
rpy2.robjects.numpy2ri.activate()
from rpy2.robjects.packages import importr
stats = importr('stats')

x = np.array([99, 36, 48, 9])
n = np.array([192, 192, 192, 192])
p = np.array([0.5625, 0.1875, 0.1875, 0.0625])

prop = stats.prop_test(x=x, n=n, p=p)

print(prop)

Output:
4-sample test for given proportions without continuity correction

data:  structure(c(99L, 36L, 48L, 9L), .Dim = 4L) out of structure(c(192L, 192L, 192L, 192L), .Dim = 4L), null probabilities structure(c(0.5625, 0.1875, 0.1875, 0.0625), .Dim = 4L)
X-squared = 7.4374, df = 4, p-value = 0.1145

(The chi square test does not appear to be available through rpy2).
A: I came to a solution using Scipy which is based on chi-square test:
from scipy.stats import chisquare
total = 99 + 36 + 48 + 9
chi_square, p = chisquare([99 / total, 36 / total, 48 / total, 9 / total], f_exp=[0.5625, 0.1875, 0.1875, 0.0625])
print('chi test statistic of this experiment is: ', chi_square)
print('P value of this experiment is: ', p)

if p >= 0.05:
  print('Reject Null Hypothesis')
else:
  print('Accept Null Hypothesis')
```

