## Test Coin2

https://math.stackexchange.com/questions/2033370/how-to-determine-the-number-of-coin-tosses-to-identify-one-biased-coin-from-anot/2033739#2033739

Suppose there are two coins and the percentage that each coin flips a Head is $$p$$ and $$q$$, respectively. $$p, q \in [0,1]$$, $$p \neq q$$, and the values are given and known. If you are free to flip one of the coins any number of times, how many times $$n$$ do you have to flip the coin to decide with some significance level $$\left( \textrm{say } \alpha = 0.05 \right)$$ that it’s the $$p$$ coin or the $$q$$ coin that you’ve been flipping?

The distribution of heads after $$n$$ flips for a coin will be a binomial distribution with means at $$pn$$ and $$qn$$.

Two binomial distributions, n = 20. The means are pn = 10 and qn = 14.

Setting Up Our Hypothesis Test

Let’s say we want to test if our coin is the $$p$$ coin and let’s say we arbitrarily decide to call the smaller probability $$p$$, i.e. $$p < q$$. We know that coin flips give us a binomial distribution, and we know the standard error of the mean proportion of heads from $$n$$ flips, which is

$$\textrm{Standard error of the mean} = \sqrt{ {Var(X_p) \over n^2 } } = \sqrt{ {np(1-p) \over n^2 } } = \sqrt{ {p(1-p) \over n} }$$

Knowing the standard error of the mean of our random variable $$X_p$$ (coin flips that produce Heads with probability $$p$$ or Tails with probability $$1-p$$), a 0.05 significance level would mean some cutoff value $$c$$ where $${c \over n} > p$$ or $$c > pn$$. If $$x_p$$ (the sample number of heads from $$n$$ coin tosses) is “too far away” from $$p$$, i.e. we have $$x_p > c$$, then we reject the null hypothesis that we have been flipping the $$p$$ coin.

But note that if we choose a $$c$$ that far exceeds $$qn$$, we are in a weird situation. If $$x_p > c$$, then $$x_p$$ is “too large” for $$p$$ but also is quite larger than $$q$$. This puts us in an awkward situation because while $$x_p$$ is much larger than $$p$$, making us want to reject the hypothesis that we have were flipping the $$p$$ coin, it is also quite larger than $$q$$, so perhaps we obtained a result that was pretty extreme “no matter which coin we had.” If we assume the null hypothesis that we have the $$p$$ coin, our result $$x_p$$ is very unlikely, but it is also quite unlikely even if we had the $$q$$ coin, our alternative hypothesis.

If $$c$$ is, instead, somewhere in between $$pn$$ and $$qn$$, and $$x_p > c$$, we may reject the null hypothesis that our coin is the $$p$$ coin, while $$x_p$$ is in a region close to $$q$$, i.e. a region that is a more likely result if we actually had been flipping the $$q$$ coin, bringing us closer to the conclusion that this is the $$q$$. However, if we reverse the experiment – if we use the same critical value $$c$$ and say that if $$x_p < c$$ then we reject our null hypothesis that $$q$$ is our coin, then the power and significance of the test for each coin is different, which is also awkward.

Above, the pink region is the probability that $$X_p$$ ends in the critical region, where $$x_p > c$$, assuming the null hypothesis that we have the $$p$$ coin. This is also the Type I Error rate (a.k.a. false positive) – the probability that we end up falsely rejecting the null hypothesis, assuming that the null hypothesis is true.

Above, the green region is the power $$1-\beta$$, the probability that we get a result in the critical region $$x_p > c$$ assuming that the alternative hypothesis is true, that we have the $$q$$ coin. The blue-gray region is $$\beta$$, or the Type II Error rate (a.k.a. false negative) – the probability that we fail to reject the null hypothesis (that we have the $$p$$ coin) when what’s actually true is the alternative hypothesis (that we have the $$q$$ coin).

Now let us “reverse” the experiment with the same critical value – we want to test our null hypothesis that we have the $$q$$ coin:

We have $$x_p < c$$. We fail to reject the null hypothesis that we have the $$p$$ coin, and on the flip side we would reject the null hypothesis that we have the $$q$$ coin. but we have failed a tougher test (the first one, with a small $$\alpha_p$$) and succeeded in rejecting an easier test (the second one, with a larger $$\alpha_q$$). In hypothesis testing, we would like to be conservative, so it is awkward to have failed a tougher test but "be ok with it" since we succeeded with an easier test. Common sense also, obviously, says that something is strange when $$x_p$$ is closer to $$q$$ than $$p$$ and yet we make the conclusion that since $$x_p$$ is on the "$$p$$-side of $$c$$," we have the $$p$$ coin.   In reality, we wouldn't take one result and apply two hypothesis tests on that one result. But we would like the one test procedure to make sense with whichever null hypothesis we start with, $$p$$ coin or $$q$$ coin (since it is arbitrary which null hypothesis we choose in the beginning, for we have no knowledge of which coin we have before we start the experiment).

What we can do, then, is to select $$c$$ so that the probability, under the hypothesis that we have the $$p$$ coin, that $$X_p > c$$ is equal to the probability that, under the hypothesis that we have the $$q$$ coin, that $$X_q < c$$. In our set up, we have two binomial distributions, which are discrete, as opposed to the normal distributions above. In addition, binomial distributions, unless the mean is at $$n/2$$, are generally not symmetric, as can be seen in the very first figure, copied below as well, where the blue distribution is symmetric but the green one is not.

We can pretend that the blue distribution is the binomial distribution for the $$p$$ coin and the green distribution for the $$q$$ coin. The pmf of a binomial random variable, say $$X_p$$ (that generates Heads or Tails with probability of Heads $$p$$) is:

$${n \choose h} p^h (1-p)^{n-h}$$

where $$n$$ is the total number of flips and $$h$$ is the number of Heads among those flips. We let $$c$$ be the critical number of Heads that would cause us to reject the null hypothesis that the coin we have is the $$p$$ coin in favor of the alternative hypothesis that we have the $$q$$ coin. The area of the critical region, i.e. the probability that we get $$c_H$$ heads or more assuming the hypothesis that we have the $$p$$ coin, is:

$$Pr(X_p > c) = \sum_{i=c}^{n} \left[ {n \choose i} p^i (1-p)^{n-i} \right]$$

And the reverse, the probability that we get $$c_H$$ heads or less assuming the hypothesis that we have the $$q$$ coin, is:

$$Pr(X_q < c) = \sum_{i=0}^{c} \left[ {n \choose i} q^i (1-q)^{n-i} \right]$$ So we want to set these two equal to each other and solve for $$c$$: $$\sum_{i=c}^{n} \left[ {n \choose i} p^i (1-p)^{n-i} \right] = \sum_{i=0}^{c} \left[ {n \choose i} q^i (1-q)^{n-i} \right]$$ But since the binomial distribution is discrete, there may not be a $$c$$ that actually works. For large $$n$$, a normal distribution can approximate the binomial distribution. In that case, we can draw the figure below, which is two normal distributions, each centered on $$pn$$ and $$qn$$ (the means of the true binomial distributions), and since normal distributions are symmetric, the point at which the distributions cross will be our critical value. The critical regions for $$X_p$$ (to the right of $$c$$) and for $$X_q$$ (to the left of $$c$$) will have the same area.

If we pretend that these normal distributions are binomial distributions, i.e. if we pretend that our binomial distributions are symmetric (i.e. we pretend that $$n$$ is going to be large enough that both our binomial distributions of $$X_p$$ and $$X_q$$ are symmetric enough), then to find $$c$$ we can find the value on the horizontal axis at which, i.e. the number of Heads at which, the two binomial probability distributions are equal to each other.

$${n \choose c} p^c (1-p)^{n-c} = {n \choose c} q^c (1-q)^{n-c}$$
$$p^c (1-p)^{n-c} = q^c (1-q)^{n-c}$$
$$\left({p \over q}\right)^c \left({1-p \over 1-q}\right)^{n-c} = 1$$
$$\left({p \over q}\right)^c \left({1-p \over 1-q}\right)^{n} \left({1-q \over 1-p}\right)^c = 1$$
$$\left({p(1-q) \over q(1-p)}\right)^c = \left({1-q \over 1-p}\right)^{n}$$
$$c \cdot log \left({p(1-q) \over q(1-p)}\right) = n \cdot log \left({1-q \over 1-p}\right)$$

$$c = n \cdot log \left({1-q \over 1-p}\right) / log \left({p(1-q) \over q(1-p)}\right)$$

The mean of a binomial distribution $$X_p$$ has mean $$pn$$ with standard deviation $$\sqrt{np(1-p)}$$. With a normal distribution $$X_{\textrm{norm}}$$ with mean $$\mu_{\textrm{norm}}$$ and standard deviation $$\sigma_{\textrm{norm}}$$, the value $$c_{\alpha} = X_{\textrm{norm}} = \mu_{\textrm{norm}} = 1.645\sigma_{\textrm{norm}}$$ is the value where the area from that value $$c_{\alpha}$$ to infinity is $$0.05 = \alpha$$. Thus, $$c_{\alpha}$$ is the critical value for a normal random variable where the probability that $$X_{\textrm{norm}} > c_{\alpha} = 0.05)$$. So for a binomial random variable $$X_p$$, we would have $$c_{\textrm{binomial, }\alpha} = pn + 1.645\sqrt{np(1-p)}$$.

Thus, we have that this critical value for a binomial random variable $$X_p$$:

$$c = n \cdot log \left({1-q \over 1-p}\right) / log \left({p(1-q) \over q(1-p)}\right)$$

must also be

$$c_{\textrm{binomial, }\alpha} \geq pn + 1.645\sqrt{np(1-p)}$$

for the area to the right of $$c$$ to be $$\leq 0.05$$. To actually find the critical value $$c_{\textrm{binomial, }\alpha}$$, we can just use

$$c_{\textrm{binomial, }\alpha} \geq pn + 1.645\sqrt{np(1-p)}$$

Since we are given the values of $$p$$ and $$q$$, we would plug in those values to find the required $$n$$ needed to reach this condition for the critical value. So we have

$$n \cdot log \left({1-q \over 1-p}\right) / log \left({p(1-q) \over q(1-p)}\right) = pn + 1.645\sqrt{np(1-p)}$$

$$\sqrt{n} = 1.645\sqrt{p(1-p)} / \left[ log \left({1-q \over 1-p}\right) / log \left({p(1-q) \over q(1-p)}\right) – p \right]$$

$$n = 1.645^2p(1-p) / \left[ log \left({1-q \over 1-p}\right) / log \left({p(1-q) \over q(1-p)}\right) – p\right]^2$$

For example, if $$p = 0.3$$ and $$q = 0.7$$, we have $$n = 14.2066$$, or rather, $$n \geq 14.2066$$.

Wolfram Alpha calculation of above, enter the following into Wolfram Alpha:

1.645^2 * p * (1-p) / (ln((1-q)/(1-p))/ln(p*(1-q)/(q*(1-p))) – p )^2; p = 0.3, q = 0.7

Note that if we switch the values so that $$p = 0.7$$ and $$q = 0.3$$, or switch the $$p$$’s and $$q$$’s in the above equation for $$n$$, we obtain the same $$n_{\textrm{min}}$$. This makes sense since our value for $$n_{\textrm{min}}$$ depends on $$c$$ and $$c$$ is the value on the horizontal axis at which the two normal distributions from above (approximations of binomial distributions) with means at $$pn$$ and $$qn$$ cross each other. Thus, we set up the distributions so that that whole problem is symmetric.

So if we generate a sample such that the number of samples is $$n \geq 14.2066$$, we can use our resulting $$x_p$$ and make a hypothesis test regarding if we have the $$p$$ or $$q$$ coin with $$\alpha = 0.05$$ significance level.

If $$p$$ and $$q$$ are closer, say $$p = 0.4$$ and $$q = 0.5$$, then we have $$n \geq 263.345$$. This makes intuitive sense, where the closer the probabilities are of the two coins, the more times we have to flip our coin to be more sure that we have one of the coins rather than the other.

Wolfram Alpha calculation of above, or enter the following into Wolfram Alpha:

1.645^2 * p * (1-p) / (ln((1-q)/(1-p))/ln(p*(1-q)/(q*(1-p))) – p )^2; p = 0.4, q = 0.5

From here, where the question is asked originally, is an answer that finds the exact values for the two $$n_{\textrm{min}}$$ using R with the actual binomial distributions (not using normal distributions as approximations):

https://math.stackexchange.com/a/2033739/506042

Due to the discrete-ness of the distributions, the $$n_{\textrm{min}}$$’s found are slightly different: $$n_{\textrm{min}} = 17$$ for the first case and $$n_{\textrm{min}} = 268$$ for the second case. I.e., the difference comes from using the normal distribution as an approximation for the binomial distribution.

## Test Coin

https://math.stackexchange.com/questions/2033370/how-to-determine-the-number-of-coin-tosses-to-identify-one-biased-coin-from-anot/2033739#2033739

Suppose there are two coins and the percentage that each coin flips a Head is $$p$$ and $$q$$, respectively. $$p, q \in [0,1]$$ and the values are given and known. If you are free to flip one of the coins, how many times $$n$$ do you have to flip the coin to decide with some significance level $$\left( \textrm{say } \alpha = 0.05 \right)$$ that it’s the $$p$$ coin or the $$q$$ coin that you’ve been flipping?

The distribution of heads after $$n$$ flips for a coin will be a binomial distribution with means at $$pn$$ and $$qn$$.

Two binomial distributions, n = 20. The means are pn = 10 and qn = 14.

The Usual Hypothesis Test

In the usual hypothesis test, for example with data $$x_i, i=1, 2, 3, …, n$$ from a random variable $$X$$, to find the if the mean $$\mu$$ is $$\leq$$ some constant $$\mu_0$$:

\begin{align}
H_0 & : \mu \leq \mu_0 ( \textrm{ and } X \sim N(\mu_0, \textrm{ some } \sigma^2 ) )
H_1 & : \mu > \mu_0
\end{align}

If the sample mean of the data points $$\overline{x}$$ is “too large compared to” $$\mu_0$$, then we reject the null hypothesis $$H_0$$.

If we have the probability distribution of the random variable (even if we don’t know the true value of the mean $$\mu$$), we may be able to know something about the probability distribution of a statistic obtained from manipulating the sample data, e.g. the sample mean.  This, the probability distribution of a statistic (obtained from manipulating sample data), is called the sampling distribution.  And a property of the sampling distribution, the standard deviation of a statistic, is the standard error.  For example, the standard error of the mean is:

Sample Data: $$x$$ $$\qquad$$ Sample Mean: $$\overline{x}$$

