Skip to content

Commit

Permalink
added check for valid percentiles in dic.fit and dic.fit.mcmc. fixes #38
Browse files Browse the repository at this point in the history
  • Loading branch information
scottyaz committed Jul 17, 2013
1 parent 2a3f724 commit f46b26d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions R/dic.fit.R
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ dic.fit <- function(dat,
## no asymptotic results for gamma disribution at the moment so will need bootstrap to be larger tha 0 if dist != "L"
if(dist %in% c("G") & n.boots <=0) stop("You must use bootstraping with this distrbution at the moment. Please increase n.boots to something larger than 0")

## check if ptiles are valid
if (any(ptiles >=1) | any(ptiles <= 0)) stop("Sorry the percentiles you are requesting are not valid.")

## fix sample size
n <- nrow(dat)

Expand Down
5 changes: 4 additions & 1 deletion R/dic.fit.mcmc.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,16 @@ dic.fit.mcmc <- function(dat,

## check to make sure data is well formed for CDT use:
check.data.structure(dat)

## check to make sure distribution is supported
if(!dist %in% c("G","W","L","E")) stop("Please use one of the following distributions Log-Normal (L) , Weibull (W), Gamma (G), or Erlang (E)")

## don't need MCMCpack for Erlang
if (dist != "E") require(MCMCpack)

## check that percentiles are valid
if (any(ptiles >=1) | any(ptiles <= 0)) stop("Sorry the percentiles you are requesting are not valid.")

## default prior parameters if none specified
if (is.null(prior.par1)){
if (dist == "L") {
Expand Down

0 comments on commit f46b26d

Please sign in to comment.