## Wednesday, June 24, 2015

### Alphas and Betas in IO table assuming CD function

We have already derived the Alphas (here) and Beta (here). The main reason for this post is to find out the Alphas and Betas in the Input Output Table under the assumption of Cobb Douglas functions.

In this IO table in algebraic expression is given below.

In the values, Lets define this above table as:

The Alphas are the parameters in Cobb Douglas Function. Remember we assumed both the utility and production as CD function:

\begin{align} & \frac{{{P}_{i}}{{X}_{ij}}}{\sum{{{P}_{i}}{{X}_{ij}}}}={{\alpha }_{ij}} \\ \end{align}

Or, in other words for CD function, the alphas are the initial share of ith commodity/factors in total inputs of j-th industry.Therefore, in the table we can derive the alphas as:

Note:  Within this table of Alphas, we have named ALPHACOM (share of ith commodity in total inputs of j-th industry) and ALPHAFAC (share of ith factors in total inputs of j-th industry).

The definition for Betas are shares. See my previous post for Betas (here). In this IO table the Betas are:

Note: Within the above table of Betas, We have named BCOM (share of j-th industry in total demand for i-th commodity), BHOUS(share of household in total demand for i-th commodity) and BFAC(share of j-th industry in total demand for i-th factor).

Check my video post below:

## Tuesday, June 23, 2015

### How to make an IO table so that GEMPACK can read?

Data for GEMPACK models (for example, input-output tables or parameters such as elasticities) are normally stored on files called Header Array (or HAR) files. So, Lets make an Input Output Table as a Header Array (HAR) extension file.

Lets assume in a closed economy there are two industry ${{I}_{1}}$ and ${{I}_{2}}$. Say ${{I}_{1}}$ produces commodity ${{S}_{1}}$ and ${{I}_{2}}$ produces commodity ${{S}_{2}}$. To produce, they need the factors of production ($FOP$) say Labor $L$ and capital $K$. These  $FOP$ are supplied by the household ($HH$), let me index household by ${{I}_{0}}$. We assume that there is no government and all the income of household is spent on the consumption of commodity ${{S}_{1}}$ and ${{I}_{2}}$.

Have a look on the IO table which we are going to make as HAR file.

Here is my video post on How to make a HAR file?

In the next blog post, I will discuss on writing the first CGE programming codes, then I will show how to run a first CGE with the labor shock in an economy.

## Monday, June 22, 2015

### Warm Up on Computable General Equilibrium Theory (Before We Start Coding)

Before we start a basic CGE, please be comfortable with:
1. Input Output Table in quantities and notation
2. Input Output Table in Dollar Values and notation
3. The namig of IO table (DVCOM, DVFAC, DVCOMIN, DVFACIN and HCONS)
3. The consumer's and producers problem, their optimum solution and linearized solution
4. Commodity and factor market clearing condition and their linearized solution
5. The concept of household income (We have assumed all the income will be spent in consumption).
6. Walrus Law
7. Why we set Price $P$ as $1$.
8. The properties of all the linearized solutions.

Here is the glimpse of problem, optimum solution and linearization.But prior to that one should understand the logic of Input. Output table. Here is the link (here).

 Problems Optimum Solutions Linearized Solution Consumer’s Problem \begin{align} & {{U}_{\max }}=\prod\limits_{i=1}^{2}{X_{i0}^{{{\alpha }_{i0}}}} \\ & s.t. \\ & Y=\sum\limits_{i=1}^{2}{{{P}_{i}}{{X}_{i0}}} \\ \end{align} Where, $\sum\limits_{i=1}^{2}{{{\alpha }_{i0}}}=1$ and ${{\alpha }_{i0}}>0$. ${{X}_{i0}}=\frac{{{\alpha }_{i0}}Y}{{{P}_{i}}}$ ${{x}_{i0}}=y-{{p}_{i}}$ Here is the link for solution (here). Producer’s Problem \begin{align} & \min {{C}_{j}}=\sum\limits_{i=1}^{4}{{{P}_{i}}{{X}_{ij}}} \\ & s.t. \\ & {{X}_{j}}={{A}_{j}}\prod\limits_{i=1}^{4}{X_{ij}^{{{\alpha }_{ij}}}} \\ \end{align} for j=1 and 2 and $\sum\limits_{i=1}^{4}{{{\alpha }_{i1}}=1;}\sum\limits_{i=1}^{4}{{{\alpha }_{i2}}=1;}{{\alpha }_{ij}}>0$ \begin{align} & {{X}_{ij}}={{\alpha }_{ij}}{{X}_{j}}Q\prod\limits_{i=1}^{4}{P_{i}^{{{\alpha }_{ij}}}}/{{P}_{i}} \\ & where, \\ & Q=\left( \frac{1}{{{A}_{j}}}\prod\limits_{i=1}^{4}{\alpha _{ij}^{-{{\alpha }_{ij}}}} \right) \\ \end{align} Here is the link for solution (here). ${{x}_{ij}}={{x}_{j}}+\sum\limits_{i=1}^{4}{{{\alpha }_{ij}}{{p}_{i}}}-{{p}_{i}}$ Here is the link for solution (here). Price Formation ${{P}_{i}}=\lambda =Q\prod\limits_{i=1}^{4}{P_{i}^{{{\alpha }_{ij}}}}$ ${{p}_{i}}=\sum\limits_{i=1}^{4}{{{\alpha }_{ij}}{{p}_{i}}}$ Here is the link for solution (here). Commodity Market Clearance $\sum\limits_{j=0}^{2}{{{X}_{ij}}={{X}_{i}}}$ for i=1 and 2 ${{x}_{i}}=\sum\limits_{j=0}^{2}{{{\beta }_{ij}}{{x}_{ij}}}$ Here is the link for solution (here). Factor Market Clearance $\sum\limits_{j=1}^{2}{{{X}_{ij}}={{X}_{i}}}$ for i=2 and 3 ${{x}_{i}}=\sum\limits_{j=1}^{2}{{{\beta }_{ij}}{{x}_{ij}}}$ Here is the link for solution (here). The Household Income $Y={{P}_{3}}{{X}_{3}}+{{P}_{4}}{{X}_{4}}$ Drop the equation using walrus law Discussed below. Price ${{P}_{1}}=1$ ${{p}_{1}}=0$ Discussed below.

Here is a quick video to get you started:

## Sunday, June 21, 2015

### Non Linear Estimation of Bass Diffusion Model on Real Dataset of Mobile Subscription per 100 Person

In my previous blog (here), we have discussed about the theory of Bass Diffusion Model and saw some visualization. Now, in this blog, I will show how can we perform a non linear regression estimation on data. I will use the mobile subscription data from the World Bank Database (here) and try to find the market size $m$, coefficient of innovation $p$ and coefficient of imitation $q$ for the mobile subscription for Nepal. You can also used these codes by citing my blog to identify those parameters in the context of your country.

I have included the video post:

In summary we have found the market size is 110 subscription per 100 person. You must have two mobiles, I guess.The coefficient of innovation was close to zero and coefficient of imitation was 0.52 and all of these parameters were significant. The R square was 0.99 which shows a close fit of model with actual data. We performed the Shapiro-Wilk normality, Jarque Bera normality test, run test, DW test and in-sample forecast accuracy checks.Finally, we estimated that for Nepal nearly after 20 years from 1999 ie 2019, the total market size will be realized. Here is plot of what we found.

## Thursday, June 18, 2015

### The Diffusion of Innovation (Theory and Visualization of Bass Model)

The Bass Diffusion model is named after Bass’ 1969 paper “A new product Growth for Consumer Durables”. This is one of the most cited paper worldwide. It has its role on understanding how a new product diffusion occurs in a society. But Later on it was extensively used to analyze the innovation diffusion on a society.

