A patch for the pnbd.LL() function in the original BTYD package, first
proposed by Theo
Strinopoulos. Now on CRAN, so you can get
it the usual way, with install.packages().
In its original version the Pareto/NBD (pnbd) part of the BTYD
package failed for me, as it did for Theo, for reasons he explained here. So, I implemented his
fix, rebuilt from source, and then it worked. This is the short version.
The long version is that in the process of implementing the fix I made
some changes to the choice of optimization routine (now using
optimx as opposed to optim), Gaussian
hypergeometric (now you have the option of using the
hypergeo package) and I found some opportunities for
refactoring functions defined in both the pnbd and the
bgnbd (Beta-Geometric Negative Binomial) groups. I
explained these changes are explained in separate documentation
(fix_pnbd.html). Finally, I rebuilt BTYD and checked that it would
return the same numbers as BTYD 2.4 did when running the examples in the
original BTYD vignette (see threeway_walkthrough.R).
First git clone.
If you use devtools, then at the
R console just call
document(); build(); install(build_vignettes = TRUE).
Done.
Otherwise, build the standard way in two steps:
R CMD build BTYD
R CMD check BTYD_2.4.2.tar.gz
install.packages("BTYD2_2.4.2.tar.gz", repos = NULL, type = "source")
# works only in RStudio:
.rs.restartR()