Variance: $$Var(x)$$ $$\qquad$$ Standard Deviation: $$StDev(x) = \sigma(x) = \sqrt{Var(x)}$$

Variance of the Sample Mean: $$Var( \overline{x} ) = Var \left( \frac{1}{n} \sum_{i=0}^{n}{ x_i } \right) = \frac{1}{n^2} \sum_{i=0}^{n} { Var(x_i) } = \frac{1}{n^2} n Var(x) = \frac{1}{n} Var(x) = {\sigma^2 \over n}$$

Standard Deviation of the Sample Mean, Standard Error of the Mean: $$\frac{1}{\sqrt{n}} StDev(x) = {\sigma \over \sqrt{n}}$$

Thus, if the random variable is $$i.i.d.$$ (independent and identically distributed), then with the sample mean $$\overline{x}$$ we obtain from the data, we can assume this $$\overline{x}$$ has a standard deviation of $$\frac{\sigma}{\sqrt{n}}$$.  This standard deviation, being smaller than the standard deviation of the original $$X$$, i.e. $$\sigma$$, means that $$\overline{X}$$ is narrower around the mean than $$X$$. This means $$\overline{X}$$ gives us a better ability to hone in on what the data says about $$\mu$$ than $$X$$’s ability to hone, i.e. a narrower, more precise, “range of certainty,” from the sample data, with the same significance level.

Thus, given our sample $$x_i, i = 1, \dots, n$$, we can calculate the statistic $$\overline{x} = \frac{1}{n} \sum_{i=1}^{n} {x_i}$$, our sample mean.  From the data (or given information), we would like to calculate the standard error of the mean, the standard deviation of this sample mean as a random variable (where the sample mean is a statistic, i.e. can be treated as a random variable): $$\frac{1}{\sqrt{n}} StDev(x) = {\sigma \over \sqrt{n}}$$. This standard error of the mean gives us a “range of certainty” around the $$\overline{x}$$ with which to make an inference.

A. If we know/are given the true standard deviation $$\sigma$$

If we are given the true standard deviation $$\sigma$$ of the random variable $$X$$, then we can calculate the standard error of the sample mean: $$\frac{\sigma}{\sqrt{n}}$$.  So under the null hypothesis $$H_0: \mu \leq \mu_0$$, we want to check if the null hypothesis can hold against a test using the sample data.

A.a Digression about $$H_0: \mu \leq \mu_0$$ and $$H_0: \mu = \mu_0$$

If the $$\mu$$ we infer from the sample data is “too extreme,” in this case “too large” compared to $$\mu_0$$, i.e. the test statistic is > some critical value that depends on $$\mu_0$$, i.e. $$c(\mu_0)$$, we reject the null hypothesis. If we check a $$\mu_1$$ that is $$\mu_1 < \mu_0$$ (since our null hypothesis is $$H_0: \mu < \mu_0$$), our critical value $$c(\mu_1)$$ will be less extreme than $$c(\mu_0)$$ (in other words $$c(\mu_1) < c(\mu_0)$$), and thus it would be "easier to reject" the null hypothesis if using $$c(\mu_1)$$. Rejecting a hypothesis test ought to be conservative since rejecting a null hypothesis is reaching a conclusion, so we would like the test to be "the hardest to reject" that we can (a conclusion, i.e. a rejection here, should be as conservative as possible). The "hardest to reject" part of the range of $$H_0: \mu \leq \mu_0$$ would be $$\mu = \mu_0$$ where the critical value $$c(\mu_0)$$ would be the largest possible critical value. Testing a $$\mu_1 < \mu_0$$ would mean that we may obtain a test statistic that rejects is too extreme/large) for $$\mu_1$$ (i.e. $$t > c(\mu_1)$$ ) but not too extreme/large for $$\mu_0$$ (i.e. $$t \not> c(\mu_0)$$ ). But if we test using $$\mu_0$$, if the test statistic is extreme/large enough that we reject the null hypothesis of $$\mu = \mu_0$$, that would also reject all other null hypotheses using $$\mu_1$$ where $$\mu_1 < \mu_0$$.

So under the null hypothesis $$H_0: \mu \leq \mu_0$$ or the “effective” null hypothesis $$H_0: \mu = \mu_0$$, we have that $$X \sim N(\mu_0, \sigma^2)$$ with $$\sigma$$ known, and we have that $$\overline{X} \sim N(\mu_0, \sigma^2/n)$$.  This means that

$$\frac{\overline{X} – \mu_0} { ^{\sigma}/_{\sqrt{n}} } \sim N(0, 1)$$

Then we can use a standard normal table to find where on the standard normal is the $$\alpha = 0.05$$ cutoff – for a one-tailed test, the cutoff is at $$Z_{\alpha} = 1.645$$ where $$Z \sim N(0, 1)$$.  So if

$$\frac{\overline{X} – \mu_0} { ^{\sigma}/_{\sqrt{n}} } > 1.645 = Z_{\alpha}$$,

then this result is “too large compared to $$\mu_0$$” so we reject the null hypothesis $$H_0: \mu \leq \mu_0$$.  If $$\frac{\overline{X} – \mu_0} { ^{\sigma}/_{\sqrt{n}} } \leq 1.645 = Z_{\alpha}$$, then we fail to reject the null hypothesis $$H_0: \mu \leq \mu_0$$.

B. If we don’t know the standard deviation $$\sigma$$

If we don’t know the value of the standard deviation $$\sigma$$ of our random variable $$X \sim N( \mu, \sigma^2 )$$ (which would be somewhat expected if we already don’t know the value of the mean $$\mu$$ of $$X$$), then we need to estimate $$\sigma$$ from our data $$x_i, i = 1, 2, \dots, n$$.  We can estimate $$\sigma$$ by taking the sample standard deviation of $$x_i, i = 1, \dots, n$$ by doing $$s = \sqrt{ \frac{1}{n-1} \sum_{i=0}^{n} { \left[ (x_i – \overline{x})^2 \right] } }$$, or rather the sample variance $$s^2 = { \frac{1}{n-1} \sum_{i=0}^{n} { \left[ (x_i – \overline{x})^2 \right] } }$$ and then taking the square root of that.

However, note that while the estimator for the sample variance is unbiased:

\begin{align}
\mathbb{E}\left[s^2\right] & = \mathbb{E}\left[ \frac{1}{n-1} \sum_{i=0}^{n} { \left[ (x_i – \overline{x})^2 \right] } \right] \\
& = \frac{1}{n-1} \mathbb{E} \left[ \sum_{i=0}^{n} { \left[ (x_i – \overline{x})^2 \right] } \right] = \frac{1}{n-1} \mathbb{E} \left[ \sum_{i=0}^{n} { \left[ (x_i -\mu + \mu – \overline{x})^2 \right] } \right] \\
& = \frac{1}{n-1} \mathbb{E} \left[ \sum_{i=0}^{n} { \left[ \left( (x_i -\mu) – (\overline{x} – \mu) \right)^2 \right] } \right] \\
& = \frac{1}{n-1} \mathbb{E} \left[ \sum_{i=0}^{n} { \left[  (x_i – \mu)^2 – 2 (x_i – \mu) (\overline{x} – \mu) + (\overline{x} – \mu)^2  \right] } \right] \\
& = \frac{1}{n-1} \mathbb{E} \left[ \sum_{i=0}^{n} { \left[  (x_i – \mu)^2 – 2 (x_i – \mu) (\overline{x} – \mu) + (\overline{x} – \mu)^2  \right] } \right] \\
& = \frac{1}{n-1} \mathbb{E} \left[   \sum_{i=0}^{n} { (x_i – \mu)^2 } – 2 (\overline{x} – \mu) \sum_{i=0}^{n} { (x_i – \mu) } + \sum_{i=0}^{n} { (\overline{x} – \mu)^2 }   \right]  \\
& = \frac{1}{n-1} \mathbb{E} \left[   \sum_{i=0}^{n} { (x_i – \mu)^2 } – 2 (\overline{x} – \mu)   (n \overline{x} – n \mu) + n (\overline{x} – \mu)^2    \right]   \\
& = \frac{1}{n-1} \mathbb{E} \left[   \sum_{i=0}^{n} { (x_i – \mu)^2 } – 2 n (\overline{x} – \mu)^2 + n (\overline{x} – \mu)^2    \right]   \\
& = \frac{1}{n-1} \mathbb{E} \left[   \sum_{i=0}^{n} { (x_i – \mu)^2 } – n (\overline{x} – \mu)^2    \right]   \\
& = \frac{1}{n-1}    \sum_{i=0}^{n} { \mathbb{E} \left[ (x_i – \mu)^2 \right] } – n \mathbb{E} \left[ (\overline{x} – \mu)^2 \right]  = \frac{1}{n-1} \left(    \sum_{i=0}^{n} { \mathbb{E} \left[ (x_i – \mu)^2 \right] } – n \mathbb{E} \left[ (\overline{x} – \mu)^2 \right]  \right)  \\
& = \frac{1}{n-1} \left(    \sum_{i=0}^{n} { \mathbb{E} \left[ x_i^2 – 2 \mu x_i + \mu^2 \right] } – n \mathbb{E} \left[ \overline{x}^2 – 2 \mu \overline{x} + \mu^2 \right]  \right) \\
& = \frac{1}{n-1} \left(    \sum_{i=0}^{n} { \left( \mathbb{E} \left[ x_i^2 \right] – 2 \mu \mathbb{E} [x_i] + \mu^2 \right) } – n \left( \mathbb{E} \left[ \overline{x}^2 \right] – 2 \mu \mathbb{E} [\overline{x}] + \mu^2 \right)  \right) \\
& = \frac{1}{n-1} \left(    \sum_{i=0}^{n} { \left( \mathbb{E} \left[ x_i^2 \right] – 2 \mu^2 + \mu^2 \right) } – n \left( \mathbb{E} \left[ \overline{x}^2 \right] – 2 \mu^2 + \mu^2 \right)  \right) \\
& = \frac{1}{n-1} \left(    \sum_{i=0}^{n} { \left( \mathbb{E} \left[ x_i^2 \right] – \mu^2 \right) } – n \left( \mathbb{E} \left[ \overline{x}^2 \right] –  \mu^2 \right)  \right) \\
& = \frac{1}{n-1} \left(    \sum_{i=0}^{n} { \left( \mathbb{E} \left[ x_i^2 \right] – \left( \mathbb{E} [x_i] \right)^2 \right) } – n \left( \mathbb{E} \left[ \overline{x}^2 \right] –  \left( \mathbb{E} [\overline{x}] \right)^2 \right)  \right) \\
& = \frac{1}{n-1} \left(    \sum_{i=0}^{n} { \left(  Var(x_i) \right) } – n Var(\overline{X})  \right) = \frac{1}{n-1} \left(    \sum_{i=0}^{n} { \left( \sigma^2 \right) } – n \frac{\sigma^2}{n} \right) \\
&  = \frac{1}{n-1} \left(    n \sigma^2 – \sigma^2 \right)  = \sigma^2 \\
\end{align}

that does not allow us to say that the square root of the above estimator gives us an unbiased estimator for the standard deviation $$\sigma$$. In other words:

$$\mathbb{E}\left[s^2\right] = \mathbb{E}\left[ \frac{1}{n-1} \sum_{i=0}^{n} { \left[ (x_i – \overline{x})^2 \right] } \right] = \sigma^2$$

but

$$\mathbb{E} [s] = \mathbb{E} \left[ \sqrt{ \frac{1}{n-1} \sum_{i=0}^{n} { \left[ (x_i – \overline{x})^2 \right] } } \right] \neq \sigma$$

because the expectation function and the square root function do not commute:

$$\sigma = \sqrt{\sigma^2} = \sqrt{ \mathbb{E}[s^2] } \neq \mathbb{E}[\sqrt{s^2}] = \mathbb{E}[s]$$

B.a The sample standard deviation $$s = \sqrt{s^2} = \sqrt{ \frac{1}{n-1} \sum_{i=0}^{n} { \left[ (x_i – \overline{x})^2 \right] } }$$ is a biased estimator of $$\sigma$$

In fact, we can infer the bias of $$\mathbb{E} [s]$$ to some extent. The square root function $$f(x) = \sqrt{x}$$ is a concave function. A concave function $$f$$ is:

$$\forall x_1, x_2 \in X, \forall t \in [0, 1]: \quad f(tx_1 + (1 – t) x_2 ) \geq tf(x_1) + (1 – t) f(x_2)$$

The left-hand side of the inequality is the blue portion of the curve $$\{ f( \textrm{mixture of } x_1 \textrm{ and } x_2 ) \}$$ and the right-hand side of the inequality is the red line segment $$\{ \textrm{a mixture of } f(x_1) \textrm{ and } f(x_2) \}$$. We can see visually what it means for a function to be concave, where between to arbitrary $$x$$-values $$x_1$$ and $$x_2$$, the blue portion is always $$\geq$$ the red portion between two $$x$$-values, .

Jensen’s Inequality says that if $$g(x)$$ is a convex function, then:

$$g( \mathbb{E}[X] ) \leq \mathbb{E}\left[ g(X) \right]$$

and if $$f(x)$$ is a concave function, then:

$$f( \mathbb{E}[X] ) \geq \mathbb{E}\left[ f(X) \right]$$

The figure above showing the concave function $$f(x) = \sqrt{x}$$ gives an intuitive illustration of Jensen’s Inequality as well (since Jensen’s Inequality can be said to be a generalization of the “mixture” of $$x_1$$ and $$x_2$$ property of convex and concave functions to the expectation operator). The left-hand side $$f(\mathbb{E}[X])$$ is like $$f( \textrm{a mixture of } X \textrm{ values} )$$ and the right-hand side $$\mathbb{E}\left[ f(X) \right]$$ is like $${\textrm{a mixture of } f(X) \textrm{ values} }$$ where the “mixture” in both cases is the “long-term mixture” of $$X$$ values that is determined by the probability distribution of $$X$$.

Since $$f(z) = \sqrt{z}$$ is a concave function, going back to our estimation of the standard deviation of $$X$$ using $$\sqrt{s^2}$$, we have
\begin{align}
f( \mathbb{E}[Z] ) & \geq \mathbb{E}\left[ f(Z) \right] \longrightarrow \\
\sqrt{\mathbb{E}[Z]} & \geq \mathbb{E}\left[ \sqrt{Z} \right] \longrightarrow \\
\sqrt{ \mathbb{E}[s^2] } & \geq \mathbb{E}\left[ \sqrt{s^2} \right] \longrightarrow \\
\sqrt{ Var(X) } & \geq \mathbb{E}\left[s\right] \\
\textrm{StDev} (X) = \sigma(X) & \geq \mathbb{E}\left[s\right] \\
\end{align}

