title: cbind error while building Pareto/NBD Model in R (BTYD Package)
body: <p>I am building a CLV model using the BTYD package and I have hit a roadblock that I just can't seem to get around.</p>
  
  <p>I have been carefully following the directions from Section 2.1 in <a href="http://cran.r-project.org/web/packages/BTYD/vignettes/BTYD-walkthrough.pdf" rel="nofollow">this tutorial</a>. Everything seemed to be going fine until I got to the calibration customer-by-sufficient-statistic matrix  (cal.cbs).  I used the following code to generate cal.cbs, as instructed in the tutorial:</p>
  
  <pre><code>birth.periods &lt;- split.data$cust.data$birth.per
  last.dates &lt;- split.data$cust.data$last.date
  cal.cbs.dates &lt;- data.frame(birth.periods, last.dates, end.of.cal.period)
  cal.cbs &lt;- dc.BuildCBSFromCBTAndDates(cal.cbt, cal.cbs.dates, per="week")
  </code></pre>
  
  <p>Everything seemed to work until the last line.  R gave me the following message:</p>
  
  <pre><code>&gt; cal.cbs &lt;- dc.BuildCBSFromCBTAndDates(cal.cbt, cal.cbs.dates, per="week")
  Started making calibration period CBS...
  Finished building CBS.
  Warning message:
  In cbind(f, r, T) :
    number of rows of result is not a multiple of vector length (arg 2)
  </code></pre>
  
  <p>I don't know if this is a huge deal or not because I'm not entirely sure what it means...  I decided to ignore it until I tried to do the parameter estimations.  This is what happened:</p>
  
  <pre><code>&gt; params &lt;- pnbd.EstimateParameters(cal.cbs)
  Error in optim(logparams, pnbd.eLL, cal.cbs = cal.cbs, max.param.value = 
      max.param.value,  : 
  L-BFGS-B needs finite values of 'fn'
  In addition: Warning message:
  In log(exp(loga - logb) - 1) : NaNs produced
  </code></pre>
  
  <p>I really don't know where to go from here. I looked in the source code for the pnbd.EstimateParameters function, but I couldn't figure out what exactly was going wrong.  Does anybody have even the slightest clue how I might fix this? Any suggestion will be greatly appreciated, as I am completely stuck right now.</p>