r - Converting quarterly time-series data into monthly data -


i trying use quarterly price deflator on monthly housing data. can please me convert quarterly data monthly data? looked using cubic spline interpolation method in stata had no luck getting file work. have access excel , r option me try. thank time.

quarterly       cpi deflator data     1999-04-01  79.891 1999-07-01  80.180 1999-10-01  80.547 2000-01-01  81.163 2000-04-01  81.623 2000-07-01  82.152 2000-10-01  82.593 2001-01-01  83.112 2001-04-01  83.699 2001-07-01  83.973 2001-10-01  84.227 2002-01-01  84.497 2002-04-01  84.812 2002-07-01  85.190 2002-10-01  85.651 2003-01-01  86.179 2003-04-01  86.455 2003-07-01  86.934 2003-10-01  87.346 2004-01-01  88.108 2004-04-01  88.875 2004-07-01  89.422 2004-10-01  90.049 2005-01-01  90.883 2005-04-01  91.543 2005-07-01  92.399 2005-10-01  93.100 2006-01-01  93.832 2006-04-01  94.587 2006-07-01  95.247 2006-10-01  95.580 2007-01-01  96.654 2007-04-01  97.194 2007-07-01  97.531 2007-10-01  97.956 2008-01-01  98.516 2008-04-01  98.995 2008-07-01  99.673 2008-10-01  99.815 2009-01-01  100.062 2009-04-01  99.895 2009-07-01  99.873 2009-10-01  100.169 2010-01-01  100.522 2010-04-01  100.968 2010-07-01  101.429 2010-10-01  101.949 2011-01-01  102.399 2011-04-01  103.145 2011-07-01  103.768 2011-10-01  103.917 2012-01-01  104.466 2012-04-01  104.943 2012-07-01  105.508 2012-10-01  105.935 2013-01-01  106.363 2013-04-01  106.623 2013-07-01  107.128 2013-10-01  107.589 2014-01-01  108.009 2014-04-01  108.606 2014-07-01  109.044 2014-10-01  109.067 2015-01-01  109.099 2015-04-01  109.650       monthly data    monthly datapoint 1999-01-01  76.841 1999-02-01  79.863 1999-03-01  81.245 1999-04-01  78.911 

using lines shown @ end, read input lines zoo object, zd, (or use read.zoo("myfile.dat", header = true) read file). compute sequence of "yearmon" class months, tt, interpolation , use na.spline interpolate. (an alternative use na.approx in place of na.spline if linear interpolation desired.)

library(zoo) zd <- read.zoo(text = lines, header = true) tt <- as.yearmon(seq(start(zd), end(zd), "month")) zm <- na.spline(zd, as.yearmon, xout = tt) 

we used input:

lines <- "quarterly       cpi  1999-04-01  79.891 1999-07-01  80.180 1999-10-01  80.547 2000-01-01  81.163 2000-04-01  81.623 2000-07-01  82.152 2000-10-01  82.593 2001-01-01  83.112 2001-04-01  83.699 2001-07-01  83.973 2001-10-01  84.227 2002-01-01  84.497 2002-04-01  84.812 2002-07-01  85.190 2002-10-01  85.651 2003-01-01  86.179 2003-04-01  86.455 2003-07-01  86.934 2003-10-01  87.346 2004-01-01  88.108 2004-04-01  88.875 2004-07-01  89.422 2004-10-01  90.049 2005-01-01  90.883 2005-04-01  91.543 2005-07-01  92.399 2005-10-01  93.100 2006-01-01  93.832 2006-04-01  94.587 2006-07-01  95.247 2006-10-01  95.580 2007-01-01  96.654 2007-04-01  97.194 2007-07-01  97.531 2007-10-01  97.956 2008-01-01  98.516 2008-04-01  98.995 2008-07-01  99.673 2008-10-01  99.815 2009-01-01  100.062 2009-04-01  99.895 2009-07-01  99.873 2009-10-01  100.169 2010-01-01  100.522 2010-04-01  100.968 2010-07-01  101.429 2010-10-01  101.949 2011-01-01  102.399 2011-04-01  103.145 2011-07-01  103.768 2011-10-01  103.917 2012-01-01  104.466 2012-04-01  104.943 2012-07-01  105.508 2012-10-01  105.935 2013-01-01  106.363 2013-04-01  106.623 2013-07-01  107.128 2013-10-01  107.589 2014-01-01  108.009 2014-04-01  108.606 2014-07-01  109.044 2014-10-01  109.067 2015-01-01  109.099 2015-04-01  109.650" 

Comments

Popular posts from this blog

php - Admin SDK -- get information about the group -

dns - How To Use Custom Nameserver On Free Cloudflare? -

Python Error - TypeError: input expected at most 1 arguments, got 3 -