diff --git a/R/cnbinom.pars_function.R b/R/cnbinom.pars_function.R index a347fbc..22432a1 100644 --- a/R/cnbinom.pars_function.R +++ b/R/cnbinom.pars_function.R @@ -3,7 +3,7 @@ library(stringr) # cnbinom.pars is a function that outputs mu and r from univariate censored table input # assume negative binomial -cnbinom.pars<-function (censoredtable){ +cnbinom.pars<-function (censoredtable, mu0 = 100, r0 = 100, warn = -1, ...){ # make probabilities if not already @@ -283,11 +283,12 @@ findtypeofcensoring_univariatetable<-function (univariatefreqtable){ # optimize mu and r in loglikelihood_univariatecase # hide warnings... - options(warn=-1) + options(warn = warn) + fixdata_univariatecase_output=fixdata_univariatecase(censoredtable) - op<- optim(par=c(100,100), + op<- optim(par=c(mu0, r0), fn =loglikelihood_univariatecase, - fixdata_univariatecase_output=fixdata_univariatecase_output) + fixdata_univariatecase_output=fixdata_univariatecase_output, ...) final<-op$par mu = final[1] r = final[2] diff --git a/README.md b/README.md index c955dcc..6c77659 100644 --- a/README.md +++ b/README.md @@ -23,13 +23,16 @@ library(revengc) ## Usage `cnbinom.pars()` has the following format ``` -cnbinom.pars(censoredtable) +cnbinom.pars(censoredtable, mu0 = 100, r0 = 100, warn = -1, ...) ``` where a description of the argument directly below * **censoredtable** - A frequency table (censored and/or uncensored). A data.frame and matrix are acceptable classes. See Table format section below. - +* **mu0, r0** starting values for `mu` and `r` used by optim. +* **warn** - Value used for `options(warn)` during `optim()` fitting. + `-1` suppresses warnings +* **...** - Additional arguments to be passed to `optim()` `rec()` has the following format where a description of each argument is found below