# Stackelberg Competition Matlab Problem

This is an extension to the problem I asked in a previous question which can be seen here, Economic price optimisation problem.

I have programmed a function in MATLAB to solve the Stackelberg competition problem set up in the question linked above. The problem has to be solved numerically which is why I decided to use MATLAB. The profit functions for the two Firms in competition are below, where the subscript number denotes the firm.

$$\Pi_1(p_1,p_2)=\frac{25p_1}{(p_1-0.6p_2)^{1.1}}-0.0815[\frac{25}{(p_1-0.6p_2)^{1.1}}]^{1.9}$$ $$\Pi_2(p_1,p_2)=\frac{25p_2}{(p_2-0.6p_1)^{1.1}}-0.0645[\frac{25}{(p_2-0.6p_1)^{1.1}}]^{1.9}$$

The code for the function I programmed to solve this can be seen below.

function y = OptimalPrices(p1, epsilon)
% Function finds optimal prices p1 and p2 for Stackelberg competition

% initial value

x = 1;
p1_guess = p1;

while p1_guess < 10;
left_init = 0.5314*p1_guess + 0.7368; %left limit has to increase with the p1 guess
p2 = MaxPi2(p1_guess, left_init, 6, 0.00001); %calculates p2 value
Pi1 = f1_prof(p1_guess, p2); %finds Firm 1 profit using the p1 and p2 values
p1vals(x) = p1_guess; %stores p1 value in a vector
p2vals(x) = p2; %stores p2 value in a vector
Pi1vals(x) = Pi1; %stores Pi1 value in a vector

if imag(Pi1vals(x))>0 %if result is complex, sets equal to 0
Pi1vals(x) = 0;
end

%increments
x = x+1;
p1_guess = p1_guess + epsilon;

end

[Pi1max, pos] = max(Pi1vals); %finds biggest Firm 1 profit and its position in vector
p1opt = p1vals(pos);
p2opt = p2vals(pos);

% Display results
p1opt
p2opt

Firm1_Profit = f1_prof(p1opt, p2opt)
Firm2_Profit = f2_prof(p1opt, p2opt)

end

As you may have noticed, nested within this function is another function titled $MaxPi2$. This solves the maximisation problem, $max _{p_2} \Pi_2(p_1,p_2)$, using the Bisection Method. The code for this can be seen below.

function p2 = MaxPi2(p1,l,r,epsilon)
% Finds value for p2 that maximises Pi2, using Bisection Method
% Looking for when the derivative of Firm 2's profit function is 0

% 'l' is the left end of the interval; 'r' is the right end
% epsilon is the precision parameter

% values of function at the ends
fl = f2_prof_prime(p1, l);
fr = f2_prof_prime(p1, r);

if fl*fr>0  % check that solution within the interval
p2 = 0;
else
p2 = (l+r)/2;
dist = (r-l)/(1+abs(p2));
% iterations
while dist>=epsilon % while the length is large
f = f2_prof_prime(p1, p2);
if fl*f<0       % left half of interval
r = p2;
fr = f;
else            % right half of interval
l = p2;
fl = f;
end
p2 = (l+r)/2;
dist = (r-l)/(1+abs(p2));
end

end
end

If I run the function $OptimalPrices(0, 0.0001)$, I get the following results, where $p_1$ and $p_2$ are the optimal prices set by the firms in this Stackelberg competition.
$$p_1=3.6150$$ $$p_2=3.1521$$ $$\Pi_1(p_1,p_2)=37.8202$$ $$\Pi_2(p_1,p_2)=50.0166$$ These results clearly show that Firm 2 will make a higher profit overall. Now, I was taught the "First Mover Advantage", that is, the Firm that sets its price first will make higher profits overall. I would just like to know if that is always the case, since although Firm 1 moves first in this competition, Firm 2 is making more profit? Does that mean my results are wrong somewhere? Or would Firm 2 actually make more profits in this case?

Consider a two-person game, where each player chooses an action. Suppose that the two players choose simultaneously, model this as a game in strategic form, and assume that there is a unique Nash equilibrium. Let $u_i^*$ be the expected payoff to Player $i$ in the equilibrium of the simultaneous-move game.

Suppose now that the same game is played sequentially, with the second player observing the choice of player 1 before deciding her action. Assume again that there is a unique Nash equilibrium (usually found by backwards induction) and denote by $u_i^s$ the expected payoff to Player $i$ in the equilibrium of the sequential version of the game.

The First Mover's Advantage (FMA) is the claim that $u^s_1 \ge u^*_1$; that is, Player 1 achieves higher equilibrium payoffs by moving first in the sequential version of the game than in the simultaneous version of the game. This follows immediately because Player 1 might choose the same action in the sequential version as in the simultaneous-move version, and be sure to achieve at least $u^*_1$.

The above does not imply (or even talk) about the claim that 1 should attain higher payoffs than 2, and thus your result is not a priori inconsistent wiht FMA.

A common cause of misinterpretation is that the FMA is often presented with reference to a symmetric game of quantity competition, where $u^*_1 = u^*_2$ by symmetry. Then one is led to think that FMA is about $u_1^s = u^*_1 \ge u^*_2$.

However, things are subtler than this in at least two respects.

1) If the game is not symmetric, 2 may still do better than 1. For instance, suppose that 2 has lower costs than 1 in a price competition game. By moving first in a sequential game, 1 can improve his payoffs compared to the simultaneous-move game, and yet 2 may still be making higher profit than 1 because of her lower costs. Note that in your example 2 has lower costs.

2) When the game are symmetric, the comparison between $u^s_1$ and $u^s_2$ does not depend on who moves first but on a property of the best reply functions. If both players' best replies are increasing in the opponent's move, the game has strategic substitutes and $u^s_1 \ge u^s_2$. On the other hand, if both players' best replies are decreasing in the opponent's move, the game has strategic complements and $u^s_1 \le u^s_2$; that is, Player 2 has higher payoffs than Player 1 who moves first. Note that your example is a game with strategic complements.

In the Stackelberg competition where firms set price sequentially, it is not rare for the second firm to have a better payoff if the demand functions are not symmetric. In your case firm 2 has lower total costs and therefore, it is likely it will have higher total profits.

• Thankyou Peter. Apr 24 '18 at 15:26