Thus, $$\mathbb{E} [s] = \mathbb{E} \left[ \sqrt{ \frac{1}{n-1} \sum_{i=0}^{n} { \left[ (x_i – \overline{x})^2 \right] } } \right] \leq \sigma$$. So $$\mathbb{E} [s]$$ is biased and underestimates the true $$\sigma$$.

However, the exact bias $$\textrm{Bias}(s) = \mathbb{E} [s] – \sigma$$ is not as clean to show.

https://en.wikipedia.org/wiki/Unbiased_estimation_of_standard_deviation

$$\frac{(n-1)s^2}{\sigma^2} = \frac{1}{\sigma^2} \sum_{i=0}^{n} { \left[ (x_i – \overline{x})^2 \right] } \sim$$ a $$\chi^2$$ distribution with $$n-1$$ degrees of freedom. In addition, $$\sqrt{ \frac{(n-1)s^2}{\sigma^2} } = \frac{\sqrt{n-1}s}{\sigma} = \frac{1}{\sigma} \sqrt{ \sum_{i=0}^{n} { \left[ (x_i – \overline{x})^2 \right] } } \sim$$ a $$\chi$$ distribution with $$n-1$$ degrees of freedom. A $$\chi$$ distribution with $$k$$ degrees of freedom has mean $$\mathbb{E} \left[ \frac{\sqrt{n-1}s}{\sigma} \right] = \mu_{\chi} = \sqrt{2} \frac{\Gamma ( ^{(k+1)} / _2 ) } { \Gamma ( ^k / _2 )}$$ where $$\Gamma(z)$$ is the Gamma function.

https://en.wikipedia.org/wiki/Gamma_function

If $$n$$ is a positive integer, then $$\Gamma(n) = (n – 1)!$$. If $$z$$ is a complex number that is not a non-positive integer, then $$\Gamma(z) = \int_{0}^{\infty}{x^{z-1} e^{-x} dx}$$. For non-positive integers, $$\Gamma(z)$$ goes to $$\infty$$ or $$-\infty$$.

From the mean of a $$\chi$$ distribution above, we have:

$$\mathbb{E}[s] = {1 \over \sqrt{n – 1} } \cdot \mu_{\chi} \cdot \sigma$$

and replacing $$k$$ with $$n-1$$ degrees of freedom for the value of $$\mu_{\chi}$$, we have:

$$\mathbb{E}[s] = \sqrt{ {2 \over n – 1} } \cdot { \Gamma(^n/_2) \over \Gamma(^{n-1}/_2) } \cdot \sigma$$

Wikipedia tells us that:

$$\sqrt{ {2 \over n – 1} } \cdot { \Gamma(^n/_2) \over \Gamma(^{n-1}/_2) } = c_4(n) = 1 – {1 \over 4n} – {7 \over 32n^2} – {19 \over 128n^3} – O(n^{-4})$$

So we have:

$$\textrm{Bias} (s) = \mathbb{E}[s] – \sigma = c_4(n) \cdot \sigma – \sigma = ( c_4(n) – 1) \cdot \sigma$$

$$= \left( \left( 1 – {1 \over 4n} – {7 \over 32n^2} – {19 \over 128n^3} – O(n^{-4}) \right) – 1 \right) \cdot \sigma = – \left( {1 \over 4n} + {7 \over 32n^2} + {19 \over 128n^3} + O(n^{-4}) \right) \cdot \sigma$$

Thus, as $$n$$ becomes large, the magnitude of the bias becomes small.

From Wikipedia, these are the values of $$n$$, $$c_4(n)$$, and the numerical value of $$c_4(n)$$:

\begin{array}{|l|r|c|}
\hline
n & c_4(n) & \textrm{Numerical value of } c_4(n) \\
\hline
2 & \sqrt{2 \over \pi} & 0.798… \\
3 & {\sqrt{\pi} \over 2} & 0.886… \\
5 & {3 \over 4}\sqrt{\pi \over 2} & 0.940… \\
10 & {108 \over 125}\sqrt{2 \over \pi} & 0.973… \\
100 & – & 0.997… \\
\hline
\end{array}

Thus, for the most part, we don’t have to worry too much about this bias, especially with large $$n$$. So we have
$$\mathbb{E}[\hat{\sigma}] \approx \mathbb{E}[s] = \mathbb{E}[\sqrt{s^2}] = \mathbb{E} \left[ \sqrt{ \frac{1}{n-1} \sum_{i=0}^{n} { \left[ (x_i – \overline{x})^2 \right] } } \right]$$

More rigorously, our estimator $$\hat{\sigma} = s = \sqrt{ \frac{1}{n-1} \sum_{i=0}^{n} { \left[ (x_i – \overline{x})^2 \right] } }$$ is a consistent estimator of $$\sigma$$ (even though it is a biased estimator of $$\sigma$$).

An estimator is consistent if $$\forall \epsilon > 0$$:

$$\lim\limits_{n \to \infty} \textrm{Pr } (|\hat{\theta} – \theta| > \epsilon ) = 0$$

In other words, as $$n \to \infty$$, the probability that our estimator $$\hat{\theta}$$ “misses” the true value of the parameter $$\theta$$ by greater than some arbitrary positive amount (no matter how small) goes to $$0$$.

For the sample standard deviation $$s$$ as our estimator of the true standard deviation $$\sigma$$ (i.e. let $$\hat{\sigma} = s$$),

$$\lim_{n \to \infty} (|\hat{\sigma} – \sigma|) = \lim_{n \to \infty} ( | c_4(n) \sigma – \sigma |) = (| \sigma – \sigma |) = 0$$

so

$$\lim_{n \to \infty} \textrm{Pr } (|\hat{\sigma} – \sigma| > \epsilon) = \textrm{Pr } ( 0 > \epsilon ) = 0$$

Since $$s$$ is a consistent estimator of $$\sigma$$, we are fine to use $$s$$ to estimate $$\sigma$$ as long as we have large $$n$$.

So back to the matter at hand: we want to know the sampling distribution of $$\overline{X}$$ to see “what we can say” about $$\overline{X}$$, specifically, the standard deviation of $$\overline{X}$$, i.e. the standard error of the mean of $$X$$. Not knowing the true standard deviation $$\sigma$$ of $$X$$, we use a consistent estimator of $$\sigma$$ to estimate it: $$s = \sqrt{{1 \over n-1} \sum_{i=1}^n {(x_i – \overline{x})^2}}$$.

So instead of the case where we know the value of $$\sigma$$
$$\overline{X} \sim N(\mu, \sigma^2/n)$$
$$\overline{X} \quad “\sim” \quad N(\mu, s^2/n)$$

When we know the value of $$\sigma$$, we have
$${ \overline{X} – \mu \over \sigma/\sqrt{n} } \sim N(0,1)$$
When we don’t know the value of $$\sigma$$ and use the estimate $$s$$ instead of having something like
$${ \overline{X} – \mu \over s/\sqrt{n} } \quad “\sim” \quad N(0,1)$$
we actually have the exact distribution:
$${ \overline{X} – \mu \over s/\sqrt{n} } \sim T_{n-1}$$
the student’s t-distribution with $$n-1$$ degrees of freedom.

Thus, finally, when we don’t know the true standard deviation $$\sigma$$, under the null hypothesis $$H_0: \mu \leq \mu_0$$, we can use the expression above to create a test statistic
$$t = { \overline{x} – \mu_0 \over s/\sqrt{n} } ~ T_{n-1}$$
and check it against the student’s t-distribution with $$n-1$$ degrees of freedom $$T_{n-1}$$ with some critical value with some significance level, say $$\alpha = 0.05$$.

So if the test statistic exceeds our critical value $$\alpha 0.05$$:

$$t = { \overline{x} – \mu_0 \over s/\sqrt{n} } > T_{n-1, \alpha}$$

then we reject our null hypothesis $$H_0: \mu \leq \mu_0$$ at $$\alpha = 0.05$$ significance level. If not, then we fail to reject our null hypothesis.

asdf

we know the standard deviation of a data point

If under the null hypothesis $$H_0$$ we have a probability distribution, the sample data gives us a sample standard deviation, i.e. the standard error.

Back to our case with 2 coins.  Let’s say we want to test if our coin is the $$p$$ coin and let’s say we arbitrarily decide to call the smaller probability $$p$$, i.e. $$p \leq q$$.  We know that coin flips give us a binomial distribution, and we know the standard error of the mean proportion of heads from $$n$$ flips.  So a 0.05 significance level would mean some cutoff value $$c$$ where $$c > p$$.  But note that if $$c$$ ends up really big relative to $$q$$, e.g. it gets close to $$q$$ or even exceeds $$q$$, we are in a weird situation.

we can decide on some cutoff value $$c$$ between $$p$$ and $$q$$.  If we change around $$c$$, what happens is that the significance level and the power of the test, whether testing $$p$$ or $$q$$, changes.

## Test

Test

The Usual Colors of the Sky

Why is the sky blue? Why are sunsets red? The answers and explanations to these questions can be found fairly easily on the internet. But there are many subtle “Wait a minute…”-type questions in between the cracks that seem to necessitate subtle answers and more “difficult” searching around the internet to find those answers.

So, why is the sky blue?

No, but first, what color is sunlight?

Sunlight spectrum1, from http://wtamu.edu/~cbaird/sq/2013/07/03/what-is-the-color-of-the-sun/

Visible light generally is from 390 nm (violet) to 720 nm (red). Visible sunlight is a mix of these colors at the intensities we see in the figure above.

, with maximum eye sensitivity at 555 nm (green).

Sources:

1. http://wtamu.edu/~cbaird/sq/images/sunlight_wavelength.png

## Barcodes and Modular Arithmetic

Barcodes

Here is an example of a UPC-A barcode, taken from wikipedia:

UPC-A barcode exampled

A UPC-A barcode has 12 digits.  The first digit is something that tells how the numbers are generally used – for example, a particular industry might use a certain number for certain kinds of items.  The last twelfth digit is a check digit that can try to tell whether or not the numbers have an error.  This check digit is constructed in a certain way at first.  Later on, the check digit may be able to tell us if the numbers have an error or not.

The check digit is constructed as follows:

We have 11 digits:

$$ABCDEFGHIJK$$

So let $$L$$ be the last twelfth difit.  We sum the digits in the odd positions and multiply by 3, and sum that with the sum of the digits in the even positions:

$$3\cdot(A+C+E+G+I+K)+(B+D+F+H+J)$$

We take this modulo 10, or the remainder of this when divided by 10.  If this is 0, that is our twelfth digit; if not, subtract this from 10 and that is our twelfth digit.

$$\text{Let}\ S = (3\cdot(A+C+E+G+I+K)+(B+D+F+H+J))$$

L=
\begin{cases}
0, & \text{if}\ S \pmod{10} \equiv 0 \\
10 – (S \pmod{10}), & \text{otherwise}
\end{cases}

So the logic is that if all 12 digits are correct, they satisfy the check digit equation:

$$3\cdot(A+C+E+G+I+K)+(B+D+F+H+J+L) \equiv 0 \pmod{10}$$

If there is an error in the 12th digit, of course the check digit equation won’t be satisfied.  If there is an error in any one single digit among the first 11 digits, then the check digit equation will also not be satisfied.  Thus, the check digit equation will detect any single digit error.

To see that a single digit error among the first 11 digits will cause the check digit equation to not be satisfied, first note that if any of the digits in the even position are off, that will manifest in $$S$$ as well as $$S \pmod{10}$$ and we will have $$S \pmod{10} \not\equiv 0$$.  But what about the digits in the odd positions, whose sum is multiplied by 3, and why multiplied by 3?

Take a digit in one of the even positions.  As long as the digit is off from the correct value, that will manifest itself in $$S$$ and $$S \pmod{10}$$.  Now take a digit in one of the odd positions and call id $$O$$.  The question then is, if the digit is off from the correct value by say $$d$$, how will that manifest itself in $$S$$ as well as $$S \pmod{10}$$?  The correct $$O$$ gives a term $$3 \cdot O$$ in $$S$$ while an incorrect digit of say $$O + d$$ gives a term $$3 \cdot O + 3 \cdot d$$.

## Sets and Borel Sigma Algebra

Showing

\label{eq:0.99=1} \tag{1}
\large \bf 0.\bar{9} = 1

kjh

\label{eq:0.99=io1} \tag{1}
0.\bar{9} = 1

klh

## Portfolio Insurance and Black Monday, October 19, 1987

On the thirtieth anniversary of Black Monday, the stock market crash of October 19th and 20th in 1987, there have been mentions of “portfolio insurance” having possibly exacerbated the crash.

Portfolio insurance, in principle, is exactly what you might expect it to be: if you own a stock, Stock A, you insure it with a put option on Stock A.  Your position becomes equivalent to a call option on Stock A until the put option expires, with the price of this position being the premium of the put option when you bought it.

If you are managing a portfolio on behalf of clients, though, and you just need to insure the portfolio up to a certain date, after which, say, you hand over the portfolio, then to buy American put options to insure the portfolio would be unnecessary.  European put options would suffice.  So let’s suppose that we are only interested in European options.

In the article that I cite at the bottom (Abken, 1987), it seems that at the time, buying put options as insurance had a few issues.  This is assuming that the portfolio we want to insure is a stock index: the S&P 500 index.  The issues were:

• It’s implied that only American options were available (which we would expect have a premium over European options).

Thus, instead of using put options to insure the portfolio, the portfolio and put options are replicated by holding some of the money in the portfolio and some of it in bonds, Treasury bills, that we assume to provide us with the risk-free rate.

Without worrying about the math, the Black-Scholes equation gives us a way to represent our stock index S and put options P as:

$$S + P = S \cdot N_1 + K \cdot DF \cdot N_2$$

d

Source:

Abken, Peter A.  “An Introduction to Portfolio Insurance.”  Economic Review, November/December 1987: 2-25.

## Value-added Tax and Sales Tax

