About this blog

R is an extremely versatile software to run your own models. It is used by many people from many different fields. There are many websites out there to help people make the most of it: R bloggers, Stack Exchange, among others.

I have met some researchers that argue that it is a slow software, compared with some other options available out there. Other options include Stata (which I also use), Nlogit, or Matlab. I fully agree that R is not optimal: more often than not, the models take a long time to converge (if they converge at all!). Yet, I have not found a single thing in my research that is not possible with R.

Since it is so versatile, R is widely used. You can do something as simples as calculate averages of your variables of interest, or complicated tasks like making your own beautiful maps or writing your own mathematical model and optimizing it. The possibilities are endless. Wherever I am stuck, I just write in the google searchbar an expression, and surely I always find a link that proposes a solution in a help forum to get me started.

It is used more and more in economics, especially in environmental economics. All of the PhD courses I have attended used R. I have been specializing in non-market valuation methods, namely the contingent valuation and travel cost methods, and discrete choice modelling. Most of my expertise as regards to R is in the travel cost method and discrete choice models. But it’s very straightforward to apply the CV method in R and go even further: if you need to tweak your log-likelihood function, R is a great software to do so.

Another reason why I use R in my research is that environmental economics relies heavily on the use of survey data. Unlike Census data or big data that has probably been externally validated, survey data frequently has missing data, strangely coded fields, etc. This implies that you need to recode some fields, sometimes with too many “if” functions. While I used to do this in Excel, I found that doing it in R saves me time in the long-run, especially because I don’t need to edit the data over and over again in case the base data file changes: I can just run the R script. There is much you can do with survey data, and there are many useful packages in this venture.

But in the course of my own research, I often felt at a loss when needing to edit my data and run my models. Sometimes I didn’t know where to start and just wished there was a guidebook for people like me about which packages and commands could be most useful in our field. Some other times, I had tasks that were monotonous and repetitive. I always wondered whether there was a faster way of doing a repetitive task that, albeit probably taking even more time, it would make my job less boring and that would require more learning. At the end of the day, I always find a package that can save my life. And this work pays off in the long run.

I thought it would save some time for future researchers if I could document my own efforts and share them. Hence this blog came to life. This blog might be especially relevant for PhD students who are getting started with valuation methods, or for more senior researchers aiming to transition into R. Some of the things I will be writing about took me months to discover, others took me digging into textbooks and yet feeling even more confused.

I will be sharing some useful commands that might interest practicioners in environmental economics. I hope you find what you are looking for!

Here are some useful resources to use R in applied environmental economics: