I perform $N$ independent trials with $M$ successes. The probability of success is therefore $P=M/N$. Can I assign a sample-size-dependent error to the probability based only on this information? i.e. the probability is $P\pm \delta P(M,N)$.
Thank you.
You have $N$ i.i.d bernoulli random variables $X_1,\ldots,X_N$, $$ S = \sum_{k=1}^N X_i \text{,} $$ the random variable $Q$ representing the unknown probability, and $$ \mathbb{P}(S = m \mid Q = q) = \binom{N}{M}q^M (1-q)^{N-M} \text{.} $$
From that, you can compute the probability that $\frac{m}{N}-\epsilon < Q < \frac{m}{N}+\epsilon$ given an observation $m$, i.e. find $$ \mathbb{P}\left(Q \in \tfrac{m}{N} + [-\epsilon,\epsilon] \,\,\big|\,\, S = m\right) \text{.} $$
Finally, you then assume some significance level $\alpha$, say 0.05, and solve $$ \mathbb{P}\left(Q \in \tfrac{m}{N} + [-\epsilon,\epsilon] \,\,\big|\,\, S = m\right) = 1 - \alpha $$ for $\epsilon$, i.e. you find $\epsilon$ such that the probability of $Q$ lying outside of your confidence interval $\frac{m}{N} + [-\epsilon,\epsilon]$ is $\alpha$.