(This is mostly a summary of and heavily borrowed from https://en.wikipedia.org/wiki/Value-added_tax, archived).
(The first three figures are taken from Wikipedia).

Comparing No Tax, Sales Tax, and VAT

Imagine three companies in a value chain that produces and then sells a widget to a consumer. The raw materials producer sells raw materials to the manufacturer for $1.00, earning a gross margin (revenue – Cost Of Goods Sold, COGS) of$1.00. The manufacturer sells its product, the widget, to the retailer for $1.20, earning a gross margin of$0.20. The retailer sells the widget to a non-business consumer (for the customer to use and consume) for $1.50, earning a gross margin of$0.30.

No tax example

Imagine we add a sales tax of 10%.  Sales tax applies only to the transaction with the final end-user, the consumer, i.e. the final transaction. So the consumer pays the retailer $1.50 + 10% sales tax =$1.65 to the retailer. The retailer remits the sales tax, $0.15, to the government. Sales tax example • Only retailers remit collected sales tax to the government. Different regions, products, and types of consumers may have different sales taxes, so retailers are burdened with the maintenance of functions that process this for every different kind of sales tax. • There are cases (e.g. in the U.S., remote sales, i.e. cross-state or internet sales) where the retailer isn’t required to charge sales tax on its sales to consumers. Instead, the consumer is responsible for remitting a use tax to the government on his or her remote purchases. • Only end-users pay the sales tax. Thus, someone who is an end-user has an incentive to masquerade as a business and purchase products for usage. • The government thus requires businesses (namely non-retailers, in this example) with the burden to prove, via certifications, that it is a business (and thus does not need to pay sales tax on the products it buys) and that it sells to other businesses (and thus does not need to charge and remit sales tax on products it sells). Now let’s take away the 10% sales tax and add a 10% VAT. The raw materials producer charges$1.00 + a $0.10 VAT, which is 10% of the$1.00 value they added to the product) to the manufacturer. It remits the $0.10 VAT to the government. The manufacturer sells its product to the retailer for$1.20 + 10% or $0.12:$0.10 of which is the VAT that the raw materials producer charged the manufacturer and is now getting “paid back” by this transaction and the remaining $0.02 of which is 10% of the value added to the product by the manufacturer, which is$1.20 – $1.00 =$0.20, and remits the $0.02 to the government. The retailer sells its product to the customer for$1.50 + 10% of $1.50 or$0.15 ($0.12 of which is VAT that it paid to the previous 2 companies in the value chain and is now being “paid back” by this transaction and the remaining$0.03 of which is 10% of the value that the retailer added to the product, $0.30) and remits$0.03 to the government.

VAT example

• From the consumer’s viewpoint, nothing has changed. End-users still pay the same $1.65 for the widget. • The government earns the same$0.15 as it earned with sales tax.  But instead of receiving all of it from the final transaction between the retailer and the consumer, it earns it in bits of [10% * each value added by each company in the value chain], which are $0.03,$0.02, and $0.10. • From the perspective of each business, they’re charged VAT by companies that they purchase from and they charge VAT to companies/consumers that purchase from them. When they’re charged VAT on purchases ($0.12 for the retailer in the example), they are effectively charged the VAT of all companies that are further down the value chain from them ($0.10 for the raw materials producer and$0.02 for the manufacturer).  When they charge VAT on their sales, they effectively charge VAT for the value they added ($0.03) plus the VAT of all companies that are further down them in the value chain ($0.12).  The difference, the VAT for the value they added, is remitted to the government ($0.15 –$0.12 = $0.03). So when a company purchases and is charged VAT, they are effectively “in the red” for that amount of VAT ($0.12) until they can sell their product up the value chain and charge that amount of “downstream” VAT + the VAT they own on the value they added ($0.12 +$0.03 = $0.15). Then with that sale, they get “refunded” the portion of VAT that they paid before ($0.12) and remit the remainder ($0.03) to the government. • All buyers, whether they’re a consumer or a business, pay the VAT. So there is no incentive for anyone to masquerade as anyone else (e.g. a consumer to masquerade as a business). • All businesses process VAT (charged VAT on products they buy, charge VAT on products they sell, and pay VAT to the government) so all businesses are burdened with the maintenance of functions that process this. • Because businesses are charged VAT when they buy products and remain “in the red” that amount of VAT until they can sell those products, they are incentivized to make sure they charge VAT on the products they sell in order to make up that VAT they were already charged (e.g. the manufacturer paid the raw materials producer$0.10 of VAT so it’s incentivized to charge VAT on the products it sells to the retailer to make sure to make up for that $0.10). Because everyone is incentivized to charge VAT on their buyers, “everyone collects the tax for the government.” • This symmetry where everyone in the VAT system charges and is charged VAT doesn’t exist when it comes to cross-border trade, which is discussed below. Sales Tax versus VAT • Most countries (166 out of 193 countries) in the world use VAT. The US uses sales tax and is the only one to do so in the OECD. • Asymmetry creates perverse incentives: In sales tax, only retailers charge sales tax and remit sales tax to the government. Consumers want to masquerade as businesses, retailers are not especially incentivized to make sure that their buyers are charged sales tax, and if there are ways to get around sales tax (remote sales, which include cross-state sales and online sales; wholesaling to consumers ), retailers and consumers might want to do that. In the US, retailers don’t need to charge sales tax to consumers buying in a state in which the retailer doesn’t have a physical presence. In this case, there is a use tax charged on the consumer to make up for this, but compliance of use tax is low. (Source, archived.) Estimates of sales tax lost due to remote sales in 2012 varied up to a high of USD$23 billion where total retail sales that year (excluding food sales because many states don’t charge sales tax) was around USD $350 billion a month, i.e. around USD$4.2 trillion that year.  (Archived, archived, archived.)
• In VAT, all businesses process VAT the same way, so there are no such perverse incentives.
• The big exception to this is cross-border trade, i.e. imports and exports.  Governments have a choice of whether to charge VAT on goods it exports and goods it imports and whether to charge differently for every country it trades with.  This creates a huge potential for asymmetries in the VAT system.
• Imports and Exports:
• Sales Tax countries charge sales tax on imported goods if and when they reach the end-user.  If the imported good is exported again, then it hasn’t reached an end-user, and thus is never sales taxed.
• Both sales tax and VAT are consumption taxes – the purpose is to tax consumption.  This is why the sales tax doesn’t tax a good that is imported and then exported without being consumed in the country.  VAT accomplishes this as well, but also would ideally keep the cross-border trade situation simple and sensible when dealing with other VAT countries or sales tax countries.
• In order to have as symmetric and fair a system of cross-border trade, VAT countries generally:
• Do not charge VAT goods that are exported.  When a good is exported by an exporter, the government refunds the exporter the entire VAT that it paid on its cost of goods sold purchases;
• Charge VAT on goods that were imported on that good’s first subsequent sale that occurs after importation for the full sale value (not just the value added by the importer, which is [sale price – cost of goods sold], but the full [sale price]). I.e. after the importer imports the good, when that importers sells that good, that sales transaction is VAT-taxed for the full sale price.  This is assuming that the imported good is being sold to another domestic company and not being immediately exported.
• Note that if an imported good is exported, the government does not receive any VAT.  This is the same as in sales tax and it accomplishes what a consumption tax is supposed to do (which in the case of a good that is imported and then exported without being consumed in the country is to not tax the good).  Each company in the value chain plays its usual part in the VAT system, but the last one, the exporter, is refunded by the government all the VAT it paid on its purchases of cost of goods sold.

Cross-border VAT

• The reason VAT countries don’t tax their goods upon export is because sales tax countries don’t tax their goods upon export, so this keeps that part of the trade symmetrical.  This also prevents any case of a good being double-taxed during a cross-border trade.
• The reason VAT countries tax their import goods (subsequent to the import transaction) is because if that good is going to be consumed in the country, not VAT-taxing it would mean the good would be untaxed during and after its cross-border transaction and thus have an advantage over similar competing domestic goods at this and every following point on the value chain since domestic goods have been VAT-taxed up to this point and will be VAT-taxed on all following points on the value chain.
• The reason why an imported good’s subsequent sales transaction is VAT-taxed its full sales price instead of just the value added by the importer is because:
• If the good is only taxed by its value-added amount instead, this still is not enough to offset the disadvantage of domestic goods (which have been VAT-taxed for all value that has been added to the product up to that point, not just the value added by the last company to sell it).
• The government of the country in which the good is consumed ought, in principle, to capture the entire consumption tax on the good.  Thus, when the good went across the border and the exporting country’s government refunds the VAT to its exporter, the good is effectively “untaxed” at this point (the exporting country’s government has refunded all previous VAT on it and the importing country’s government has yet to tax any of the value that has so far been added by producers of the exporting country).  By VAT-taxing it by its full sales price after importation, the government of the importing country captures the VAT that the exporting country’s government refunded to its exporter or “resets” the VAT to where it ought to be at this point in the value chain for itself.
• Missing trader fraud/Carousel fraud: A type of fraud that exists when a good is imported into and then exported out of a VAT country without the good being consumed in the country.  Since cross-border trade is a point of asymmetry in the VAT system, it makes sense that this is where fraud occurs.
• Company A imports a good legitimately, paying the exporter EUR 100 for the good.  This transaction is VAT-free.
• Company A sells the good to Company B for EUR 110.  This transaction is VAT-taxed its full sales price (since it is the transaction subsequent to the good being imported and also is not being immediately exported), and Company A owes the government this VAT.  Note that the good in this transaction is “new” to the country and thus the government has not received any VAT from this good further down the value chain (that VAT has been collected by the exporter’s government and refunded back to the exporter).  If the VAT is 20%, that 20% is charged on the full EUR 110 sale price of the transaction (not the value added by Company A, which is EUR 10).  The total price of the transaction with VAT to EUR 132 and the government expects to be remitted a VAT of EUR 22 from Company A for this sales transaction.
• Company B exports the good.  This transaction is VAT-free.  Furthermore, Company B has paid Company A a VAT of EUR 22, so it is entitled to a refund of EUR 22 from the government as the good is being exported and not consumed in the country.
• Company A disappears or goes bankrupt without paying the VAT (of EUR 22) on the sale of goods by Company A to Company B.  This is key to the fraud because Company A is supposed to pay VAT for the full sales price of its sale of the good (20% * EUR 110 = EUR 22), not just VAT of the value added (20% * EUR 10 = EUR 2).  In the diagram above that depicts cross-border trade, the retailer would owe the government $0.15 of taxes, not$0.03 as in the diagrams that are further above that don’t depict cross-border trade.  By Company A disappearing, the government is losing the VAT of all value that has been added to the good by companies from this point and all the way down the value chain.
• With no fraud occurring, the government is supposed to earn 0 tax: charge VAT starting from the importer selling the good to domestic companies but then refund all that VAT to the exporter at the end who exports the good since the good is not to be consumed in the country.  But instead, in this case where Company A disappears, the government has lost EUR 22 by refunding Company B, the exporter, for the VAT that it paid on its purchase of the good.
• In reality, if the importer (Company A) and the exporter (Company B) are working together, the good may never even physically leave the port, and is imported, sold, and exported only on paper.  If there are many companies in between Company A and Company B (e.g. it could instead by A -> X -> … -> Z -> B), it could be difficult for the government to prove any wrongdoing by Company B as the link between A and B will be weak (Company B may even be innocent in some cases where the only fraud is Company A disappearing without paying its VAT) and thus the government will be obligated to refund the VAT to Company B that it paid on its purchases.
• According to sources found in Wikipedia, it’s estimated that the UK annually lost around GBP 2 billion in 2002-2003 (archived) and between GBP 2 billion and GBP 8 billion annually for the years (archive) between 2004 and 2006 due to this kind of fraud.  Total UK retail sales (archived) for these years was around GBP 250 million to GBP 300 million.  For the EU, 2008 estimates were EUR 170 billion lost (archived) due to this type of fraud.  Total EU-27 retail turnover in 2010 was around EUR 2.3 trillion (archived).
• In the above link to a BBC article from 2006, it says that in order to combat the losses from this fraud, the government is implementing a new system where:

Under the new rules the last company to sell on goods like mobile phones – such as a retailer – will be responsible for paying the VAT.

So it sounds like the portion of VAT that the government is “missing” from the imported good will be paid by the retailer instead of the importer – in other words, it’s a bit like the sales tax system.  In this system that’s described, if a good is imported and then exported, the amount that the government would refund the exporter will be smaller than in the previous system, making the fraud much less damaging.  And if the retailer disappears without paying the taxes it owes, that’s the same as a retailer disappearing in a sales tax system without paying taxes, or a raw materials producer in a VAT system disappearing without paying taxes.  (These cases are a much simpler sort of tax evasion and unlike the missing trader/carousel fraud where the importer disappearing and not paying the “missing” chunk of VAT that the government is owed is in combination with the exporter that is “refunded” that chunk of VAT from the government, even though the government never received that chunk of VAT from the missing trader.)

Instead of taxing the importer the “missing” VAT, tax the retailer the “missing” VAT

In Country A, the government refunds the manufacturer/exporter the VAT that it paid on its purchases.  In Country B, the importer is charged VAT only on its value added, and that VAT is remitted to the government.  The retailer is charged VAT on its value added (10% * $0.20 =$0.02) and on the “missing” VAT from the value added to the product prior to importation, which is $1.20 (the price that the importer paid the manufacturer/exporter), so that comes to 10% *$1.20 = $0.12. If the good is exported, refund the exporter as usual If the good is imported into Country B and then exported without reaching a consumer, the amount of VAT that the importer is charged is only on its value added (10% *$0.10 = $0.01). Thus, the amount of VAT that the government refunds the exporter is only that amount ($0.01).  If the importer disappears, the government only loses $0.01, which is 10% of the value added by the importer, not 10% of the full sales price of the product at this point. Furthermore, if the importer and exporter work together and the importer sells the good to the exporter at a much higher price (raising the value added and the potential VAT that the government is supposed to refund the exporter), the exporter still needs to legitimately export the product in order to qualify for the refund. It’s theoretically possible for the exporter to operate at a loss to make this possible, but this might raise an additional red flag that the government would become suspicious of, raising the risk of doing the fraud. Economic Impact of Sales Tax versus VAT Back to the diagrams for no tax, sales tax, and VAT: No tax Sales tax VAT Although only the consumer actually pays the tax in the end, as prices are raised at other transaction points, there is some friction that will discourage those transactions by some amount. One can also think of this as an overhead cost for the businesses involved. In the no tax and sales tax situations, the manufacturer buys goods at$1.00 and sells them at $1.20. In the VAT situation, the manufacturer buys goods at$1.10 and sells them at $1.32, which minus the VAT remitted to the government becomes$1.30.  In both cases, the manufacturer earns a profit of $0.20, but there is an overhead of$0.10 in the VAT case.  An extreme analogy is: if you are a company that makes a profit of $1 on each good you sell, would you rather buy goods for$2 and sell them for $3 to earn your$1 profit or buy goods for $1,002 and sell them for$1,003 to earn your $1 profit? Surely the former is easier and has less friction. Back to the economic interpretation: if the demand and supply curve of a transaction point in a no tax situation is this: then by adding a tax to the transaction, the price is increased. For convenience, we add a second supply curve that is “supply + tax.” While the end result is the same if we left the supply curve alone and added a “demand – tax” curve instead, the supply + tax curve more conveniently takes the hypothetical price of a product sold (the supply curve) and then adds the hypothetical price + tax of a product sold (the supply + tax curve). What one can also do instead of drawing a new curve is take the vertical distance of the final tax per product and “fit it in between” the two curves from the left side of the diagram, and the end result will be the same. (The diagram says “Consumer Surplus” but since this may represent a business-to-business transaction, it’d be clearer to just say “Purchaser Surplus.”) So a tax will cause less quantity to be transacted, a higher post-tax price, some government tax revenue, lower purchaser and producer surpluses, and some deadweight loss. Unless the government tax revenue is spent in a way that can overcome that deadweight loss (e.g. spending on things that have positive externalities), we have an inefficient outcome. So in the VAT system, businesses are contending with higher prices (which is like more overhead) and lost quantity transacted compared to the sales tax system. This is another cost that the VAT system pays (in addition to the missing trader/carousel fraud) in order to have a “symmetric” system where almost everyone in the value chain pays and collects VAT. ## Testing MathJax-LaTeX https://math.meta.stackexchange.com/questions/5020/mathjax-basic-tutorial-and-quick-reference At first, we sample $$f(x)$$ in the $$N$$ ($N\$ is odd) equidistant points around $$x^*$$:

