Using the python class, try simulating the production and consumption behavior of self-sufficient farmers very roughly and easily ① Condition setting

This time I made a simulation of a self-sufficient farmer. In ①, we will explain the settings, and in the next , we will explain the code. I omitted the theoretical explanation of farmer behavior this time (I wrote it, but I erased it because it was hard to read).

What I want to do this time

Last time, we simulated the existence of one farmer and one consumer, and two people producing and consuming agricultural products through the market. To represent price fluctuations, we have decided to increase the price of crops with high consumption in the previous term by about 1.01 times and the price of crops with low consumption in the previous term by about 0.99 times. However, (1) the equilibrium price was not calculated when calculating the next price, and (2) the price fluctuated due to the influence of production and consumption behavior → the change in production and consumption behavior → the price fluctuated. ・ Points where consumption was not stable This time I simplified the price fluctuations because I had a problem with. Also, as a new element, this time I will try to simulate "self-sufficient farmer behavior".

In order to reflect the above situation, we have taken the following steps. ① Make a class "Autarky (self-sufficient)". (2) Fix the price at the initial price and let it produce and consume. (3) See the reaction after the price increase of cash crops. (4) Look at the reaction after the price of consumer goods has fallen. (5) See the reaction after the price increase of cash crops and the price decrease of consumer goods.

Theory about self-sufficient farmers

There are not many self-sufficient farmers in Japan, so I think the reason for the existence of self-sufficient farmers is unclear. However, under certain conditions, self-sufficient farmers can emerge. I tried to explain the theory, but I stopped because it was long. See Janvry (1991) for more information. Well, roughly speaking, self-sufficient farmers who have difficulty entering the market make their own major grains to eat.

Class (description of characters)

Class Autarky (self-sufficient farmer)

Feature 1: Produces self-sufficient grain A and cash crop B. Feature 2: It owns the production factors of labor and fixed capital, and allocates them to the production of A and B. In addition, part of the labor force will be allocated to non-agricultural work to earn wages. Feature 3: (1) Randomly allocate production factors to produce A and B to earn agricultural income, and at the same time, earn extra-farm wages through non-farm labor. (2) Purchase luxury goods o based on agricultural income and non-agricultural wages, and calculate the utility at that time. (3) Repeat the specified number of times (1) and (2), and record the factor distribution when the utility is the largest.

Class Market (God-like existence that causes price fluctuations)

Feature 1: Raise the price of cash crop B by 50 yen. Feature 2: Reduce the price of luxury item o by 50 yen.

Production function, profit function and utility function

Production function

Q_A = 3*L_A^{0.3} +K_A^{0.7} \\Q_B=1*L_B^{0.7} +K_B^{0.3}

L: Labor force (L = LA + LB + Ln + l) K: Fixed capital (K = KA + KB)

Profit function

\Pi = p_B*Q_B+w*L_n

Ln: Labor spent on non-farm labor w: Non-agricultural wages pB: Price of B QB: B production

Utility function

U = Q_A^{0.2}+C_o^{0.45}+l^{0.35}

QA: A production (self-sufficiency) Co: Consumption of luxury items such as Netflix l: Leisure time (l = L-LA-LB-Ln)

Price changes

1st to 10th period: Maximize utility at initial price 11th to 20th period: B price rises by 50 to maximize utility 21st to 30th period: The price of o is reduced by 50 to maximize utility. 31st to 40th period: The price of B rises by 50, and the price of o falls by 50 to maximize utility.

Closing words

I tried to simulate under the above condition settings. There are many points that I would like to make minor improvements, but let's proceed little by little. In addition, if I mention the problem of this simulation in advance, it is the method of the optimization problem. See you next time.

References

~ Paper ~ [1]Alain de Janvry, Marcel Fafchamps and Elisabeth Sadoulet(1991) “Peasant household behavior with missing markets: some paradoxes explained” Economic Journal. Vol.101, pp.1400-1417.

Recommended Posts

Using the python class, try simulating the production and consumption behavior of self-sufficient farmers very roughly and easily ① Condition setting
Using the python class, try simulating the production and consumption behavior of self-sufficient farmers very roughly and easily ② See the code and results
Using the python class, try to roughly simulate the production behavior of 1 farmer and the consumption behavior of 1 consumer ① ~ Time to explain the conditions ~
Using the python class, roughly simulate the production behavior of one farmer and the consumption behavior of one consumer ② ~ Time to see the results ~
Try using the collections module (ChainMap) of python3
Try hitting the Twitter API quickly and easily with Python
Get and set the value of the dropdown menu using Python and Selenium