Here is my video post, I hope you want to go with video before you start to read the entire blog:

This model assumes: 1. there is no repetitive purchase or consumer purchase for one time i.e consumer durable good; 2. there is no supply shock and; 3. the probability that an initial purchase will be made at $T$i.e given that no purchase has yet been made $P\left( T \right)~$ is a linear function of the number of previous buyers.
$P\left( T \right)~~~=\text{ }p\text{ }+\text{ }\left( q/m \right)Y\left( T \right)\to (1)$
Where $p$ and $q/m$ are constants.$Y\left( T \right)$ is the number of previous buyers.

For $T=0$, $Y\left( 0 \right)=0$, then constant $p$ is the probability of an initial purchase at $T=0$ and its magnitude reflects the importance of innovators in the social system. Or $p$ is the fraction of all adopter who adopts products as it launches.

Say, $m$ is the size of potential market size then $(q/m)$is the portion of market who has not yet purchased the product.

$(q/m)$ times $Y(T )$ reflects the pressures operating on imitators as the number of previous buyers increases.

Interestingly, $Y(T)/m$ is portion of total purchase at time$T$. Let’s denote this by $F(t)$. i.e
$\frac{Y(T)}{m}=F(T)$
Let’s denote the likelihood of purchase at $T$as$f(t)$, then we can write $F(t)=\int\limits_{0}^{T}{f(t)dt}$

Now, by definition for $p(T)$ (The probability that an initial purchase will be made at $T$ i.e given that no purchase has yet been made) can be written as:
$\frac{f(T)}{1-F(T)}=P(T)=p+(q/m)Y(T)=p+qF(T)$
Now, let’s solve for $f(t)$ only,
\begin{align} & f(T)=[p+qF(T)][1-F(T)] \\ & or,f(T)=p-pF(T)+qF(T)-q{{[F(T)]}^{2}} \\ & or,f(T)=p+(q-p)F(T)-q{{[F(T)]}^{2}} \\ & or,f(T)=\frac{dF}{dt}=p+(q-p)F(T)-q{{[F(T)]}^{2}} \\ & \therefore {F}'(T)=p+(q-p)F(T)-q{{[F(T)]}^{2}} \\ \end{align}
This above equation is non linear differential equation, I have solve this equation and find out the value of $F$ and presented an interactive plot below. I want readers to change the sliders $p$, $q$ and $m$ and see what happens to the curve. The $p$, $q$ and $m$ are coefficient of innovation, coefficient of imitation and potential size of market.

In the next blog post, I will do some non linear econometrics and estimate the values of $m$, $p$ and $q$ based upon the real dataset.

If your browser fails to open this file, please kindly open externally (here).

Here is a stylized picture:

## Tuesday, June 16, 2015

### Non Linear Regression in Logistic Growth Model with Real World Population Data

Let’s do a Gaussian non linear estimation for the Logistic Growth Model based on the world population data. Prior to this blog, you should at least be familiar with the Malthusian model (here, here, here) and derivation of Logistic Growth Model (here).

The assumption of an exponential growth rate for world population in Malthusian model is not very practical because we cannot expect that the population of fish will grow exponentially in a fish pond. The fish pond has its own carrying capacity same the Earth. In this blog we will consider equation of Logistic Growth Model which considers the carrying capacity and estimate the parameters. Therefore we can answer following

1. The relative growth rate of population growth  along with its Standard Error (S.E)
2. Carrying capacity of Earth and its S.E
3. In what time the Earth will realize such carrying capacity

I imported the data from following web (here). However, you can find the txt data (here) and R code (here). In the following tutorial video, I have discussed about the estimation of parameters for the Gaussian non-linear model.

The Estimates are given below
Estimate     Std. Error  t value Pr(>|t|)
po 2.397e+00   9.935e-03   241.26   <2e-16 ***
k   2.793e-02   4.313e-04   64.76   <2e-16 ***
N   1.203e+01   2.732e-01   44.03   <2e-16 ***

The initial population estimates is 2.4 billion. The estimate of growth rate is 2.79 (but the growth rate declines as the time passes) and the carrying capacity is 12.03 billion. All the p-values are close to zero therefore all of these estimates are significant.

Further, I forecast the scenario based upon these parameters for 250 year ie from 1950 till 3000 AD and plotted against the actual data from 1950:2010.

## Monday, June 15, 2015

### Logistic Population Model

Prior to this blog, you are requested to view my blog on Malthusian Growth model derivation (here), visualization (here) and non linear estimation (here).

The Malthus Growth model for population assumes the growth rate is forever increasing. The population of fish in a pond will not increase forever because the pond has its own carrying capacity. In this blog, I will develop the model including the carrying capacity then develop an interactive visual.

Here is my video post:

Instead of assuming the growth rate is forever increasing, Logistic Population Model assumes that the relative growth rate i.e $\left( \frac{1}{P}\frac{dP}{dt} \right)$ decreases linearly i.e $\left( k-mP \right)$ as population rises.  This equation can be expressed as:
\begin{align} & \left( \frac{1}{P}\frac{dP}{dt} \right)=k-mP\to (i) \\ \end{align}
This equation resembles a linear relationship is $\left( Y=C+mX \right)$, if you remember from high school math where, $\left( C \right)$ is Y-intercept and $\left( m \right)$ is the slope or the rate of change of Y w.r.t X or $(slope=\frac{\Delta Y}{\Delta X}=\frac{dY}{dX})$ . Here, $Y=\left( \frac{1}{P}\frac{dP}{dt} \right)$ and $\left( X=P \right)$ .

Now, let’s analyze$\left( k-mP \right)$, here $\left( k \right)$ is Y-intercept and $\left( m \right)$ is the slope or the rate of change of Y w.r.t X or $(slope=\frac{\Delta Y}{\Delta X}=\frac{dY}{dX})$. Let’s see a plot:

If Y intercept is $\left( k \right)$and X intercept is$\left( N \right)$ then slope $\left( m \right)$can be represented as$\left( \frac{k}{N} \right)$. Hence the equation (i) can be written as:
\begin{align} & \left( \frac{1}{P}\frac{dP}{dt} \right)=k-\frac{k}{N}P \\ & or,\frac{dP}{dt}=Pk-\frac{{{P}^{2}}k}{N}\to (ii) \\ & \\ \end{align}
The $\frac{dP}{dt}$ represents the rate of change of Population w.r.t time and it is given as $Pk-\frac{{{P}^{2}}k}{N}$, here this equation has degree of 2 which means this is quadratic and the negative sign in front of quadratic represents inverted U-shaped curve. Check the interactive graph (here), where you can change the values of  $\left( N \right)$ and$\left( k \right)$.

