Skip to content

paulrougieux/forestproductsdemand

Repository files navigation

This R program estimates demand elasticites for forest products with respect to price and revenue.

! This project has been moved to a private repository

As of April 2014, contact paul.rougieux at efi.int if you are interested in these R scripts.

Data sources:

  • FAOSTAT for production volumes (in T or M^3), import and export volume and value (in USD)
  • World Bank for GDP Population, Exchange rates and deflators
  • FED St Louis for EUR to USD Exchange Rate before 1999. Euro Community (DISCONTINUED SERIES) Output: Graphs and table of estimated elasticities
    Author: Paul Rougieux, European Forest Institute
    efi_logo_rgb_small_siw.jpg : 17Kb

! This project has been moved to a private repository

Paper and Paperboard

We started writing the program while reproducing estimates of demand elasticities in a paper by Chas Amil and Buongiorno. This paper covered EU15 countries from 1969 to 1995. See our attempt at reproducing the same estimates in the folder: ./docs/ChasAmil2000

We then extended the data coverage up to the most recent available Year (2012) and to 27 countries in the European Union. For an overview of consumption, and prices of paper products in EU25 over the 50 years period.

You will find descriptive statistics for paper products demand in the EU under the folder ./docs/paper_products, in explore.md or explore.html

Sawnwood

You will find descriptive statistics for sawnwood demand in the European Union under explore_sawnwood.md or explore_sawnwood.html

Code

The following R scripts are in the /code folder

  • load
  • load WorldBank.r
  • clean EU15PaperDemand 0.6.r to prepare data for the ChasAmil 2000 estimates
  • clean.r cleans world bank and FAOSTAT data to extract consumption and prices
  • And estimation scripts

Tests

A "safety belt" is located in the /tests directory. It uses the testthat(external link) package. Run the following command to run all tests.

    library(testthat)
    test_dir("tests")

For a little more verbose messages use the Tap reporter:

    test_dir("tests/", reporter="Tap")

Remark: Because I usually run all tests with the command test_dir("tests") the working directory is set to /tests. This is inconvenient in practice. Therefore I begin each test file by changing the working directory to the root project directory "..".

Working directory

Hadley Wickham recommends not to setwd() in a script. Most scripts load from- or save data to- a path relative to the project path. By default, Knitr sets the working directory to the directory where the document is located. I prefer to change knitr's default directory to the project's root directory. It's possible thanks to an option added by yihui. For example if the document is localted in ./docs/explore/, I change all knitrs working directory with the option:

opts_knit$set(root.dir = '../..') 

Version Control

I'm using GIT and I followed this advice to set it up: create a repository. FAOSTAT developper Michael Kao is also using git: source code of the R FAOSTAT package. Commands I've used so far to upload content to github.com/paul4forest/forestproductsdemand:

git remote add origin https://github.com/paul4forest/forestproductsdemand
# Creates a remote named "origin" pointing at your GitHub repository
git pull origin master
git add <filename>
git commit -m "Message that explains my changes to the files"
git push origin master

Alternatively "git commit -a"" is a replacement for "git add"" and "git commit".
More version control commands in my blog Removing files: If you intend that your next commit should record all modifications of tracked files in the working tree and record all removals of files that have been removed from the working tree with rm (as opposed to git rm), use git commit -a, as it will automatically notice and record all removals.

Comments

by AL

  • Change Prices in EUR as effect of EUR USD exchange rate might be important after 2000
  • Add consumption and trade of pulp graphs
  • Check impact of local price with respect to international price when estimating demand functions

by LH

  • Structural change will be different in grafics paper: newsprint + printing & writing paper as in packaging paper for example. Packaging is included under other paper and paper board When analysing demand for forest products Deflate out GDP impact as first start to analyse effects beyond the economic impacts
  • Is sawnwod a substitute or a complement for other material?

by PR by order of importance

  • add a list of metadata containing main product title, unit of measurement and currencies
  • Try htmlepreview to render pages hosted on github
  • in func.R change the way FAO$regioncodes is loaded.
  • in func.R, FAO$regioncodes, Add year of entry into the EU for EU countries
  • Add a column indicating which aggregates a Country belongs to in the FAO$countrycodes table in func.R
  • Add plots of autocorrelation for each time series of demand for each country in the explore files
  • I might want to use the reshape2 package for data cleaning steps. Introduction to reshape2
  • Try an interactive map with GoogleVis. This has been tried in the docs/Paper_products folder.
  • Make a heat map with consumption per capita by country and by year
  • Contact Michael Kao about FAO$regioncodes, could this data frame be included or easily recreated from the FAOSTAT package?

Change log

February 2014 in ./code/func.R created lists of functions, Similar to the knitr options functions, see str(opts_knit).

Had trouble with sorting pictures for Had to use setwd() which is not good but didn't find a better way. I have asked a question about knitr's figure placement on StackOverflow: http://stackoverflow.com/questions/21582402/knitr-how-to-set-a-figure-path-in-knit2html-without-using-setwd

About

Demand models for forest produts

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published