$f_k = f(x_k),\: x_k = x^*+kh,\: k=-\frac{N-1}{2},\dots,\frac{N-1}{2}$

where $$h$$ is some step.

Then we interpolate points $$(x_k,f_k)$$ by polynomial

\label{eq:poly} \tag{1}
P_{N-1}(x)=\sum_{j=0}^{N-1}{a_jx^j}

Its coefficients $$a_j$$ are found as a solution of system of linear equations:
\label{eq:sys} \tag{asdf}

\label{eq:sys2} \tag{asdf2}

Backslash left and right parentheses:

$\left( \frac{1}{2} \right) \qquad ( \frac{1}{2} ) \\ ( \frac{1}{2} )$
$\left( \frac{1}{2} \right) \qquad \left( \frac{1}{2} )$

$$1 \quad \frac ab \quad 2 \quad \frac{c}{d} \quad 3 \quad {e \over f} \quad 4 \quad {}^g/_h \quad 5 \quad i/j \quad 6 \quad$$

$$1+1=2 \textrm{ centered equation } 1+1=2$$

$$1+1=2 \textrm{ left equation } 1+1=2$$

\begin{align}
1 + 1 & = 2.00000000 \textrm{ aligned to character}\\
& = 2.0000000000000000 \\
& = 1.99999999999 \\
\end{align}

Here are references to existing equations: \ref{eq:poly}, \eqref{eq:sys}.
Here is reference to non-existing equation \eqref{eq:unknown}.

X=
\begin{cases}
0, & \text{if}\ a=1 \\
1, & \text{otherwise}
\end{cases}

$$\lim_{x\to 1}$$

$$\lim_{x\to 1}$$

$$default, \it Italics, \bf bold, \sf sans serif, \tt typewriter, \rm default Roman, \it italics$$

$$horizontal spacing: back slash\ comma\, ! \! > \> : \: ; \; enspace \enspace quad \quad qquad \qquad end$$

$$hskip1point \hskip1pt hskip2point \hskip 2pt hskip10point \hskip10pt hskip3point \hskip 3pt 1ex \hspace{1ex} 1em \hspace{1em} 2em \hskip2em lengthofasdf \hphantom{<asdf>} backslash \ tilde ~ end$$

$$\tiny tiny$$

$$default$$

$$\scriptsize scriptsize \small small \normalsize normalsize or default, \large large$$

$$\normalsize normalsize or default, \large large$$

$$\Large Large \LARGE LARGE \huge huge \Huge Huge1$$

$$\Large \LARGE \huge \Huge Huge2$$

$$\Huge Huge3$$

## The Curiously Inscrutable Principles of Trade Mechanics of Europa Universalis 4 (aka another EU4 trade guide)

Prologue

Note: The screenshots use version 1.15 of the game.

0 Tooltips

In general, never blindly trust the tooltips and their numbers.  The descriptions are often more frustrating and confusing than informative.  However, I actually will use screenshots of tooltips where they actually are helpful or where I have been able to decipher them.  I will highlight those tooltips in screenshots as the key to playing this game (or any computer activity that shows you a bunch of numbers on the screen) is to stare at the numbers that are actually useful to the human, since often the screen in EU4 is just an onslaught of numbers that sometimes make sense and sometimes don’t.  Gradually, though, I will attempt to explain all the numbers on the tooltips that appear in the trade node screens and map mode.

I.a Trade Value Produced by a Province

Figure I.a.1: Town A produces salt.  That is town A’s trade value.  Boats take the salt from town A and move them to a market in town B.  Other boats then move them to town C, etc.  Who has control or jurisdiction over the activities of those boats (e.g. through taxing or regulating the merchants who operate the boats)?  Who controls the laws and taxes in these market towns of B and C?  That’s trade power.  Trade value is produced by a town.  Trade power is controlled by the ruler of the country.

Screenshot I.a.1: Granada produces salt.  (Every province produces one and only one type of good.)  The game tells us that 1 unit of salt is worth 3.00 ducats (the bottom-right of the province info screen, under the picture of a pile of salt).  In the bottom-left, it says that the trade value of Granada’s production is 3.60.  Hover your mouse over that, and the tool tip tells us that this comes from 3.60 = 3.00 (value of 1 unit of salt) × 1.20 (units produced by the province).  Where does this 1.20 come from?

Screenshot I.a.2: Granada’s base production.  Hover over where I’ve put a red rectangle and circle on that “6,” and the tooltip tells us that Granada has a base production of 6 and that each unit of base production gives 0.20 units of local production.  This is how Granada produces 1.20 units of goods.  But it doesn’t tell us if this is a monthly or yearly amount…

Screenshot I.a.4: In the Economy tab, the red box I highlighted shows the country’s total Production Income from all the country’s provinces.

Summary: A province’s trade value is measured in ducats and comes from the value of the trade good it produces multiplied by its production amount (which comes from its base production, which Granada has 6).  Modify by modifiers such as technology, production buildings (workshops), etc. and you arrive at the province’s production income.  The country earns this as revenue from this province every month (the 0.37 from above).

While a province produces *trade value* via [trade good × base production] (× modifiers) as we have seen above, a province produces *trade power* by [province development + geographical bonuses + buildings + …] (× modifiers) where we’ll just call the first part flat bonuses, i.e. a province’s trade power = [flat bonuses] (× modifiers).

Screenshot I.b.1: Trade power of the province of Sevilla.  Hover over the “Trade Power 120.4” in the bottom-left.  A province’s trade power comes from its flat bonuses to trade power, and then adjusted by modifiers.

Flat bonuses in Sevilla:

4.60 from “Development” comes from its total provincial development of 23 (boxed in red in the screenshot) and then divided by 5 (apparently, the game just assumes you like doing this kind of mental arithmetic);

10.00 from having an “estuary” comes from Sevilla’s geographical position – some provinces, like Sevilla here, are hardcoded by the game to have a boost in trade power;

another 10.00 from being a “coastal center of trade” is also hardcoded by the game for Sevilla here;

and 20.00 from Port to the New World is from an event (an exception here, so don’t worry about it).

Modifiers in Sevilla:

50% from giving the burghers estate control of the province (not important here);

50% from having a trade building (market place) built in Sevilla;

25% for Sevilla being a coastal province;

and some other modifiers that aren’t important to know what they are at this point (treasure fleet, mercantilism).

Summary: A province’s trade power comes from flat bonuses (development/5 + hardcoded “geographic” bonuses for certain provinces, usually called estuaries or coastal/inland centers of trade + etc.), which are then modified by trade buildings (e.g. market place) and other modifiers.  This gives us the provincial trade power created by a province.  (Note that there is no monthly or yearly rate of creation for trade power.  It’s just a number that represents the amount of “control” over the means of trade that that province provides for its country and ruler.)

There are two inherent parts to a trade node: its trade value and its trade power.  Note that in section I we started with a province’s trade value and trade power.  Now we’re going to trade nodes.

A trade node is basically a geographically partitioned region of the world.  Every province in the world is assigned to one and only one trade node.  So each trade node in the world is made up of a collection of neighboring provinces.  For example, the provinces of Granada and Sevilla and a bunch of other provinces on the Iberian Peninsula are part of the Sevilla trade node.  (The *province of Sevilla* is NOT the “capital” or “center” or anything like that of the *Sevilla trade node*.  The province of Sevilla is simply one province of many provinces that make up the trade node that’s located at the Iberian region.  That trade node just happens to also be called the “Sevilla trade node.”)

So a trade node is made up of a collection of provinces.  The sum of the trade values produced in all the provinces in a trade node is the trade value of that trade node.  Another name for this is the “Local” trade value of the trade node.

Screenshot II.a.1: Trade Value of a Trade Node.  Go to the trade map mode and click on the Sevilla trade node.  Hover over where it says “Local    +7.29” on the left.

Screenshot II.a.2: Trade Value of a Trade Node.  By hovering over the value of “Local,” we get a list of all the trade values of all the provinces in the Sevilla trade node.  We can find Granada’s trade value in the list, 0.30 monthly and 3.60 yearly.  The total monthly trade value of the Sevilla node contributed by the trade values of provinces in the node is 7.29.

Note that in a way, the trade value produced by a province has been double-counted in the game.  First, it turns into production income that the owner of the province earns directly (back to Screenshot I.a.3.):

But it also enters the trade node that the province is a part of and becomes this entity called Trade Value or “Local” Trade Value of a Trade Node (back to Screenshot II.a.2.):

The simple way to think about this is to pretend that each unit of salt in the game actually represents two portions of salt.  One portion is sold locally for cash and the other portion is shipped to the nearest major trading area, i.e. the trade node that the salt-producing province is a part of, where it’s sold to traders who are part of the global trading market.  Note that the first portion of salt has been immediately and fully converted to cash while the second portion of salt has entered the global market so that it’s likely that it will be sold and bought and sold and so on by different people anywhere in the world that trade flows to.  Who knows where that portion of salt will end up?  Note that we – rulers of this salt-producing province (e.g. Spain in the screenshots) – have not seen the cash revenue for this second portion of salt yet.  That is to be earned at a later stage of the trade game.

(A more precise way to think about this double-counting in my opinion is to pretend that production income from producing a good (the part that’s immediately converted to cash) is actually a “production tax” that you charge producers in your provinces.  For every unit of salt produced in a province, you charge the salt-producing factory 3.00 ducats as a production tax.  The salt-producer then sells that salt to some traders on boats, who move it around the world (the salt becomes trade value in a trade node).  At some point along this trip around the world, a ruler can charge a sales tax on the transaction of salt between merchants, also at 3.00 ducats per 1 unit of salt.  We haven’t gotten to the part yet about where and who can charge this sales tax on salt transactions.)

The trade power of a trade node is made up of different countries’ trade power in that node.  Here, it matters whose trade power a unit of trade power is (i.e. it matters now whether it’s Portugal’s trade power or Spain’s trade power in the Sevilla node).  Furthermore, trade power comes from different sources.  The different sources are:

1) provincial trade power (as mentioned above in I.b),

3) light ships protecting trade in the trade node (if it’s a sea node), and

4) the presence or not of a merchant in the trade node (very small flat +2.0 trade power).

6) Also, there are events that just seemingly randomly give you bonuses out of thin air.  So we’ll just ignore these in this guide.  (These are likely hardcoded by the game for certain countries, like Spain getting trade bonuses for exploring the New World).

Note that provincial trade power in a trade node can only come from your owning a province in that trade node.  Everything that was used to explain I.b gives us this number for each province.  So, just for now, pretend that there is only provincial trade power and ignore all the other sources of 2) ~ 6) from above.  The state of trade power in the simplified Sevilla trade node would be like this:

Figure II.b.1: Provincial Trade Power in the Sevilla node.  Portugal holds 13.6/139.1 = 9.8% and Spain holds 125.5/139.1 = 90.2% of the trade power in the Sevilla node.

What the hell is “trade power transferring/propagating upstream?”  Different trade nodes are connected by links and each link has a direction of flow to it.  For example, the Tunis trade node is linked to the Sevilla trade node and has an arrow pointing from Tunis to Sevilla.  I.e., the Tunis trade node is upstream of the Sevilla trade node.

Screenshot II.b.2.1: The Tunis node upstream of the Sevilla node.

This is the game hardcoding that “trade wealth flows from Tunis to Sevilla.”  To put it another way, “trade in Sevilla is more powerful than in Tunis,” and one way this is manifested in the game is by this “trade power transferring/propagating upstream” mechanic.  What happens is that countries who have (at least 10) provincial trade power in Sevilla will have 20% of that provincial trade power in Sevilla “propagated” to upstream nodes like Tunis.  So out of nowhere, Spain gets 125.5 × 20% = 25.1 trade power in Tunis and Portugal gets 13.6 × 20% = 2.72 trade power in Tunis just because the arrow on the trade map mode points from Tunis to Sevilla.

Figure II.b.2.1: Provincial trade power of each country in a downstream node (Sevilla) is “propagated upstream” (to Tunis).  Note that Portugal’s trade power of 13.6 > 10, so it just barely made the cutoff for this upstream propagation.  If Portugal’s trade power were 9, then it would get 0 trade power propagated upstream to Tunis.

Summary: Tunis is upstream of Sevilla.  “Trade wealth” flows downstream from Sevilla to Tunis, i.e. trade in Sevilla is “more powerful” than trade in Tunis.  So having provincial trade power in Sevilla automatically grants you 20% of that amount of trade power up in Tunis.

This amount of upstream propagation from the Sevilla trade node is the same for all trade nodes that happen to be upstream of the Sevilla node.  The Safi, Ivory Coast, and Caribbean trade nodes are also upstream of the Sevilla node, so Spain and Portugal would also respectively get 25.1 and 2.72 trade power in every one of these nodes in addition to the Tunis node.  There is no propagation effect from Sevilla to any nodes that are downstream of it, like the Genoa node.  The upstream propagation only goes upstream by one link.  Thus, Spain’s provincial trade power in the Sevilla node that propagates up to the Tunis node won’t propagate further up to the Katsina node even though Katsina is upstream of Tunis.  (If Spain has provincial trade power in Tunis, then that amount of provincial trade power would propagate upstream to the Katsina node.)