The equation (ii) can be alternatively written as:
\begin{align} & or,\frac{dP}{dt}=kP\left( 1-\frac{P}{N} \right) \\ & or,\frac{dP}{P\left( 1-\frac{P}{N} \right)}=kdt \\ \end{align}
Now, Let’ integrate on both sides,
\begin{align} & or,\int{\frac{dP}{P(1-P/N)}}=\int{kdt} \\ & or,\int{\frac{1}{P(1-P/N)}}dP=\int{kdt} \\ & or,\int{\frac{N}{P(N-P)}}dP=\int{kdt} \\ & or,\int({\frac{1}{P}+\frac{1}{(N-P)}})dP=\int{kdt} \\ & or,,\int{\frac{1}{P}}dP+\int{\frac{1}{(N-P)}}dP=\int{kdt} \\ & or,LnP-Ln(N-P)=kt+c \\ & or,-LnP+Ln(N-P)=-kt-c \\ & or,Ln\left( \frac{N-P}{P} \right)=-kt-c \\ & or,\left( \frac{N-P}{P} \right)={{e}^{-kt-c}} \\ & or,\frac{N-P}{P}={{e}^{-kt}}{{e}^{-c}} \\ \end{align}
Let, ${{e}^{-c}}=A$ then,
\begin{align} & or,\frac{N-P}{P}=A{{e}^{-kt}} \\ & or,\frac{N}{P}-\frac{P}{P}=A{{e}^{-kt}} \\ & or,\frac{N}{P}=1+A{{e}^{-kt}} \\ & or,P=\frac{N}{1+A{{e}^{-kt}}}\to (iii) \\ \end{align}
Let’s evaluate $\left( t \right)$ at zero then,
\begin{align} & P=\frac{N}{1+A{{e}^{-kt}}} \\ & {{P}_{0}}=\frac{N}{1+A{{e}^{-k0}}} \\ & or,{{P}_{0}}=\frac{N}{1+A} \\ & \because {{e}^{-k0}}={{e}^{0}}=1 \\ & or,{{P}_{0}}\left( 1+A \right)=N \\ & \therefore A=\frac{N-{{P}_{0}}}{{{P}_{0}}} \\ \end{align}
where, $\left( {{P}_{0}} \right)$ is initial population. Let’s substitute the value of $\left( A \right)$ in equation (iii) we get,
$\therefore P=\frac{N}{1+\left( \frac{N-{{P}_{0}}}{{{P}_{0}}} \right){{e}^{-kt}}}\to (iv)$
The equation (iv) represents the Logistic Growth Model. Please check the interactive graph below.

If your browser failed to open this graph, check this external link (here).

## Sunday, June 14, 2015

### Non Linear Regression in Malthusian Model with Real World Population Data

In my previous blogs, I discussed about the derivation of Malthusian Growth Model (here) and visual representation of Malthusian Model (here). The equation of Malthus was $P(t)={{P}_{0}}{{e}^{\kappa t}}$. This is a nonlinear equation. So, in this blog,  I will show how can we estimate the values of parameters for a Gaussian non-linear model.

In the more general normal nonlinear regression model, the function relating the response to the predictors is not necessarily linear and given as: ${{Y}_{i}}=f(\beta ,{{X}_{i}})+{{\varepsilon }_{i}}$, where, $\beta$  is a vector of parameters and ${{X}_{i}}$ is a vector of predictors, and ${{\varepsilon }_{i}}=NID(0,{{\sigma }^{2}})$.

The major assumption of Malthusian Population Theory is– the growth rate of population $\left( \frac{dP}{dt} \right)$ is linearly proportional to the population $\left( \kappa P \right)$. The equation of Malthus was $P(t)={{P}_{0}}{{e}^{\kappa t}}$. Hence, $\beta$is vector which consists ${{P}_{0}}$ and $\kappa$. While, ${{X}_{i}}$ is just time given as $t$.

I imported the data from following web (here). However, you can find the txt data (here) and R code (here). In the following tutorial video, I have discussed about the estimation of parameters for the  Gaussian non-linear model.

The estimates for the Malthus model is given as:

Estimate         Std. Error   t value Pr(>|t|)
po 2.6051148   0.0223043   116.80   <2e-16 ***
k   0.0166621   0.0001959   85.06   <2e-16 ***

Here, estimate for the ${{P}_{0}}$ or initial world population in 1950 was 2.06 billions and the estimates for $\kappa$ or the growth rate is 0.166 or 1.7%. Both of these estimates appear to be significant as the p-value is less than 5% for each of the estimates.

However, there is a major problem in this model. This model assumes the growth rate forever increasing. The population of fish in a pond will not increase forever because the pond has its own carrying capacity. In the next blog, I will develop the model including the carrying capacity then develop a interactive visual and estimate them and do some residual diagnostics as well.

The plot of world population:

### Seasonal ARIMA modeling for Toursim Forecasting

I have already discussed about the notation of Autoregressive Integrated Moving Averages (ARIMA) and Seasonal ARIMA (here). I have already written about the forecasts accuracy checks (here), how to find better model (here).

For this tutorial blog, you will need following R script (download here) and data (here). As I have promised, in this blog, I will forecast the monthly tourism arrival in Nepal. This is an original data available from Department of Tourism, Government of Nepal.

Here is diagram to performed ARIMA and forecasting:

You can also see my video post below.

## Hicksian Theory of Trade Cycle

Hicks combined the Keynesian saving-investment relationship and multipler, Samuelson’s multiplier-accelerator interaction, Clark’s acceleration principle and Harrod-Domra growth model to shed the light on the trade cycle. The Hicks theory of trade cycle is associated with long-run growth trend and he argued that investment should be looked upon as a function of changes in output as a whole and shouldn’t be looked upon as a function of consumption alone as in Samuelson model. Find the Samuelson model (here).

Further, Hicks assumes investment has a induced component and autonomous component. He assumes that the autonomous component as a constantly growing component which depends upon the longrun factors like population growth, technological progress etc.

### The Framework

National income$({{Y}_{t}})$ is made up with two components: consumption $({{C}_{t}})$and investment$({{I}_{t}})$.
${{Y}_{t}}={{C}_{t}}+{{I}_{t}}\to (i)$
Consumption$({{C}_{t}})$ at time$(t)$ depends upon the one year earlier income$({{Y}_{t-1}})$. Samuelson assumes  a linear function for consumption but Hicks ignores autonomous consumption expenditure$({{C}_{a}})$and consider only the cyclical fluctuations about a long run trend.
${{C}_{t}}=(1-s){{Y}_{t-1}}\to (ii);$
Where, $(1-s)$is marginal propensity to consumption $\left( a \right)$  or $(s)$ is marginal propensity to save. And for $\left( 0<a<1 \right)$ implies $\left( 0<s<1 \right)$.

Investment expenditure consists of induced investment $\left( {{I}_{i}} \right)$ which depends upon the change in income $\left( {{Y}_{t-1}}-{{Y}_{t-2}} \right)$  and autonomous investment $\left( {{I}_{a}} \right)$which is assumed to grow at some constant percentage rate$\left( r \right)$.
${{I}_{t}}=v({{Y}_{t-1}}-{{Y}_{t-2}})+{{I}_{o}}{{r}^{t}}\to (iii)$
Where, ${{I}_{0}}$ is initial investment and $v$ is the capital output ratio (COR) and it determines the accelerator.

Substituting values of$({{C}_{t}})$ and $({{I}_{t}})$ in equation (i) we get,
\begin{align} & {{Y}_{t}}=(1-s){{Y}_{t-1}}+v({{Y}_{t-1}}-{{Y}_{t-2}})+{{I}_{o}}{{r}^{t}} \\ & or,{{Y}_{t}}={{Y}_{t-1}}-s{{Y}_{t-1}}+v{{Y}_{t-1}}-v{{Y}_{t-2}}+{{I}_{o}}{{r}^{t}} \\ & or,{{Y}_{t}}=(1-s+v){{Y}_{t-1}}-v{{Y}_{t-2}}+{{I}_{o}}{{r}^{t}} \\ & \therefore v{{Y}_{t-2}}-(1-s+v){{Y}_{t-1}}+{{Y}_{t}}={{I}_{o}}{{r}^{t}}\to (iv) \\ \end{align}
Here  I modified the equation  (iv) as:
\begin{align} & v{{Y}_{t-2}}-(a+v){{Y}_{t-1}}+{{Y}_{t}}={{I}_{o}}{{r}^{t}}\to (v) \\ & \because a=(1-s) \\ \end{align}

The equation (iv) is a second order non homogeneours difference equation in Y. I solve this in mathematica and generated the interactive plot.

### Interactive Plot

