Puzzled. Why are the data you offer to predict() for the independent
variable, conc, all NA's? Is there something reversed or inverted
about how drc functions handle formulas.
--
David.
On Nov 28, 2010, at 2:33 PM, Brant Inman wrote:
> R-helpers,
>
> I recently submitted a help request for the predict.drm function
> found in the drc package. I am still having issues with the
> function and I am submitting reproducible code hoping that somebody
> can help me figure out what is going on.
>
> --------
> library(drc)
>
> # Fit a 4 parameter logistic model to ryegrass dataset
> fit <- drm(rootl ~ conc, data = ryegrass, fct = LL.4())
> summary(fit)
>
> # Generate a fake dataset for prediction
> newdt <- data.frame( matrix(c(seq(0.2, 9, 0.01), rep(NA,881)),
> ncol=2))
> colnames(newdt) <- c('rootl', 'conc')
>
> # Generate prediction intervals and confidence intervals
> prd.p <- predict(fit, newdata=newdt, interval='prediction')
> prd.c <- predict(fit, newdata=newdt, interval='confidence')
>
> # Check output
>> head(prd.p)
> Prediction Lower Upper
> [1,] 7.790812 NA NA
> [2,] 7.790476 NA NA
> [3,] 7.790106 NA NA
> [4,] 7.789702 NA NA
> [5,] 7.789262 NA NA
> [6,] 7.788784 NA NA
>
>> head(prd.c)
> Prediction Lower Upper
> [1,] 7.790812 NA NA
> [2,] 7.790476 NA NA
> [3,] 7.790106 NA NA
> [4,] 7.789702 NA NA
> [5,] 7.789262 NA NA
> [6,] 7.788784 NA NA
>
> --------
>
> There appears to be a problem with the predict.drc function. This
> code previous generated confidence and prediction intervals in
> columns 2 and 3 of the prediction matrices but now fails for reasons
> unknown to me. Anyone have an idea of what is going on and how I
> can remedy the situation?
>
> Brant Inman
>
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.
David Winsemius, MD
West Hartford, CT