Figure II.b.2.2: Upstream propagation is the same amount in all upstream nodes.

You can see how a country dominating (via having a lot of provincial trade power in) a trade node that is downstream to a lot of other nodes is powerful because that country will get bonus trade power in all those neighboring upstream trade nodes.  Note that it’s only *provincial* trade power in a trade node that gets this upstream propagation.

Screenshot II.b.2.2: Spain has 207.5 provincial trade power in the Sevilla node.  (That column tells us the amount of provincial trade power that each country has in the node.  I think the icon for the column is supposed to represent the shapes of provinces next to each other on a map.)

Screenshot II.b.2.3: Now, let’s look at the Safi node, which is upstream of the Sevilla node.  Mousing over the 166.5 in the right-most column (this column tells us the total trade power in the node of each country), we get a tooltip.  One of the items is “Transfers from traders downstream: +41.5”.  This comes from Spain’s provincial trade power downstream in the Sevilla node, where 207.5 × 20% = 41.5.  Spain having provincial trade power of 207.5 in the Sevilla node has given it 41.5 trade power in the Safi node.

Screenshot II.b.2.4: Looking at the Genoa node, here, Spain has 185.7 provincial trade power.  If you mouse over the blue arrow pointing left, it says, “Trade propagation reduction: -80%.”  I believe this is the game’s obscure, inscrutable way of telling us that there is 20% provincial trade power upstream propagation originating from here.

Screenshot II.b.2.5: Looking at the Tunis node.  The Tunis node is directly upstream of both the Sevilla node and the Genoa node.  Thus, Spain has 207.5 × 20% (from Sevilla downstream) + 185.7 × 20% (from Genoa downstream) = 78.6 trade power in the Tunis node from “upstream propagation.”

Screenshot II.b.2.6: Going back to the Sevilla node, if you mouse over the yellow plus sign, the tooltip tells us nothing about the upstream propagation that is happening from here.  Both Genoa in the screenshot above and Sevilla here are nodes that are causing upstream propagation.  We’re mousing over the same location in the table, Spain’s second column from the left, yet we’re not getting info about the upstream propagation here in the Sevilla node screen.  This is why you can’t trust the tooltips.  (We’ll get to what the plus sign and the green arrows mean later.)

II.b.3,4,5) Other Sources of Trade Power

We also note that somehow, France, the Papal State, and Savoy have some trade power in this node, even though they have 1.) no provincial trade power and thus also 5.) can’t have their main trading city here to make it a home node, 3.) light ships, or 4.) merchants here (0s in those two columns).  Knowing all the above, we know that the only way they could have trade power here is by 2.) having provincial trade power in the Genoa node that’s propagating upstream to Sevilla or 6.) some other random bonuses, maybe from special events, who knows.

Screenshot III.1: The Basra node.  Basra has a link incoming from the Hormuz node (Basra is downstream of Hormuz) and outgoing links to the Aleppo and Persia nodes (Basra is upstream of Aleppo and Persia).

Note on the left the little table that lists Incoming, Local, Total, and Outgoing.  Whatever that all means…  But this is actually a crucial indicator that helps us understand what’s going on in a trade node.  These tell us the flow of *trade value* within a trade node.  “Incoming” is trade value that has somehow by some mechanic (to be explained soon) flown from upstream nodes (i.e. Hormuz) down into our node in question (Basra).  “Local” is what we figured out before in II.a: it’s the total trade value (aka “Local” trade value in a trade node) produced by provinces that are geographically located in this trade node.  Thus, “Incoming” + “Local” is the actual total trade value that exists in the trade node.  For Basra here, it’s 1.89 + 3.13 = 5.02 ducats.  (Ignore the “Total” label that appears in the table for now, as that will be explained soon.)

A) “Collect” it for income (either because that’s your home node where you automatically collect or because it’s not your home node but you place a merchant there to collect. The game calls both of these actions “collecting” or “retaining” trade value in the trade node.) (My intuitive interpretation of this action is that a Spanish merchant collecting in a node is a Spanish government representative placed there to collect sales tax on the trade occurring there between Spanish traders.)

B) “Transfer it downstream or steer it as it goes downstream” (or as the game calls it, “transfer trade power,” “transferring,” “transporting forward,” or “steering.” I prefer to call it steering.  The terms “transferring” and “steering” will be used interchangeably in this guide to mean the same thing.). (My intuitive interpretation of this action is that a Spanish merchant steering trade in a node is a Spanish government representative placed there to enforce a mercantilist policy of only allowing Spanish traders in this node to interact with other Spanish traders that do business in a downstream node.)

C) Not use your existing trade power in a node to claim any of the trade value there. (This occurs in a special situation, described in IV.b.1.) If this happens, other countries will still use their trade power in the node to proportionally claim that portion of trade value that you aren’t claiming.

The amount of trade value that has been steered/transferred to downstream nodes is the “Outgoing” amount in that table on the left side of the trade node screen and the amount of trade value that has been “retained” (i.e. collected) in a trade node is the “Total” amount in that table.  So “Incoming” + “Local” – “Outgoing” = “Total”.  This is the trade flow in a trade node.  I think of “Local” as “locally produced trade value” and “Total” as “remaining or collected trade value in the node.”  For Basra above, it’s “Incoming” (1.89) + “Local” (3.13) – “Outgoing” (2.66) = “Total” (2.35).

Screenshot III.2: Spain’s Trade Power in Basra.

Here, Spain has 38.2 trade power, seen in the right-most column of that table.  If I hover over the yellow portion in the pie chart on the right, it says “Spain has 22% of the Trade Power among countries Collecting from Trade.  Their trade power is 38.29.”  The first sentence is confusing.  Spain is not collecting from trade here.  We also see that in the map, in the top row of the sign/icon for the Basra node (around the center of the screen, a bit to the right), it says “38.2   (21%)”.  So some rounding of numbers is going on.  So ignore the confusion and just take the info that Spain has either 38.2 trade power here, which is 21% of the total trade power, or 38.29 trade power here, which is 22% of the total trade power.  Close enough.  Let’s go with the former.

From this info, what we know is that we can use our 21% of trade power in the Basra node to “claim” (and do something with) 21% of the total trade value in the Basra node.  Again, the total trade value that exists in the Basra node is “Incoming”(1.89) + “Local”(3.13) = 5.02 ducats.  So we have a claim to 5.02 × 21% ducats if all other countries are also claiming their share of the trade value here to either collect/“retain” or transfer downstream.  But if some countries aren’t claiming their share of trade value with their trade power, then there’s more trade value up for grabs for all the other countries that are claiming trade value.  (This situation will be described below in IV.b.1.)  So if Spain is collecting or transferring (in the screenshot, Spain is transferring in the node) and at least one other country is not claiming their share of trade value here, then Spain will be able to claim more than 5.02 × 21% ducats here.  Let’s look at all the possible actions for a country in a trade node.

IV Merchant Actions in a Trade Node

At a trade node, you can either have no merchant there, a merchant collecting there, or a merchant steering trade (“transferring trade power”) there.  Any country who has a trade node within its trade range can put a merchant there to collect or transfer, so it’s very common for a given node to have many merchants there from different countries.  However, a country can at most place one of their merchants at a node (so you can’t both collect and transfer in a single node or put two merchants to simultaneously collect or simultaneously transfer there).  In end nodes, you can only place a merchant there to collect.  For your home node:

Let’s momentarily go back to the home node at Sevilla.  In your home node, you automatically collect from there even without a merchant.  If you place a merchant there to collect (and you can only choose to collect at your home node.  No transferring/steering), you get a 10% bonus to the amount of ducats you collect there.

Screenshot IV.a.1: Sevilla node.  In the first column of the table, you might see an icon of a house (meaning that a merchant is here collecting), an icon of a ship and wagon (a merchant is here transferring/steering), or a dash.  In the second column of the table, you might see either a yellow plus sign (collecting), a green arrow pointing right (transferring downstream), or a blue arrow pointing left (propagating upstream).  Here, we see that Spain has a dash and a yellow plus.  This is Spain’s home trading node, so Spain is collecting (the yellow plus) but has chosen not to place a merchant here for the 10% bonus income.  This is also Portugal’s home node, and we see that they are collecting (the yellow plus) and have placed a merchant here (the house icon) for the 10% bonus income.

Note however that Spain and Portugal also have provincial trade power here, so they are also propagating 20% of that trade power upstream, but the blue arrow pointing left isn’t shown anywhere.  Thus, don’t trust the tooltips.  Lack of a blue arrow doesn’t mean that countries here aren’t propagating trade power upstream.  But the two columns here do tell us the countries’ actions: Spain’s dash and plus sign mean that this is Spain’s home node and Spain has not placed a merchant here, while Portugal’s house icon and plus sign mean that this is Portugal’s home node and Portugal has placed a merchant here for the +10% bonus to income.

If you have no merchants collecting in any of your non-home trading nodes in the entire world, for every merchant that is transferring in any non-home node in the entire world, you get an extra +10% bonus trade power modifier in your home node.  Don’t ask me why.  Example:

Screenshot IV.a.2: We have no merchants collecting in any non-home nodes and have merchants transferring in Alexandria, Constantinople, and Safi.  The tooltip for Spain’s trade power modifier (mousing over where it says 111.9%) tells us that we get a +10% bonus to trade power in Spain’s home node of Sevilla for each of these three merchants transferring.  (The merchant in Alexandria is steering trade value to Genoa, which is downstream of Sevilla, so none of that trade value gets to Sevilla, yet we get this bonus in Sevilla.  Go figure.)

If you have even one merchant collecting in any non-home nodes in the entire world, no matter how many merchants you have transferring trade in non-home nodes, all of the abovementioned 10% bonus trade power modifiers in your home node disappear.  Don’t ask me why.

Example:

Screenshot IV.a.3: We have merchants in Tunis and Venice collecting.  The tooltip for Spain’s trade power modifier (where it says 81.9%) tells us that there is “No transfer bonus due to merchant collecting in Tunis.”  For whatever reason, we aren’t told that we also have a merchant collecting in Venice…  In any case, if there is even one merchant collecting anywhere in the world that is not your home node, this is what you’ll see in the home node trade power modifiers.

If you have a merchant collecting at your home node (i.e. providing you with a 10% bonus to trade income at your home node), this will not cause these +10% trade power bonuses at your home node from merchants transferring in other nodes to go away.  It is only if you have a merchant collecting in a non-home node that the +10% trade power bonuses at home go away.

Screenshot IV.a.4: We have a merchant collecting in Sevilla for the 10% bonus income at our home node, and merchants transferring in Alexandria, Constantinople, and Safi.  We still get the +10% bonus to trade power from each merchant transferring at those three nodes.

This means that there may be a moment in the game when you’re wondering tactically whether to collect from a non-home node for extra income or maintain all merchants to be transferring trade in different nodes so that you get this boost in trade power in your home node (and thus a boost to your income from your home node).

Screenshot IV.a.5: In the trade tab, the big number in the top-right tells you your total trade income.  Trade income comes from your automatic collection at your home node and other merchants collecting in non-home nodes.  The numbers on this screen (and many other numbers in the game) update on the first of every month.  So try different configurations for your merchants and see how the big number changes.  This trial and error is often the best way to tell what’s best for your country at the moment.

IV.b Non-Home Trading Node with No Merchant Collecting or Transferring There

I am going to call both your home node (where you automatically collect) and non-home nodes where you’ve placed a merchant to collect: “collection points” or “nodes that you collect in.”

IV.b.1 The Node is Not Upstream of Any of Your Collection Points, and You Don’t Have a Merchant There

If the node is not upstream of any of your collection points (even via multiple links) and you don’t have a merchant placed at that node, the game just assumes that you aren’t going to bother claiming trade value in that node.  This is the special situation mentioned in III C).