I have generated the interactive mathematica plot of equation (v). You can see, unlike the Samuelson’s model (here), Hick model shows the longer term trend.
If your browser is unable to open the  graph, then click (here) for the external link.

A Stylize figure is give below:

## Wednesday, June 10, 2015

### An Introduction to Computable General Equilibrium Models via The stylised Johansen (SJ) Model

A general equilibrium models represents a model of an economy where all agents are in equilibrium. It’s an analytical approach which looks at the economy as a complete system of interdependent components (industries, households, investors, governments, importers and exporters). Further, It explicitly recognizes that economic shocks impacting on any one component can have repercussions throughout the system. While the word “Computable” means a system that can be solved numerically.

In this Stylised Johansen – theoretical structure (The SJ model) it represents a closed economy in which there are two sector, one household and two factor (labor and capital). The household tries to maximize their utility (we assumed a Cobb Douglas utility function) under his given budget. They receive income for selling the factors of Production (FOP) labor and capital to industries. We also assume that there is no tax system or absence of government and household will spend all the income in consumption of goods produced by industries. Since it’s a closed economy they won’t either export or import. The producers tries to minimize his cost under his given production function (represented by CD function). In this economy prices clear markets for goods and factors. And the economy holds a Zero profit condition which leads to free entry and exist of firm condition.

Here is a simple glimpse of problem, optimum solution and linearization.But prior to that one should understand the logic of Input Output table. Here is the link (here).

 Problems Optimum Solutions Linearized Solution Consumer’s Problem \begin{align} & {{U}_{\max }}=\prod\limits_{i=1}^{2}{X_{i0}^{{{\alpha }_{i0}}}} \\ & s.t. \\ & Y=\sum\limits_{i=1}^{2}{{{P}_{i}}{{X}_{i0}}} \\ \end{align} Where, $\sum\limits_{i=1}^{2}{{{\alpha }_{i0}}}=1$ and ${{\alpha }_{i0}}>0$. ${{X}_{i0}}=\frac{{{\alpha }_{i0}}Y}{{{P}_{i}}}$ ${{x}_{i0}}=y-{{p}_{i}}$ Here is the link for solution (here). Producer’s Problem \begin{align} & \min {{C}_{j}}=\sum\limits_{i=1}^{4}{{{P}_{i}}{{X}_{ij}}} \\ & s.t. \\ & {{X}_{j}}={{A}_{j}}\prod\limits_{i=1}^{4}{X_{ij}^{{{\alpha }_{ij}}}} \\ \end{align} for j=1 and 2 and $\sum\limits_{i=1}^{4}{{{\alpha }_{i1}}=1;}\sum\limits_{i=1}^{4}{{{\alpha }_{i2}}=1;}{{\alpha }_{ij}}>0$ \begin{align} & {{X}_{ij}}={{\alpha }_{ij}}{{X}_{j}}Q\prod\limits_{i=1}^{4}{P_{i}^{{{\alpha }_{ij}}}}/{{P}_{i}} \\ & where, \\ & Q=\left( \frac{1}{{{A}_{j}}}\prod\limits_{i=1}^{4}{\alpha _{ij}^{-{{\alpha }_{ij}}}} \right) \\ \end{align} Here is the link for solution (here). ${{x}_{ij}}={{x}_{j}}+\sum\limits_{i=1}^{4}{{{\alpha }_{ij}}{{p}_{i}}}-{{p}_{i}}$ Here is the link for solution (here). Price Formation ${{P}_{i}}=\lambda =Q\prod\limits_{i=1}^{4}{P_{i}^{{{\alpha }_{ij}}}}$ ${{p}_{i}}=\sum\limits_{i=1}^{4}{{{\alpha }_{ij}}{{p}_{i}}}$ Here is the link for solution (here). Commodity Market Clearance $\sum\limits_{j=0}^{2}{{{X}_{ij}}={{X}_{i}}}$ for i=1 and 2 ${{x}_{i}}=\sum\limits_{j=0}^{2}{{{\beta }_{ij}}{{x}_{ij}}}$ Here is the link for solution (here). Factor Market Clearance $\sum\limits_{j=1}^{2}{{{X}_{ij}}={{X}_{i}}}$ for i=2 and 3 ${{x}_{i}}=\sum\limits_{j=1}^{2}{{{\beta }_{ij}}{{x}_{ij}}}$ Here is the link for solution (here). The Household Income $Y={{P}_{3}}{{X}_{3}}+{{P}_{4}}{{X}_{4}}$ Drop the equation using walrus law Discussed below. Price ${{P}_{1}}=1$ ${{p}_{1}}=0$ Discussed below.

I am sure now you are comfortable with the IO table and its representation. Here, in above table we drop the HH income implementing the walrus law. Walras noted the mathematically equivalent proposition that when considering any particular market, if all other markets in an economy are in equilibrium, then that specific market must also be in equilibrium (wikipedia.org).

In the reality you are given a IO table more specifically know as social accounting matrix (SAM). This is given in value, the quantities and prices are not separated. Hence, in the reality you have to assume price as 1 with equivalent with a commodity known as numeraie. So everything will be expressed in term of that. So, there is need to express everything in changes therefor we linearize the equations and expressed everything in change.

I want to express gratitude to Dr. Hom Murti Pant, for his explanation below. Dr. Murti is is a senior economist with Australian Bureau of Agricultural and Resource Economics–Bureau of Rural Sciences, specializing in international trade and climate change policy.

If we study the lineaized solution of consumer's problem ${{x}_{i0}}=y-{{p}_{i}}$
we see
– All household expenditure elasticities = 1
– All own price elasticities = –1
– All cross price elasticities = 0

However, this is not very realistic. Eg. Expenditure elasticities for food are usually <1, while clothing and consumer durable are usually >1. However, we can assume other function like CDE; LES, etc.

If we study the lineaized solution of Producer;s problem ${{x}_{ij}}={{x}_{j}}+\sum\limits_{i=1}^{4}{{{\alpha }_{ij}}{{p}_{i}}}-{{p}_{i}}$, we can see,
– In the absence of changes in relative prices, industry j will change the volumes of all its inputs by the same percentage as its output
– If increase in the price of input i > average increase in the input prices, then industry j will substitute away from input i.
${{x}_{ij}}={{x}_{j}}+\sigma \left( \sum\limits_{i=1}^{4}{{{\alpha }_{ij}}{{p}_{i}}}-{{p}_{i}} \right)$ , where $\sigma =1$.
So, in other words our price-substitution term has an elasticity of 1. Ideally, we should adopt more general production functions so that the substitution terms vary according to input substitution possibilities in different industries. For example CES, CRESH production functions yield such substitution possibilities.

If we examine price formation ${{p}_{i}}=\sum\limits_{i=1}^{4}{{{\alpha }_{ij}}{{p}_{i}}}$ then
– Change in the price of of good j is a weighted average of the changes in input prices, the weights being cost shares.

If we examine the market clearing conditions ${{x}_{i}}=\sum\limits_{j=0}^{2}{{{\beta }_{ij}}{{x}_{ij}}}$ and  ${{x}_{i}}=\sum\limits_{j=1}^{2}{{{\beta }_{ij}}{{x}_{ij}}}$
– Change in the supply of commodity i is a weighted average of the percentage change in various demands for i, the weights being sales shares. – Similarly, the change in employment of factor i is a weighted average of the changes in industrial demands for i contributed by each industry.

I hope now we are ready to do some programmings in GEMPACK. See you in next blog.

### Commodity and Factor Market Clearance Condition and Linearization

For this we need understand the quantities IO table rather than value IO table. Lets try to understand the closed economy. Say, there are two industry ${{I}_{1}}$ and ${{I}_{2}}$. Say ${{I}_{1}}$ produces commodity ${{S}_{1}}$ and ${{I}_{2}}$ produces commodity ${{S}_{2}}$. To produce, they need the factors of production ($FOP$) say Labor $L$ and capital $K$. These  $FOP$ are supplied by the household ($HH$), let me index household by ${{I}_{0}}$.

