title: Low to high frequency conversion in panel data in R using tempdisagg
body: <p>I have daily panel data with four variables: date, cusip(id identifier), PD (probability of default), and price. PD is only available on a quarterly basis for the first day of January, April, July, and October. I want to generate daily data for PD using Chow-Lin frequency conversion from <code>tempdisagg</code> package. I know how to apply <code>td()</code> function on time series, but I didn't find examples with panel data frames. Here are my code and sample data using <code>reproduce()</code> from <code>devtools</code> package, so only few sample days are included instead of full quarter. Running <code>td()</code> reports an error:</p>
  
  <blockquote>
    <p>Error in td(PD ~ price, conversion = "first", method = "chow-lin-fixed", fixed.rho
    = 0.5) :    In numeric mode, 'to' must be an integer number.</p>
  </blockquote>
  
  <p>I know that both price and PD are high-frequency daily indicators in <code>mydata</code>, so I guess I need to use <code>to.quarterly()</code> function on <code>PD</code>or something similar.</p>
  
  <pre><code>library(dplyr)
  library(zoo)
  library(tempdisagg)
  library(tsbox)
  
  mydata &lt;- structure(list(date = structure(c(13516, 13516, 13517, 13517,13518, 13518, 13521, 13605, 13605, 13606), class = "Date"), cusip = c("31677310","66585910", "31677310", "66585910", "31677310", "66585910", "31677310","66585910", "31677310", "66585910"), PD = c(0.076891, 0.096,NA, NA, NA, NA, NA, 0.094341, 0.08867, NA), price = c(40.98, 61.31,40.99, 60.77, 40.18, 59.97, 39.92, 59.96, 38.6, 60.69)), row.names = c(6L,13L, 36L, 43L, 66L, 73L, 96L, 1843L, 1866L, 1873L), class = "data.frame") 
  
  mydata &lt;- mydata%&gt;%
  group_by(cusip) %&gt;%
  arrange(cusip,date) %&gt;%
  mutate(PDdaily = td(PD ~ price, conversion = "first",method = "chow-lin-fixed", fixed.rho = 0.5))
  </code></pre>