Figure IV.b.1.1: We collect in nodes A and B.  Node C goes to D, which goes to E, A, and J.  Node J is an end node.  Node E goes to B, which goes to G and H.  Node H also goes to A.  Node A goes to F, which then goes to K and L, which are end nodes.  Nodes C, D, E, and H are upstream of nodes we are collecting in (to be precise, C, D, E, and H are all upstream of at least one node we are collecting in).  Nodes F, G, L, K, and J are not upstream of any nodes we are collecting in.  This section is relevant to nodes like F, G, L, K, and J.  (Note that node H is downstream of a node we are collecting in, but as long as it is also upstream of a node we are collecting in, node A here, then it isn’t relevant to this section.  Also, I don’t say “nodes that are downstream of all nodes that you are collecting in,” since then:

Figure IV.b.1.2: assuming node A is an end node here, node G isn’t “downstream of all nodes you collect in” since it isn’t downstream of node A, but it’s still relevant here.  The technical point is that node G is not upstream of any of your collection points.

In a way, it makes sense that you might forfeit the use of your trade power in nodes F, G, L, K, and J.  If you don’t have a merchant collecting in F, G, L, K, or J, you aren’t trying to directly gain income there.  And if you don’t have a merchant transferring at F (you can’t place a merchant to transfer at end nodes K, L, G, or J), the game interprets that as your saying that you don’t care how the trade value flows after F since none of that trade value downstream of F can possibly get to any of your collection points anyway.  So for nodes F, G, L, K, and J, if you don’t have a merchant there, the game mechanic will automatically have you not use your trade power to claim your share of trade value there.

Screenshot IV.b.1.1: The Champagne node.  Spain has a dash and a blue arrow pointing left.  The blue arrow pointing left technically is supposed to mean that “Spain is transferring trade power upstream,” but this isn’t important nor helpful here, since Spain has 0 provincial trade power in Champagne here and is thus propagating 0 × 20% = 0 trade power to upstream nodes Rheinland and Bordeaux.  When you see a dash and a blue arrow in the same row, it means that the country has no merchant here and the node is not upstream of any of the country’s collection points.  I’m mousing over the yellow slice of the “Trade Power” pie chart.  Spain has 10% of the trade power in the Champagne node, but Spain is not using that 10% trade power to claim their share of the trade value here.

Screenshot IV.b.1.2: I’m mousing over the green pie of the “Retained Trade Value” pie chart.  It shows France with 54%.

Screenshot IV.b.1.3: I’m mousing over the red portion and it shows the Netherlands, Great Britain, the Papal State, and Savoy.

The “Retained Trade Value” pie chart is badly labeled.  I would call it “Claimed Trade Value.”  As you can see, Spain is missing from this pie chart as it wasn’t mentioned in the above 5 countries.  That’s because Spain hasn’t claimed its trade value here.  Green + red in that pie chart is the amount of trade value that has been claimed in this node by countries that are claiming here.  Green is the share of trade value that has been claimed and collected in this node (via automatic home node collection or non-home node merchant collecting) and Red is the share of trade value that is claimed and is being transferred downstream.  Spain is not claiming any trade value here, so it isn’t part of this pie chart.

IV.b.2 The Node is Upstream of Any One of Your Collection Points, and You Don’t Have a Merchant There (and No One Else Has a Merchant Transferring There)

Back to Figure IV.b.1.1:

So now we’re talking about nodes C, D, E, and H.

Screenshot IV.b.2.1: Back to the Basra node.

Hormuz flows to Basra, which flows to Aleppo and Persia.  Basra is not my home node and I have no merchant there.  I have 22% of the trade power here.  Note for now how it says “We transfer 1.18 ducats to Aleppo,” whatever that means.

Screenshot IV.b.2.2: Note that the flags under the trade node’s “main sign”/icon or whatever it’s called (where it says “37.9 (21%)” on the first line and “2.3” on the second line) show the countries that either have a home node here or don’t have a home node here but have a merchant here collecting.  There are no flags under the two smaller signs each saying “1.32,” which means that there are no countries that have placed a merchant here to transfer/steer to Aleppo or Persia.

I’m currently mousing over the red part of the pie chart on the left.  Of the trade value in this node that has been claimed by countries, Spain has claimed 24% of that.  The total trade value in this node up for grabs is “Incoming” 1.86 + “Local” 3.13 = 4.99 ducats, so 4.99 × 24% = 1.20 ducats.  This is slightly off from 1.18 ducats but is probably from rounding that the game does.  So Spain has claimed 1.18 ducats of trade value in this node.  Other countries in this node that aren’t collecting but have claimed their trade values are Tabarestan and the Ottomans.  The red part of the pie chart is 53% of 4.99, so that is 4.99 × 53% = 2.64 ducats claimed by these three countries.  There are no merchants transferring/steering here, so Tabarestan and the Ottomans also simply don’t have a merchant here.  Note that Spain, Tabarestan, and the Ottomans all have a dash and then a green arrow pointing right in the first two columns.  This means that these countries don’t have a merchant here but are “transferring trade downstream.”  What this means is that the combined claims of Spain, Tabarestan, and Ottomans cause 2.64 ducats of trade value in this trade node to be transferred downstream (which is why it says “Outgoing: -2.64” on the left) without preference, i.e. equally between Aleppo and Persia.  That is why we see that 2.64/2 = 1.32 ducats are flowing each to Aleppo and Persia.  Of that 2.64 ducats that are “Outgoing,” Spain is causing 1.18 ducats of that.  That also means that Spain is causing 1.18/2 = 0.59 ducats to flow to each of Aleppo and Persia.  (This is why the “We transfer 1.18 ducats to Aleppo” message is confusing.  It should be something like “We cause 1.18 ducats to flow out of Basra downstream.  And in the tooltip, say: Specifically, 0.59 of that is going to Aleppo and 0.59 of that is going to Persia.”)

IV.c Non-Home Trading Node with a Merchant Transferring There

Now, let’s place a merchant in a node to “Transfer Trade Power.”

Screenshot IV.c.a: I’m at the Basra node and click “Transfer Trade Power” and select a merchant.

Screenshot IV.c.b: Then I see this while I wait for the merchant to arrive in Basra.  I can’t choose whether to put him on the link to Aleppo or Persia while the merchant is still traveling.  (And if you try to send another merchant to Basra when the screen looks like this, the game will try, but in the end only the last merchant you send will matter.  The earlier merchants will magically teleport back to “Free” status.)  Once the merchant arrives, he’ll appear on one of the downstream links, and you can then instantaneously move him to steer on any one of the downstream links or to collect in the node, but you have to wait until the first of the next month to see the change in the numbers.

IV.c.1 Only One Merchant Transferring at a Node

Screenshot IV.c.1.1: Here, we have a merchant in Basra steering to Aleppo.  The “sign”/icon that says “3.03” is the link between Basra and Aleppo.  The red check mark means I have a merchant steering on this link.  Under that there is a small Spanish flag, showing that there is a Spanish merchant here.  Under the “sign”/icon that says “0.00” for the link between Basra and Persia, we see no flag underneath it, so there is no merchant steering here.  Note that in the table at the bottom-left of the screen, Spain has a “ship and wagon” icon and a green arrow pointing right.  This means that Spain has a merchant in this node transferring/steering trade.  We are the only one here with a merchant steering.

Note that the “Incoming”, “Local,” “Outgoing”, and “Total” numbers on the left have changed slightly from before due to some months passing.  Spain currently has 23% of the total trade power here and has claimed 25% of the trade value here.  So Spain has claimed [2.13 (“Incoming”) + 3.13 (“Local”)] × 25% = 1.31 ducats of trade value here.  Note how it says, “We transfer 1.31 ducats to Aleppo,” which I suppose can be interpreted to be technically correct.  Now we look at the sign that says “3.03.”  What has happened is that by having the only merchant here transferring, Spain actually now gets to steer all 2.84 Outgoing ducats in the direction that Spain wants to direct them.  Even though Spain only has the trade power to claim 1.31 ducats here, Spain having the only merchant here transferring overrules that in terms of steering trade, allowing Spain to decide where all the downstream trade steers to.  Other countries that have no merchants collecting or steering here but have claimed trade value with their trade power (Tabarestan and the Ottomans) cannot influence where their claimed trade value steers downstream to.  We have all 2.84 ducats going to Aleppo instead of divided equally between Aleppo and Persia due to the Spanish merchant steering here.  The growth of 2.84 to 3.03 is because:

Screenshot IV.c.1.2: I’m currently mousing over the “3.03.”  The first line of the tooltip is saying that 2.84 is the original amount of trade value that is “Outgoing” out of Basra.  The second line means that 100.00% of that is going to Aleppo due to the one Spanish merchant steering here.  The third line means that 53.90% of trade power among countries that are claiming trade value in this node (Spain, Tabarestan, and the Ottomans) are using it to transfer their claimed trade value downstream.  In other words, this just tells us the amount of the red portion of the pie chart on the left.  The fourth line tells us that the Spanish merchant somehow is able to apply a +6.90% bonus to the trade value that it steers from Basra to Aleppo.  This comes from:

Screenshot IV.c.1.3: In the trade tab, there’s an item called Trade Steering, which here shows 38.1% (coming from Spain’s Naval Tradition).  One merchant steering trade on a route applies a bonus of 5% to the trade value modified by Trade Steering.  So 5% × (1 + 38.1%) = 6.90%.  (Although the Trade Steering bonus comes from Naval Tradition, it applies to any link between nodes that your merchant is steering, even when steering from an inland node to another inland node.  Shrug.)

IV.c.2 Merchants Working in Different Directions

If one merchant is steering trade in one direction and another merchant in another direction, the two countries of those merchants will fight over the “Outgoing” trade value using their country’s trade power in the node to determine how much of the trade value flows to where.  Countries who don’t have merchants collecting or transferring/steering in the node but have their claimed trade value flowing downstream – as described in the previous section – can’t decide where their outgoing trade value flows to.  Let’s look at it in action.

Screenshot IV.c.2.1: Let’s look at the Tunis node.  There are a bunch of countries collecting here (either because it’s their home node or it isn’t their home node but they have placed a merchant here to collect).  Portugal is the only country transferring, and it’s steering trade to the Sevilla node.  Because it’s the only one steering here, 4.30 ducats are going to Sevilla and 0.00 are going to Genoa.  Let’s place a merchant here to steer towards Genoa.

Screenshot IV.c.2.2: Our merchant is at Tunis steering towards Genoa.  I’m mousing over the “0.83” that’s highlighted with a red oval and box, the Tunis to Sevilla route.  What the tooltip tells us is that of all of the 4.09 “Outgoing” trade value, 19.50% of that is going to Sevilla (0.83/(3.52+0.83) ≈ 19.50%, probably to do a rounding error).  Of all the trade value that initially exists at Tunis, which is 0.00 “Incoming” + 4.93 “Local” = 4.93, 83.00% of that has been claimed by countries that are letting it transfer downstream.  And the Portuguese merchant has a 5.20% bonus to trade value that he steers.

Screenshot IV.c.2.3: I’m now mousing over the “3.52” that’s highlighted with a red oval and box, the Tunis to Genoa route.  What the tooltip tells us is that of all of the 4.09 “Outgoing” trade value, 80.40% of that is going to Genoa (3.52/(3.52+0.83) ≈ 80.40%).  Of all the trade value that initially exists at Tunis, which again is 0.00 “Incoming” + 4.93 “Local” = 4.93, 83.00% of that has been claimed by countries that are letting it transfer downstream (this is the same as the above.  Hasn’t changed).  And the Spanish merchant has a 6.90% bonus to trade value that he steers.

Thus, Spain and Portugal are fighting over the “Outgoing” 4.09 trade value at this node.  Spain has 213.6 trade power here and Portugal has 68.0.  Thus, Spain gets to decide that 213.6/(213.6 + 68.0) = 76% of that 4.09 trade value will go to Genoa (plus a +6.90% bonus to that trade value), while Portugal gets 24% of 4.09 to go to Sevilla (plus a +5.20% bonus to that trade value).  From the table, we see that France and The Papal State don’t have merchants here but are having their claimed trade value flow downstream.  Thus, while they are contributing to trade value to flow out of Tunis, they aren’t deciding on where it goes to, Sevilla or Genoa.  Only Spain and Portugal are deciding that because they are the only ones that have placed merchants to steer here.

IV.c.3 Merchants Working in the Same Direction

What if Spain and Portugal both steer trade from Tunis to Sevilla?

Screenshot IV.c.3: Now, both the Spanish and the Portuguese merchant are steering towards Sevilla.  I’m mousing over the 4.45.  Below that, we see both the Spanish and Portuguese flags, showing that these two merchants are steering on this link.  Of the Outgoing 4.10 ducats, 100.00% of that is going on this route.  Now what happens is that the bonuses that each merchant applies to the trade value on this link changes.  The first merchant still starts at 5% modified by their country’s Trade Steering bonus (Portugal), resulting in 5.20%.  The second merchant starts at 2.5% modified by their country’s Trade Steering bonus, so for Spain we have 2.5% × (1 + 38.1%) = 3.4%.  This goes on until the fifth merchant steering on the same link.  For more: http://www.eu4wiki.com/Trade#Multiple_merchant_bonus.

IV.d Non-Home Trading Node with a Merchant Collecting There

When placing a merchant to collect in a non-home node, your trade power in the node is halved, and then that amount of trade power is used to claim trade value for direct income, plus modifiers (called Trade Efficiency in the game).

Screenshot IV.d.1: Now, let’s have our merchant in Tunis collect there.  I’m mousing over the 106.6.  Note that our trade power here has halved compared to the 213.3 trade power from the previous screen when we were transferring trade.  Somehow our modifier here is -11.3%, shown in the column to the left.  We’ll mouse over that in the next screenshot.  Now that we are collecting here (with our halved trade power), we are now one of the countries that is “retaining” trade value here, so note how the green in the pie chart on the left has increased compared to before.  Also, using our trade power, we have shifted trade value from “Outgoing” to “Total.”  Spain’s icons down in the table, a house icon and a green arrow pointing right, means that there is a merchant here collecting in a non-home node.  It doesn’t make sense why it’s still the green arrow (which is supposed to mean transferring trade downstream).

Screenshot IV.d.2: Mousing over the -11.3% now.  Our total positive (green) modifiers here are +77.4%.  So when we didn’t have a merchant collecting here, we had: 120.2 trade power from trade power sources × 177.4% modifiers = 213.3 trade power.  Our halving modifier from collecting here is applied to this final 213.3 and thus takes away 213.3/2 = 106.6 trade power.  So, effectively, if we pretended that this halving modifier was an additive modifier like the other green modifiers that get applied to the original 120.2 trade power, it is doing -106.6/120.2 = -88.7%.  Thus, our total additive modifiers is +77.4% – 88.7% = -11.3%.  Thus, the halving modifier is (confusingly) expressed as -88.7% in the tooltip.

Summary: So first, as noted in IV.a, a merchant collecting in any non-home node voids all possible +10% bonuses to trading power at your home node that come from other merchants transferring in other nodes.  Second, as noted here, a merchant collecting in a non-home node also first reduces your trade power there by half before you get to collect trade value as income.

V Tactics and Strategy

The simplest ways to increase trade power in a node is to increase provincial trade power by conquering other provinces in the node, increasing trade power in the provinces (buildings, modifiers like mercantilism), and building light ships to protect trade in the node if it’s a sea node.  You should mainly target provinces in a node that have those hardcoded bonuses, like estuaries and “centers of trade,” as those flat bonuses pretty much always make them the key provinces to control in the node for the sake of trade power.  Just owning those few provinces in the node can often get you majority trade power in the node.

V.b Basic Steering

Back to Figure IV.b.1.1.  We collect in nodes A and B.  Assume that there are no other merchants from other countries steering at any nodes in the figure.  So D’s Outgoing is divided equally between J, A, and E.  If we were to place a merchant at node D to steer trade, in which direction would we want to steer it to?

Clearly not J, since then the trade value isn’t going anywhere that we’re collecting.  If J wasn’t an end node and instead led to other downstream nodes but none of them led to our collection nodes, we still know that we wouldn’t want to steer to J.  We want to steer trade value towards our collection nodes – this is basic steering.

How to choose between steering to A or E?

See Appendix below for unnecessary math used to show that:

**The answer is not J and then trial and error between A and E by looking at the trade tab on the first of the month, lol.**

V.c Steering Towards Your Home Node or Collecting at a Non-Home Node.  A Trade Power Threshold for Your Home Node?

Early on, you might have a home node and one other non-home node and you might have decent trade power in both.  Should you use a merchant in the non-home node to transfer towards your home node or should you collect at that non-home node?  This is a question I had from the get-go and is also a common question I see by others, and for good reason, since it’s basically what you encounter at the beginning of the game.

See Appendix below for unnecessary math used to show that:

**The answer is use trial and error by looking at the trade tab on the first of the month, lol.  The best answer to this question is “just try both out.”**

V.d What To Do About Nodes that Aren’t Upstream of Any of Your Collection Points

Back to Figure IV.b.1.1: I’m talking about those F, G, L, K, and J nodes.  I’ll also call these nodes “strictly downstream” nodes just because it’s less unwieldy.

If you aren’t worried about the erasure of the +10% trade power bonuses at home from merchants transferring at other nodes, you can collect at these strictly downstream nodes.  It’s a comparison of whether you have enough trade power at the strictly downstream nodes to warrant a merchant collecting there, or if your home node is rich enough in trade value and you have enough pre-modified trade power at your home node such that those +10% bonuses in trade power at home get you more income.

If F connects to further downstream nodes and there are rivals you are competing against that are collecting either at F or further downstream:

if there are rivals downstream of F, you might place a merchant to steer trade at F if you can steer it away from their collection nodes or at least in a way that it helps your rivals the least;

if there are rivals collecting at F, you might place a merchant at F simply to steer it in any direction downstream so that at least you’re claiming your trade value there and letting it flow out of F (remember that if you don’t place a merchant at a node that is strictly downstream of your collection points, the game will cause your country to not claim any of the trade value there).

Note that as long as you dominate your home node of A (say you basically have 100% trade power there), then you’ll simply collect all the trade value that’s flowing to A and none of it will flow downstream to F.  Increasing your trade power % in A is the best, but increasing in both A and F are useful.

V.e Web/Net vs. Trail/Route

VI Other Stuff

Other Recommended Guides:

A comprehensive guide with screenshots.  Also, check out /u/Llama-Guy’s comment where he makes some points.

/u/issoweilsosoll’s Trade – a case study

The final form of the trade “trail” strategy.  The real TL;DR of trade in EU4 is to try to copy this, basically.  Even if you don’t understand or don’t want to understand any of the details of trade mechanics, this guide and demonstration alone will help a lot for the general feeling.

Don’t use the version at the top of that page.  Use this corrected version in the comments here:

VII Appendix

The following isn’t recommended if you aren’t interested in pointless math.

V.b Basic Steering

Back to Figure IV.b.1.1.  We collect in nodes A and B.  Assume that there are no other merchants from other countries steering at any nodes in the figure.  So D’s Outgoing is divided equally between J, A, and E.  If we were to place a merchant at node D to steer trade, in which direction would we want to steer it to?

Clearly not J, since then the trade value isn’t going anywhere that we’re collecting.  If J wasn’t an end node and instead led to other downstream nodes but none of them led to our collection nodes, we still know that we wouldn’t want to steer to J.  We want to steer trade value towards our collection nodes – this is basic steering.

How to choose between steering to A or E?

Which is larger,

(2/3 × D’s Outgoing) × (our trade power % in A)

vs.

(2/3 × D’s Outgoing) × (trade power % of countries in E that are transferring trade value downstream) × (our trade power % in B)?

Rearranging, we get:

(Our trade power % in A) vs. (trade power % of countries in E that are transferring trade value downstream) × (our trade power % in B),

where if the first is larger, we transfer to A, and if the second is larger, we transfer to E.  Where do we steer?

**The answer is not J and then trial and error between A and E by looking at the trade tab on the first of the month, lol.**

You can do the math in the last equation above, but in-game, modifiers and other nations steering and whatnot are gonna screw with the final result.  But the basic conclusion is as expected (and a bit obvious), which is that in a chain of trade nodes, trade value originating from a far-away node gets multiplied by (trade power % in in-between nodes that are transferring trade value downstream) (which will always be ≤ 1, of course) at each in-between node.  So to maintain a chain of trade value flowing back to your home node, you want to try to dominate every one of those trade nodes.

V.c Steering Towards Your Home Node or Collecting at a Non-Home Node.  A Trade Power Threshold for Your Home Node?

Early on, you might have a home node and one other non-home node and you might have decent trade power in both.  Should you use a merchant in the non-home node to transfer towards your home node or should you collect at that non-home node?  This is a question I had from the get-go and is also a common question I see by others, and for good reason, since it’s basically what you encounter at the beginning of the game.

A’s “Incoming” (trade value) × Our trade power % at A =

A’s “Incoming” × x =

“B’s “Outgoing” × x =

(B’s “Incoming” + “Local”) × (Trade power % at B of all countries transferring downstream) × x =

(B’s “Incoming” + “Local”) × (Our trade power % at B + trade power % at B of other countries transferring downstream) × x =

(B’s “Incoming” + “Local”) × (Y/(Y + U + V) + V/(Y + U + V)) × x

If we collect at B, y goes down by some amount to a new value, which we’ll call y’ (aka “y prime”).  We have y’ = (Y/2)/(Y/2 + U + V).

(The change from y to y’ is an amount that is hard to predict.  We have:

y = Y/(Y + U + V), so U + V = Y/y – Y

y’ = (Y/2)/(Y/2 + U + V) = (Y/2)/(Y/2 + U + V) = (Y/2)/(Y/2 + Y/y – Y) = (1/2)/(1/2 + 1/y – 1) = (1/2)/(1/y – 1/2) = 1/(2/y – 1)

Plotting this gives:

https://www.wolframalpha.com/input/?i=plot+1%2F(2%2Fx+-+1)+from+x+%3D+0+to+1

where the horizontal axis is y before collecting and the vertical axis is y’.  Generally, y’ is about 0 to 0.17 below y.  Here is another way to look at it:

https://www.wolframalpha.com/input/?i=plot+(1%2F(2%2Fx+-+1))%2Fx+from+x+%3D+0+to+1

where the horizontal axis is y before collecting and the vertical axis is y’/y.  So when y starts out large (near 1), y’ is also not that much smaller.  But when y is small, y’ can be almost half of y.)

The amount of trade value flowing from B to A coming from our trade power at B disappears (since we are now collecting at B).  Our trade power of Y/2 at B is now used to collect.  A trade power of U is still collecting at B (the other countries collecting there), and a trade power of V is still transferring trade downstream at B (the other countries transferring downstream there).  So now, V/(Y/2 + U + V) is the share of trade power used to transfer trade value from B down to A.  So the amount of income we earn at A due to trade flow from B to A is:

(B’s “Incoming” + “Local”) × V/(Y/2 + U + V) × x

The amount of income we earn at B due to collecting at B is:

(B’s “Incoming” + “Local”) × (Y/2)/(Y/2 + U + V) =

(B’s “Incoming” + “Local”) × y’

Thus, (Income due to trade flow from B to A while collecting at B) vs. (Income due to trade flow from B to A without a merchant at B) is:

(Income from collecting at B) + (Income at A due to trade flow from B to A) vs. (Income at A due to trade flow from B to A without collecting at B)

After dividing (B’s “Incoming” + “Local”) from both sides of the “vs.”:

(Y/2)/(Y/2 + U + V) + V/(Y/2 + U + V) × x vs. (Y/(Y + U + V) + V/(Y + U + V)) × x

(If you want to change the right-hand side to (Income due to trade flow from B to A with a merchant steering from B to A), you can add a 1.05 multiplier to that side, but I won’t do that here.  Continued:)

(Y/2)/(Y/2 + U + V) + V/(Y/2 + U + V) × x vs. (1 – U/(Y + U + V)) × x

(Y/2)/(Y/2 + U + V) vs. (1 – U/(Y + U + V)) – V/(Y/2 + U + V)) × x