The total quantity demand of commodity ${{S}_{1}}$ is ${{X}_{1}}$, of that total ${{X}_{1}}$, ${{I}_{1}}$ demands ${{X}_{11}}$, ${{I}_{2}}$ demands  ${{X}_{12}}$ and ${{I}_{0}}$ i.e household demands ${{X}_{10}}$. Or ${{X}_{11}}+{{X}_{12}}+{{X}_{10}}={{X}_{1}}$ in the condition commodity ${{S}_{1}}$ market clearance, Similarly, Say the total quantity demand of commodity ${{S}_{2}}$ is ${{X}_{2}}$, of that total ${{X}_{2}}$, ${{I}_{1}}$ demands ${{X}_{21}}$, ${{I}_{2}}$ demands  ${{X}_{22}}$ and ${{I}_{0}}$ i.e household demands ${{X}_{20}}$. Or ${{X}_{21}}+{{X}_{22}}+{{X}_{20}}={{X}_{2}}$ in the condition commodity ${{S}_{2}}$ market clearance.

So for the total commodity market clearance:

\begin{align} & {{X}_{11}}+{{X}_{12}}+{{X}_{10}}+{{X}_{21}}+{{X}_{22}}+{{X}_{20}}={{X}_{1}}+{{X}_{2}} \\ & or,\sum\limits_{j=0}^{2}{{{X}_{ij}}={{X}_{i}}} \\ \end{align}
For  = 1 and 2 only.

Now, the total quantity demand of labor $L$ is ${{X}_{3}}$, of that total ${{X}_{3}}$, ${{I}_{1}}$ demands ${{X}_{31}}$, ${{I}_{2}}$ demands  ${{X}_{32}}$ and ${{I}_{0}}$ i.e household demand is zero because the $HH$ is the supplier of $FOP$. Or ${{X}_{31}}+{{X}_{32}}={{X}_{3}}$ in the condition Labor $L$ market clearance. Now, the total quantity demand of capital $K$ is ${{X}_{4}}$, of that total ${{X}_{4}}$, ${{I}_{1}}$ demands ${{X}_{41}}$, ${{I}_{2}}$ demands  ${{X}_{42}}$ and ${{I}_{0}}$ i.e household demand is zero because the $HH$ is the supplier of $FOP$. Or ${{X}_{41}}+{{X}_{42}}={{X}_{4}}$ in the condition capital $K$ market clearance.

So for the total commodity market clearance:
\begin{align} & {{X}_{31}}+{{X}_{32}}+{{X}_{41}}+{{X}_{42}}={{X}_{3}}+{{X}_{4}} \\ & or,\sum\limits_{j=1}^{2}{{{X}_{ij}}={{X}_{i}}} \\ \end{align}
For  = 3 and 3 only.

Now, Lets linearize the commodity market clearance condition:

\begin{align} & \sum\limits_{j=0}^{2}{{{X}_{ij}}={{X}_{i}}} \\ & or,{{X}_{i0}}+{{X}_{i1}}+{{X}_{i2}}={{X}_{i}} \\ \end{align}
Taking Log on both sides
$Ln({{X}_{i}})=Ln({{X}_{i0}}+{{X}_{i1}}+{{X}_{i2}})$
Differentiate w.r.t ${{X}_{i}}$
\begin{align} & or,\frac{1}{{{X}_{i}}}\frac{d{{X}_{i}}}{d{{X}_{i}}}=\frac{1}{{{X}_{i0}}+{{X}_{i1}}+{{X}_{i2}}}\frac{d\left( {{X}_{i0}}+{{X}_{i1}}+{{X}_{i2}} \right)}{d{{X}_{i}}} \\ & here, \\ & \frac{d{{X}_{i}}}{d{{X}_{i}}}=1 \\ & or,\frac{1}{{{X}_{i}}}=\frac{1}{{{X}_{i0}}+{{X}_{i1}}+{{X}_{i2}}}\frac{d\left( {{X}_{i0}}+{{X}_{i1}}+{{X}_{i2}} \right)}{d{{X}_{i}}} \\ \end{align}
Taking $\frac{1}{d{{X}_{i}}}$ common,
\begin{align} & or,\frac{1}{{{X}_{i}}}=\frac{1}{d{{X}_{i}}}\frac{d\left( {{X}_{i0}}+{{X}_{i1}}+{{X}_{i2}} \right)}{{{X}_{i0}}+{{X}_{i1}}+{{X}_{i2}}} \\ & or,\frac{d{{X}_{i}}}{{{X}_{i}}}=\frac{d\left( {{X}_{i0}}+{{X}_{i1}}+{{X}_{i2}} \right)}{{{X}_{i0}}+{{X}_{i1}}+{{X}_{i2}}} \\ & or,\frac{d{{X}_{i}}}{{{X}_{i}}}=\frac{{{X}_{i0}}}{{{X}_{i0}}+{{X}_{i1}}+{{X}_{i2}}}\frac{d{{X}_{io}}}{{{X}_{i0}}}+\frac{{{X}_{i1}}}{{{X}_{i0}}+{{X}_{i1}}+{{X}_{i2}}}\frac{d{{X}_{i1}}}{{{X}_{i1}}}+\frac{{{X}_{i2}}}{{{X}_{i0}}+{{X}_{i1}}+{{X}_{i2}}}\frac{d{{X}_{i2}}}{{{X}_{i2}}} \\ \end{align}
Here, $\frac{{{X}_{i0}}}{{{X}_{i0}}+{{X}_{i1}}+{{X}_{i2}}},\frac{{{X}_{i1}}}{{{X}_{i0}}+{{X}_{i1}}+{{X}_{i2}}}and\frac{{{X}_{i2}}}{{{X}_{i0}}+{{X}_{i1}}+{{X}_{i2}}}$ simply represents the shares. Lets denote each shares by ${{\beta }_{i0}},{{\beta }_{i1}},and{{\beta }_{i2}}$ respectively. So,
$or,\frac{d{{X}_{i}}}{{{X}_{i}}}={{\beta }_{i0}}\frac{d{{X}_{io}}}{{{X}_{i0}}}+{{\beta }_{i1}}\frac{d{{X}_{i1}}}{{{X}_{i1}}}+{{\beta }_{i2}}\frac{d{{X}_{i2}}}{{{X}_{i2}}}$
Here, $\frac{d{{X}_{i}}}{{{X}_{i}}},\frac{d{{X}_{io}}}{{{X}_{i0}}},\frac{d{{X}_{i1}}}{{{X}_{i1}}}and\frac{d{{X}_{i2}}}{{{X}_{i3}}}$ are the change in ${{X}_{i}},{{X}_{i0}},{{X}_{i1}}$ and ${{X}_{i2}}$. Lets denote them as ${{x}_{i}},{{x}_{i0}},{{x}_{i1}}$ and${{x}_{i2}}$.
\begin{align} & or,{{x}_{i}}={{\beta }_{i0}}{{x}_{i0}}+{{\beta }_{i1}}{{x}_{i1}}+{{\beta }_{i2}}{{x}_{i1}} \\ & \therefore {{x}_{i}}=\sum\limits_{j=0}^{2}{{{\beta }_{ij}}{{x}_{ij}}} \\ \end{align}  for   is for 1 and 2.
With similar logic the linearized solution for the factor market clearance condition is
\begin{align} & or,{{x}_{i}}={{\beta }_{i1}}{{x}_{i1}}+{{\beta }_{i2}}{{x}_{i1}} \\ & \therefore {{x}_{i}}=\sum\limits_{j=1}^{2}{{{\beta }_{ij}}{{x}_{ij}}} \\ \end{align}  for   is for 3 and 4.

## Tuesday, June 9, 2015

### What’s that Lambda?

To understand lambda ($\lambda$), you have to understand the producer’s problem and it optimum solution. You can find information (here). I stress in that page that we will use equation ${{X}_{ij}}=\frac{{{\alpha }_{ij}}\lambda {{X}_{j}}}{{{P}_{i}}}$  frequently.
\begin{align} & {{X}_{ij}}=\frac{{{\alpha }_{ij}}\lambda {{X}_{j}}}{{{P}_{i}}} \\ & or,{{P}_{i}}{{X}_{ij}}={{\alpha }_{ij}}\lambda {{X}_{j}} \\ \end{align}
Taking summation, we get
$\sum{{{P}_{i}}{{X}_{ij}}}=\sum{{{\alpha }_{ij}}\lambda {{X}_{j}}}$
Now, let’s view $\sum{{{P}_{i}}{{X}_{ij}}}$ as cost, so $\sum{{{P}_{i}}{{X}_{ij}}}={{C}_{j}}$ .

We also assume a Zero Profit Condition (ZPC) on CGE model. ZPC implies the cost of production of each commodity $\sum{{{P}_{i}}{{X}_{ij}}}$ equates to value of gross output $\sum{{{P}_{i}}{{X}_{j}}}$ so, we can write, $\sum{{{P}_{i}}{{X}_{ij}}}={{C}_{j}}=\sum{{{P}_{i}}{{X}_{j}}}$. Since,$\sum{{{P}_{i}}{{X}_{ij}}}=\sum{{{\alpha }_{ij}}\lambda {{X}_{j}}}={{C}_{j}}=\sum{{{P}_{i}}{{X}_{j}}}$.

Can you find the cell that represents above notation in this IO table?

Let’s consider
\begin{align} & \sum{{{P}_{i}}{{X}_{j}}}=\sum{{{\alpha }_{ij}}\lambda {{X}_{j}}} \\ & or,\sum{{{P}_{i}}{{X}_{j}}}=\sum{1\lambda {{X}_{j}}} \\ & \because \sum{{{\alpha }_{ij}}}=1 \\ & or,{{P}_{i}}{{X}_{j}}=\lambda {{X}_{j}} \\ & \therefore {{P}_{i}}=\lambda \\ \end{align}
From, the previous post (here), we know that,
$\lambda =Q\prod\limits_{i=1}^{4}{P_{i}^{{{\alpha }_{ij}}}}$
And $Q=\left( \frac{1}{{{A}_{j}}}\prod\limits_{i=1}^{4}{\alpha _{ij}^{-{{\alpha }_{ij}}}} \right)$
$\therefore {{P}_{i}}=\lambda =Q\prod\limits_{i=1}^{4}{P_{i}^{{{\alpha }_{ij}}}}$

### Let’s Linearize now

For that let’s take log on both sides
\begin{align} & Ln({{P}_{i}})=Ln\left( Q\prod\limits_{i=1}^{4}{P_{i}^{{{\alpha }_{ij}}}} \right) \\ & or,Ln({{P}_{i}})=Ln\left( QP_{1}^{{{\alpha }_{1j}}}P_{2}^{{{\alpha }_{2j}}}P_{3}^{{{\alpha }_{3j}}}P_{4}^{{{\alpha }_{4j}}} \right) \\ & or,Ln({{P}_{i}})=Ln(Q)+Ln(P_{1}^{{{\alpha }_{1j}}})+Ln(P_{2}^{{{\alpha }_{2j}}})+Ln(P_{3}^{{{\alpha }_{3j}}})+Ln(P_{4}^{{{\alpha }_{4j}}}) \\ & or,Ln({{P}_{i}})=Ln(Q)+{{\alpha }_{1j}}Ln({{P}_{1}})+{{\alpha }_{2j}}Ln({{P}_{2}})+{{\alpha }_{3j}}Ln({{P}_{3}})+{{\alpha }_{4j}}Ln({{P}_{4}}) \\ & or,Ln({{P}_{i}})=Ln(Q)+\sum\limits_{i=1}^{4}{{{\alpha }_{ij}}Ln({{P}_{i}})} \\ \end{align}
Now, differentiate w.r.t ${{P}_{i}}$ ,
\begin{align} & or,\frac{1}{{{P}_{i}}}\frac{d{{P}_{i}}}{d{{P}_{i}}}=\frac{1}{Q}\frac{dQ}{d{{P}_{i}}}+\sum\limits_{i=1}^{4}{{{\alpha }_{ij}}\frac{1}{{{P}_{i}}}\frac{d{{P}_{i}}}{d{{P}_{i}}}} \\ & here, \\ & \frac{dQ}{d{{P}_{i}}}=0 \\ & \frac{d{{P}_{i}}}{d{{P}_{i}}}=1 \\ & \frac{1}{{{P}_{i}}}=0+\sum\limits_{i=1}^{4}{{{\alpha }_{ij}}\frac{1}{{{P}_{i}}}\frac{d{{P}_{i}}}{d{{P}_{i}}}} \\ \end{align}
Taking $\frac{1}{d{{P}_{i}}}$ common,
\begin{align} & or,\frac{1}{{{P}_{i}}}=\frac{1}{d{{P}_{i}}}\sum\limits_{i=1}^{4}{{{\alpha }_{ij}}\frac{d{{P}_{i}}}{{{P}_{i}}}} \\ & or,\frac{d{{P}_{i}}}{{{P}_{i}}}=\sum\limits_{i=1}^{4}{{{\alpha }_{ij}}\frac{d{{P}_{i}}}{{{P}_{i}}}} \\ \end{align}
Here, $\frac{d{{P}_{i}}}{{{P}_{i}}}$ is the change in price ${{P}_{i}}$ , Lets denote by ${{p}_{i}}$ , so the linearized equation will be

$\therefore {{p}_{i}}=\sum\limits_{i=1}^{4}{{{\alpha }_{ij}}{{p}_{i}}}$

## Monday, June 8, 2015

### Samuelson's Theory of Business Cycle (with Visualization)

