Nepal over last Four Decades with R

The World Bank DataBank provides the data of all countries for more than 1000 indicators since 1960. It can be used for various statistical analysis purpose. This weekend, I downloaded the Data for Nepal, and tried few simple things in R, mainly for the purpose of learning R. R is very powerful statistical analysis tool.

The data was downloaded as csv file, which can be read with read.csv() function in R. We can run the R commands from R command line, and its really interactive.

The data is loaded by default into R DataFrames. To keep things simple, i change the default indices of DataFrames to Years.

Now we have DataFrame ready with Nepal’s Data over last 4 decades (1960 to 2012 to be precise), which can be analyzed and Visualized.
Let us see the USD (US Dollar) vs NRS (Nepalese Rupees) Trend. The plot can be generated and saved to disk with following commands.

 

NRS Vs USD Trend

Similarly we can generate plots for other indicators too. For that we can don matlab-like subplot with par function. Let us see few other Indicators’ trend.

 

Trend of Various Indicators in Nepal

Till now we have just visualized the data available. Now let me do first analysis. For that I am computing CPI (Consumer price Index) from Inflation on Consumer Prices and see GDP per capita is doing good against it. (note that CPI indicator is already provided by databank). And, I’m doing this by writing my first script.

 

Inflation, CPI and GDP per Capita of Nepal

There are many things we can see from this analysis.

  • The Inflation (average) is Quite High : about 8%… That is twice the average Inflation of US.
  • The Inflation Rates increases during political crisis, and after political change.
  • CPI indicate the purchasing power of money at that particular time. So, anything that cost Rs 100 at 1974, would be expecting to cost about Rs 2080 in 2012. That’s quite high Inflation. As far as i know, I think US CPI has become just 5 times in this period.
  • Our GDP per capita is doing very bad comparing to CPI.  So, from our analysis, we can see that till early 80’s, we have CPI around GDP per capita (if we start from CPI = GDP per capita in 1964), But after that things turn worse, probably due to political instability.

There are many such things that we can visualize, and understand from this data.

Now, let me build my first linear model (linear regression). If we go through data, we can probably think that Life expectancy is related to crude birth rate, crude death rate and fertility rate.

We can build our model with:

To view the summary of our fit:

Call:

Residuals:

Coefficients:

Residual standard error: 0.06112 on 48 degrees of freedom
(1 observation deleted due to missingness)

We can see that, our model has fitted well with very low p values. To see the confidence intervals of our model:

 

To see how well our model has fit :

 

Our multiple linear model

There are many other such analysis we can do, much more powerful than these with R.

SHARE Nepal over last Four Decades with R

Leave a Reply

Your email address will not be published. Required fields are marked *

Share