You get this error if the factor given as the group argument has any unused factor levels. E.g.,
> library(NADA) > data(Golden) > with(Golden, cenboxplot(Blood, BloodCen, > factor(DosageGroup,levels=c("Low","High","<unused>")))) Error in if ((length(obs[censored])/length(obs)) > 0.8) { : missing value where TRUE/FALSE needed (0/0 is NaN, which triggers the 'missing value where TRUE/FALSE needed' message.) You should complain to the maintainer of the NADA package - the test should be more like 'length(obs)>0 && ...'. To work around it use factor(group) instead of group when calling cenboxplot. Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com > -----Original Message----- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf > Of David Winsemius > Sent: Monday, August 20, 2012 10:15 AM > To: Rich Shepard > Cc: r-help@r-project.org > Subject: Re: [R] NADA package/cenboxplot() method: maximum censored percentage > > > On Aug 20, 2012, at 9:22 AM, Rich Shepard wrote: > > > On Thu, 16 Aug 2012, David L Lorenz wrote: > > > >> The cenboxplot function uses cenros to estimate the censored > >> values. The > >> cenros function requires at least 2 uncensored observations to be > >> able to > >> do the regression. The cenros function does issue a warning when > >> there are > >> more than 80% censored data, but that is suppressed in cenboxplot. > > > > There must be something other than > 2 uncensored observations in > > my data > > that prevent cenboxplot from functioning. For example, dissolved > > arsenic > > concentrations have 578 total observations. Of these, 180 (31.14%) are > > censored and 398 are uncensored. Both number of uncensored > > observations and > > the percentage of censored observations appear to be well within > > plotable > > limits, but cenboxplot() returns this error: > > > > cenboxplot(as.d$quant, as.d$ceneq1, as.d$era, range=1.5, > > main='Dissolved > > Arsenic', ylab='Concentration (mg/L)', xlab='Time Period') > > Error in if ((length(obs[censored])/length(obs)) > 0.8) { : > > missing value where TRUE/FALSE needed > > > > I would like to understand how the function obtains a censored > > ratio > 0.8 > > when it is actually 0.3114. > > I see no evidence from what you have posted that the function "obtains > a censored ratio > 0.8". The error messages says there were missing > values. You might consider looking at : > > table(Q=is.na(as.d$quant), CE=is.na(as.d$ceneq1), ERA=as.d$era) > > My guess is that this test is failing for one or more categories of > as.d$era. > > > Displaying the data frame, as.d, has a logical TRUE or FALSE for > > each row; > > it can be provided if needed. > > You could use dput() and post through Nabble, which would let people > download if they were interested. Seems on the large size to be > considered "minimal" . > > -- > > David Winsemius, MD > Alameda, CA, USA > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.