Samuelson’s model of business cycle is the marriage between multiplier and acceleration. Multiplier explains the effect of change in investment to the level of income while the accelerator explains the effect of change in income to the level of investment. His model shows how the multiplier and acceleration interact with each other to generate the income, consumption, investment demands and how the fluctuation occurs in the economic system.
He assumes that the economy will be in equilibrium when current period consumption expenditure $({{C}_{t}})$ and current period investment expenditure $({{I}_{t}})$equates to current period national income$({{Y}_{t}})$.
${{Y}_{t}}={{C}_{t}}+{{I}_{t}}\to (i)$
Consumption$({{C}_{t}})$ at time$(t)$ depends upon the one year earlier income$({{Y}_{t-1}})$and it’s a linear function, which can be expressed as:
${{C}_{t}}={{C}_{a}}+a{{Y}_{t-1}}\to (ii)$
Where, ${{C}_{a}}$is autonomous  consumption which represents that even the income is zero people consume either by taking debts or spending their savings, $a$is marginal propensity to consume (mpc) $0<a<1$ or its simply shows what portion of income is spend on consumption.
Investment $({{I}_{t}})$is function of one year lag of with consumer demand and it’s a linear function, which can be expressed as:
${{I}_{t}}={{I}_{a}}+v({{C}_{t}}-{{C}_{t-1}})\to (iii)$
Where,  ${{I}_{a}}$is autonomous investment which represents investments made for the good of society and not for the goal of making profits,$v$ is the capital output ratio (COR) and it determines the accelerator.
Substituting values of $({{I}_{t}})$from equation (iii) and $({{C}_{t}})$ from equation (ii) in equation (i), we get:
\begin{align} & {{Y}_{t}}={{C}_{a}}+a{{Y}_{t-1}}+{{I}_{a}}+v({{C}_{t}}-{{C}_{t-1}}) \\ & or,{{Y}_{t}}={{C}_{a}}+{{I}_{a}}+a{{Y}_{t-1}}+v{{C}_{t}}-v{{C}_{t-1}} \\ \end{align}
Since, ${{C}_{t}}={{C}_{a}}+a{{Y}_{t-1}}$ then  ${{C}_{t-1}}={{C}_{a}}+a{{Y}_{t-2}}$ therefore ${{Y}_{t}}={{C}_{a}}+{{I}_{a}}+a{{Y}_{t-1}}+v{{C}_{t}}-v{{C}_{t-1}}$ can be expressed as:
\begin{align} & {{Y}_{t}}={{C}_{a}}+{{I}_{a}}+a{{Y}_{t-1}}+v{{C}_{t}}-v{{C}_{t-1}} \\ & or,{{Y}_{t}}={{C}_{a}}+{{I}_{a}}+a{{Y}_{t-1}}+v({{C}_{a}}+a{{Y}_{t-1}})-v({{C}_{a}}+a{{Y}_{t-2}}) \\ & or,{{Y}_{t}}={{C}_{a}}+{{I}_{a}}+a{{Y}_{t-1}}+v{{C}_{a}}+va{{Y}_{t-1}}-v{{C}_{a}}-va{{Y}_{t-2}} \\ & or,{{Y}_{t}}={{C}_{a}}+{{I}_{a}}+a{{Y}_{t-1}}+va{{Y}_{t-1}}-va{{Y}_{t-2}} \\ & or,{{Y}_{t}}={{C}_{a}}+{{I}_{a}}+a(1+v){{Y}_{t-1}}-va{{Y}_{t-2}} \\ & \therefore va{{Y}_{t-2}}-a(1+v){{Y}_{t-1}}+{{Y}_{t}}={{C}_{a}}+{{I}_{a}}\to (iv) \\ \end{align}
Equation (iv) is second order linear non-homogeneous difference equation with constant coefficient and constant term. Solving second order difference equation is quite intense. So, Instead of performing particular integral and complementary function I implement RSolve command in Wolfram Mathematica, the solution is given as:

RSolve[a*v* Y[n - 2] - a*(1 + v) Y[n - 1] + Y[n] == Ac + Ai, Y[n], n]

Y[n] -> (Ac + Ai)/(1 - a) +   2^-n (a + a v - Sqrt[a] Sqrt[a - 4 v + 2 a v + a v^2])^n C[1] +   2^-n (a + a v + Sqrt[a] Sqrt[a - 4 v + 2 a v + a v^2])^n C[2]

The standard textbook analyzes different regions but I plot the interactive diagram. Instead of explaining them, I leave it to the reader. I assume adjusting these sliders will definitely develop the intuition about what and which parameters for what value generates the five possible regions specified in the standard textbook.

1) What happens when you change the autonomous consumption and autonomous investment and combination of both.
2) Keeping all other constant, Change the capital output ratio and find out at what values the explosive or damped business cycle forms.
3) Keeping all other constant, Change the accelerator (mpc) and find out at what values the explosive or damped business cycle forms.
4) I suggest not to change the constant C[1] and C[2].
5) Find the mpc and capital output ratio of your country, arrange that value in the dynamic graph and see will there be any business cycle.

Here is Snapshot.

## Sunday, June 7, 2015

### Interactive Visualization of Malthusian Growth Model

In this blog, we will try to visualize the equation $P(t)={{P}_{0}}{{e}^{\kappa t}}$ and graphically see what happens if various values of ${{P}_{0}}$ and ${\kappa t}$ are used in the equations. For that, I tried to make this blog interactive.

Try it by yourself  by tweaking the interactive switches and see  what happens when the $P(t)={{P}_{0}}{{e}^{\kappa t}}$ value increases or decreases and what happens when growth rate $\kappa$ is changed.

If your browser is unable to load the interactive graph then click (here) to open externally.

Screenshot:

### Malthusian Growth Model

As per Malthus, "Population ($P$) when unchecked increases in geometric ratio". The major assumption of Malthusian Population Theory is– the growth rate of population $\left( \frac{dP}{dt} \right)$ is linearly proportional to the population $\left( \kappa P \right)$.

Mathematically, it can be expressed as:
\begin{align} & \frac{dP}{dt}=\kappa P \\ & or,\left( \frac{1}{P} \right)\left( \frac{dP}{dt} \right)=\kappa \\ \end{align}
Let’s integrate both sides w.r.t time ($t$),
\begin{align} & or,\int{\left( \frac{1}{P} \right)\left( \frac{dP}{dt} \right)dt}=\int{\kappa dt} \\ & or,\int{\left( \frac{1}{P} \right)dP}=\kappa t+c \\ & or,Ln(P)=\kappa t+c \\ & \because \int{\left( \frac{1}{P} \right)dP}=Ln(P)+c \\ \end{align}
Now, let’s exponentia in both sides, we get,
\begin{align} & or,Ln(P)=\kappa t+c \\ & or,{{e}^{Ln(P)}}={{e}^{\kappa t+c}} \\ & or,{{P}_{(t)}}={{e}^{\kappa t+c}} \\ & \because {{e}^{Ln(P)}}=P \\ & or,{{P}_{(t)}}={{e}^{\kappa t}}{{e}^{c}} \\ \end{align}
Lets assume ${{e}^{c}}=A$ , then
$or,P(t)={{e}^{\kappa t}}A$
$orP(t)=A{{e}^{\kappa t}}$  (ii)
Let’s evaluate this equation (i) at $\left( t=0 \right)$ , we get
\begin{align} & or{{P}_{(0)}}=A{{e}^{\kappa 0}} \\ & or{{P}_{(0)}}=A{{e}^{0}} \\ & \because \kappa 0=0 \\ & or{{P}_{(0)}}=A \\ & \because {{e}^{0}}=1 \\ \end{align}
Since, $P(0)=A$ then, Lets take equation $P(t)=A{{e}^{\kappa t}}$ this will change to
$P(t)={{P}_{0}}{{e}^{\kappa t}}$ (ii)
Let’s understand this equation, the population at any time$\left( t \right)$ is$P(t)$ which is equal to ${{P}_{0}}{{e}^{\kappa t}}$ where, initial population is $\left( {{P}_{0}} \right)$ which grows at exponential rate of $\left( \kappa \right)$ for $\left( t \right)$ times. Or, Logically it represent the population grows at the exponential rate of $\left( \kappa \right)$.

Here is a quick visual:

In the next blog, we will try to visualize the equation $P(t)={{P}_{0}}{{e}^{\kappa t}}$ and graphically see what happens if various values of ${{P}_{0}}$ and ${\kappa t}$ are used in the equations. Then, we will take the real data-set and try to fit a non-linear regression and estimate the parameters.

References:
Thomas Malthus, An Essay on Principle of Population, 1979

## Friday, June 5, 2015

### What's that Alpha?

