Getting a time plot on levels using the first differences of a time series in R In my current regression model, one of the explanatory variables I need is "capital" (K). The country under consideration here is Côte d'Ivoire (West Africa) and, as you may already know, finding data for small open economies is very often an extremely difficult task.
I was able to find the data for "capital formation", which is essentially the first differences of the actual capital values (dK), but I am required to show the plot on levels (and not only on differences).
It is obvious that it is impossible to find the actual values from just the first differences, but there may be a way to have an exact similar plot using the differences as a basis.
How should I go about it using R?
Your answer will be much appreciated.
 A: I doubt that capital formation is the first difference of anything in particular in National Accounts.  Rather it is a component of the expenditure measurement of GDP.  It is a flow, but so too is GDP and all its components.
Taking a cumulative sum (e.g. using the R function cumsum) would often give you something which would often appear almost linear. You could do so for your model but it would not be particularly meaningful and would tend to show a large degree of collinearity with time.
So it is better to show capital formation as is, or as a percentage of GDP. There are prettier ways, but the following is fairly simple (taking data from the World Bank WDI):
indata <- "Year Gross_capital_formation_constant_2000_USD 
2000 1123627068 
2001 1160706761 
2002 1051600326 
2003 1020052316 
2004 1099616397 
2005 1007248619 
2006 1092461853 
2007 1081537234 
2008 1347595394 
2009 1541649130 
2010 1896228430 "

CIVgcf <- read.table(textConnection(indata), header = TRUE)
with(CIVgcf, plot(Gross_capital_formation_constant_2000_USD ~ Year,
     ylim=c(0,max(Gross_capital_formation_constant_2000_USD)), 
     type="b", main="Côte d'Ivoire") ) 