If we let u = U/(Y + U + V), u’ = U/(Y/2 + U + V), and v’ = V/(Y/2 + U + V), we have:

y’ vs. (1 – u – v’) × x

y’ vs. (1 – (u + v’)) × x

Note that while u’ > u and v’ > v, it’s always true that 1 ≥ u’ + v’.  So 1 ≥ u + v’ and thus (1 – (u + v’)) ≥ 0.

Let’s say we dominate trade power in B.  That means both u and v’ are small so that (1 – (u + v’)) is close to 1, so we basically have something close to

y’ vs. x

If y’ is larger than x, then we collect at B.  Otherwise, we don’t collect at B.  y’ is our post-collection trade power % at B, so it’s simply saying that if we dominate trade at B so much that our post-collection trade power % at B is larger than our trade power % at A, then collect at B.  (This is probably unlikely since usually, you have more trade power % at your home node A when you start the game.)  If we dominate trade power at B even post-collection but we also dominate at A, then it’s a straight comparison between these two values.

Back to y’ vs. (1 – (u + v’)) × x

If we don’t dominate trade power in B, u + v’ is larger, (1 – (u + v’)) becomes smaller, and so the left-hand side becomes relatively larger, meaning that collection at B becomes more likely to be better compared to when we did dominate trade power in B.  However, of course, this all depends on x, our trade power % at our home node A, which is likely to be larger than y or y’ in most early game periods.  What the above is saying is that if we don’t dominate at B (and thus (1 – (u + v’)) is some value between 0 and 1), but we are strong enough at A (x is large), it’s still better not to collect at B.  But if we aren’t strong enough at A, then it’s better to collect at B by just locking in an income at B instead of letting it flow to A and fighting over it again with our trade power % of x at A.

A simple example with numbers: say that at node B, we have 10 trade power. Other countries transferring trade downstream at B have 10 trade power, and other countries collecting at B have 20 trade power.  So we have 10/40 trade power at B, or 25%.  As long as we are not collecting at B, (10 + 10)/40 = 50% of trade power at B is being used to transfer downstream and 20/40 = 50% to collect at B.  Our current income at A is (B’s Incoming + Local) × 50% × x.  Once we’re collecting at B, we have 5 trade power at B, giving us 5/35 = 14% trade power share at B.  There is 10/35 = 29% trade power share of other countries still transferring trade downstream at B now.  So our income at A now is (B’s Incoming + Local) × 29% × x and our income at B is (B’s Incoming + Local) × 14%.

So income during collection at B is 0.14 + 0.29 × x and income before collection was 0.50 × x.  When x < 0.66, it’s better to collect at B, and when x > 0.66, it’s better to not collect at B.  This shows us that even if you have 25% trade power at B, to make it worth steering from B to A in the purest circumstances (instead of collecting at B), you need more than 66% trade power at A.  Otherwise, just collect at B.

For a more realistic/general situation, let’s say node B is upstream of node A and but has b downstream links, one of which is to A.  Like before, we have y trade power % at B, coming from Y trade power that we have, U trade power of other countries collecting, and V trade power of other countries transferring trade downstream so y = Y/(Y + U + V).  Again, assume that there are no merchants steering at B.  So initially, trade value of 1/b × B’s Outgoing is flowing to each of B’s downstream nodes, including A.  Including the 5% bonus that a merchant steering gives to trade value on its link:

Placing a merchant to collect at B vs. Placing a merchant at B to steer from B to A:

(Income from collecting at B) + (Income at A due to trade flow from B to A) vs. (Income at A due to trade flow from B to A with merchant steering from B to A):

(Y/2)/(Y/2 + U + V) + (1/b) × V/(Y/2 + U + V) × x vs. 1 × (Y/(Y + U + V) + V/(Y + U + V)) × x × (1 + 5%)

y’ + (1/b) × v’ × x vs. 1 × (1 – u) × x × (1 + 5%)

Now even more generally, allow merchants from other countries to steer at B, let f = the percent of (B’s Incoming + Local) that flows to A when we have a merchant collecting at B, let g = the percent of (B’s Incoming + Local) that flows to A when we have a merchant steering from B to A, let h = the sum of additional percent bonuses that other countries’ merchants steering on the B to A route provide to trade value on that link, and j = the additional bonus percent we provide to the trade value in the B to A link by placing our merchant to steer on that link.  Then, we have:

y’ + f × (1 + h) × x vs. g × (1 – u) × (1 + h + j) × x

So how do we choose what to do?

**The answer is use trial and error by looking at the trade tab on the first of the month, lol.  The best answer to this question is “just try both out.”**

The intuition provided by the above simple example (the one with x > 0.66) probably still holds though, which is that domination of your home node is the most important thing to have when you want to start thinking about a global steering strategy.  Next most important would be domination at your nodes closest to your home node in the connections, and so on.  If A is your home node and A <- B <- C <- D, dominating trade power in C doesn’t help as much if you aren’t also dominating trade power in B, and of course most of all at A.  Until then, mindlessly collecting at all non-homes nodes could be worth it.

Here is a messy in-game example:

Table 1

Spain’s home node is Sevilla, where it has no merchant, and then it has 9 merchants in non-home nodes that I generally felt were where Spain had the best presence.  Other than Sevilla, Spain is collecting in Genoa and Constantinople since it has decent trade power in those high trade value nodes.  The other merchants are generally steering towards one of these collection points.  Ignoring modifiers and bonuses, total trade income from the three collection points is 17.68 + 8.68 + 9.86 = 36.22.  In-game, with all the modifiers and bonuses obviously, the total trade income was actually 63.43.

If we were steering at Constantinople and Genoa, we get the +10% bonus to trade power at Sevilla per merchant steering elsewhere (for a total of +90% trade power at Sevilla).  Our trade power at Sevilla becomes 1423 and the total trade power at Sevilla becomes 2114, giving us 67% trade power there.  The total trade value at Sevilla in the above table is 34.  Genoa is downstream of Sevilla so steering there won’t change the trade value at Sevilla.  Constantinople is upstream of Sevilla and has 17 trade value.  If all 17 of that could be steered straight to Sevilla, that means we obtain (34 + 17) * 0.67 = 34.3 trade income (before modifiers) at at our only collection point, Sevilla.

Table 2

I then switched things so that all 9 merchants are collecting in non-home nodes.  Ignoring modifiers and bonuses, total trade income from the ten collection points is 39.23.  If we choose to take the merchant in Ragusa (who is collecting the least) and put him in Sevilla for the 10% income bonus at home there, the total trade income becomes 40.88.  In-game, with all the modifiers obviously, the total trade income was actually around 61.8 with a collector at Ragusa and 62.3 after moving him to Sevilla.

(Also, for a moment, let’s take away Constantinople and Genoa and pretend that those two nodes are completely off-limits to us (since including them makes collecting from them obviously lucrative).  In such a scenario, only our home node of Sevilla is a node where we have a lot of trade power and that has a lot of trade value.  Then, having all merchants steering (to get the bonus trade power at the home node of Sevilla) should be better than having all merchants collecting in the other less valuable nodes.  If we have a very significant presence (but not totally overwhelming dominance that is close to 100%) at our home node and at all other trade nodes we have either little trade power or the nodes are poor in trade value, every bit of additional trade power at home increases our income a lot there.  Thus, we’d basically be placing merchants to steer at other nodes more for the bonus to income at home than the additional trade value that gets steered to our home node.)

What I’m trying to demonstrate is not the differences in total income between the scenarios, but how similar the incomes are despite the first strategy attempting an optimal balance between collecting and funneling, the second briefly-described and approximated strategy of steering everywhere and only collecting at home, and the third strategy of blindly “collect everywhere, forget about steering.”  But it’s another example of how real domination of your home trading node (or collection points in general) is needed before worldwide trade-steering strategy becomes much more important and powerful than ignoring everything and simply collecting with all your merchants even though it may feel like the least strategic method.  The real answer to all of this is still to just do trial and error, of course.