To understand ALPHA ( ${{\alpha}_{ij}}$ ), you have to understand the producer’s problem and it optimum solution. You can find information (here). I stress in that page that we will use equation ${{X}_{ij}}=\frac{{{\alpha }_{ij}}\lambda {{X}_{j}}}{{{P}_{i}}}$ frequently. \begin{align} & {{X}_{ij}}=\frac{{{\alpha }_{ij}}\lambda {{X}_{j}}}{{{P}_{i}}} \\ & or,{{P}_{i}}{{X}_{ij}}={{\alpha }_{ij}}\lambda {{X}_{j}} \\ \end{align} Taking shares, we get \begin{align} & \frac{{{P}_{i}}{{X}_{ij}}}{\sum{{{P}_{i}}{{X}_{ij}}}}=\frac{{{\alpha }_{ij}}\lambda {{X}_{j}}}{\sum{{{\alpha }_{ij}}\lambda {{X}_{j}}}} \\ & or,\frac{{{P}_{i}}{{X}_{ij}}}{\sum{{{P}_{i}}{{X}_{ij}}}}=\frac{{{\alpha }_{ij}}}{\sum{{{\alpha }_{ij}}}} \\ \end{align} Remember that $\sum{{{\alpha }_{ij}}}=1$ , so \begin{align} & \frac{{{P}_{i}}{{X}_{ij}}}{\sum{{{P}_{i}}{{X}_{ij}}}}=\frac{{{\alpha }_{ij}}}{1} \\ & \therefore \frac{{{P}_{i}}{{X}_{ij}}}{\sum{{{P}_{i}}{{X}_{ij}}}}={{\alpha }_{ij}} \\ \end{align}
Now, I leave you with the table and a question, so what is that Alpha?

Finally, let me correct you, the value $\frac{{{P}_{i}}{{X}_{ij}}}{\sum{{{P}_{i}}{{X}_{ij}}}}={{\alpha }_{ij}}$ holds true only for the Cobb Douglas production function.

### linearization of Solution of Producer's Problem

From the previous post (here), we know that the solution of producer’s problem is
${{X}_{ij}}={{\alpha }_{ij}}{{X}_{j}}Q\prod\limits_{i=1}^{4}{P_{i}^{{{\alpha }_{ij}}}}/{{P}_{i}}$ Where, $Q=\left( \frac{1}{{{A}_{j}}}\prod\limits_{i=1}^{4}{\alpha _{ij}^{-{{\alpha }_{ij}}}} \right)$

Check my video and follow me taking notes

Now, Let’s linearize this solution, for that lets take log on both sides
\begin{align} & Ln({{X}_{ij}})=Ln\left( {{\alpha }_{ij}}{{X}_{j}}Q\prod\limits_{i=1}^{4}{P_{i}^{{{\alpha }_{ij}}}}/{{P}_{i}} \right) \\ & Ln({{X}_{ij}})=Ln\left( {{\alpha }_{ij}}{{X}_{j}}QP_{1}^{{{\alpha }_{1j}}}P_{2}^{{{\alpha }_{ij}}}P_{3}^{{{\alpha }_{3j}}}P_{4}^{{{\alpha }_{4j}}}/{{P}_{i}} \right) \\ & or,Ln({{X}_{ij}})=Ln({{\alpha }_{ij}})+Ln({{X}_{j}})+Ln(Q)+Ln(P_{1}^{{{\alpha }_{1j}}})+Ln(P_{2}^{{{\alpha }_{ij}}})+Ln(P_{3}^{{{\alpha }_{3j}}})+Ln(P_{4}^{{{\alpha }_{4j}}})-Ln({{P}_{i}}) \\ & or,Ln({{X}_{ij}})=Ln({{\alpha }_{ij}})+Ln({{X}_{j}})+Ln(Q)+{{\alpha }_{1j}}Ln({{P}_{1}})+{{\alpha }_{2j}}Ln({{P}_{2}})+{{\alpha }_{3j}}Ln({{P}_{3}})+{{\alpha }_{4j}}Ln({{P}_{4}})-Ln({{P}_{i}}) \\ & or,Ln({{X}_{ij}})=Ln({{\alpha }_{ij}})+Ln({{X}_{j}})+Ln(Q)+\sum\limits_{i=1}^{4}{{{\alpha }_{ij}}Ln({{P}_{i}})}-Ln({{P}_{i}}) \\ \end{align}
Now taking differentiation w.r.t${{X}_{ij}}=\frac{{{\alpha }_{ij}}\lambda {{X}_{j}}}{{{P}_{i}}}$
\begin{align} & \frac{1}{{{X}_{ij}}}\frac{d{{X}_{ij}}}{d{{X}_{ij}}}=\frac{1}{{{\alpha }_{ij}}}\frac{d{{\alpha }_{ij}}}{d{{X}_{ij}}}+\frac{1}{{{X}_{j}}}\frac{d{{X}_{j}}}{d{{X}_{ij}}}+\frac{1}{Q}\frac{dQ}{d{{X}_{ij}}}+\left( \sum\limits_{i=1}^{4}{{{\alpha }_{ij}}\frac{1}{{{P}_{i}}}\frac{d{{P}_{i}}}{d{{X}_{ij}}}} \right)-\frac{1}{{{P}_{i}}}\frac{d{{P}_{i}}}{d{{X}_{ij}}} \\ & here, \\ & \frac{d{{X}_{ij}}}{d{{X}_{ij}}}=1, \\ & \frac{d{{\alpha }_{ij}}}{d{{X}_{ij}}}=0, \\ & \frac{dQ}{d{{X}_{ij}}}=0 \\ & so, \\ & \frac{1}{{{X}_{ij}}}=0+\frac{1}{{{X}_{j}}}\frac{d{{X}_{j}}}{d{{X}_{ij}}}+0+\left( \sum\limits_{i=1}^{4}{{{\alpha }_{ij}}\frac{1}{{{P}_{i}}}\frac{d{{P}_{i}}}{d{{X}_{ij}}}} \right)-\frac{1}{{{P}_{i}}}\frac{d{{P}_{i}}}{d{{X}_{ij}}} \\ & or,\frac{1}{{{X}_{ij}}}=\frac{1}{{{X}_{j}}}\frac{d{{X}_{j}}}{d{{X}_{ij}}}+\left( \sum\limits_{i=1}^{4}{{{\alpha }_{ij}}\frac{1}{{{P}_{i}}}\frac{d{{P}_{i}}}{d{{X}_{ij}}}} \right)-\frac{1}{{{P}_{i}}}\frac{d{{P}_{i}}}{d{{X}_{ij}}} \\ \end{align}
Taking $\frac{1}{d{{X}_{ij}}}$ as common, then
\begin{align} & or,\frac{1}{{{X}_{ij}}}=\frac{1}{d{{X}_{ij}}}\left( \frac{d{{X}_{j}}}{{{X}_{j}}}+\left( \sum\limits_{i=1}^{4}{{{\alpha }_{ij}}\frac{d{{P}_{i}}}{{{P}_{i}}}} \right)-\frac{d{{P}_{i}}}{d{{P}_{i}}} \right) \\ & or,\frac{d{{X}_{ij}}}{{{X}_{ij}}}=\frac{d{{X}_{j}}}{{{X}_{j}}}+\left( \sum\limits_{i=1}^{4}{{{\alpha }_{ij}}\frac{d{{P}_{i}}}{{{P}_{i}}}} \right)-\frac{d{{P}_{i}}}{{{P}_{i}}} \\ \end{align}
Now, $\frac{d{{X}_{ij}}}{{{X}_{ij}}}$ is the change in ${{X}_{ij}}$, $\frac{d{{X}_{j}}}{{{X}_{j}}}$ is change in ${{X}_{j}}$ and $\frac{d{{P}_{i}}}{{{P}_{i}}}$ is change in ${{P}_{i}}$. Lets represent them by ${{x}_{ij}}$, ${{x}_{j}}$ and ${{p}_{i}}$ respectively. Then our equation will be:
$\therefore {{x}_{ij}}={{x}_{j}}+\sum\limits_{i=1}^{4}{{{\alpha }_{ij}}{{p}_{i}}}-{{p}_{i}}$
This is the final linear solution, which you will see in many research paper while the CD production function is assumed.