0

I am trying to work through some example code from a published paper and uploaded dataset. The data and code is from the package drcSeedGerm

I am trying to run this sample code:

library(devtools)
install_github("OnofriAndreaPG/drcSeedGerm")

library(drc)
library(drcSeedGerm)
library(lmtest)
library(sandwich)
data(rape)
head(rape)

That runs without issue. The next example is this:

modHTE<-drm(nSeeds~timeBef+timeAf+Psi,data=rape,fct=HTE1(),type="event")
colnames(rape)

I get the error message:

Error in [.data.frame`(temp, , 3) : undefined columns selected

In the paper, they say: We can see that the data need to be grouped by assessment interval: ’timeBef’ and ’timeAf’ are respectively the beginning and ending of the scoring intervals (in days),’nSeeds’ is the number of germinated seeds. The ’propCum’ columns contains the cumulative proportions of germinated seeds and it is not necessary for time-to-event models. The HTE model is fit by using the functionHTE1(). No starting values are necessary,as a self-starting routine has been built into the model definition.

Am I missing something needed to run the drm code? I am confused why head(rape) or colnames(rape) will show me the names of the columns in the data, but the code doesn't recognize them?

colnames(rape) [1] "Psi" "Dish" "timeBef" "timeAf" "nSeeds" "nCum" "propCum"

Thank you!

Cettt
  • 11,460
  • 7
  • 35
  • 58
Phyto
  • 11
  • 2
  • I am unfamiliar with the data or the model or function (`drm()`). I used `?drm` and `?HTE1` to see the documentation. For `drm`: "fct - a list with three or more elements specifying the non-linear function, the accompanying self starter function, the names of the parameter in the non-linear function and, optionally, the first and second derivatives as well as information used for calculation of ED values. Currently available functions include, among others, the four- and five-parameter log-logistic models LL.4, LL.5 and the Weibull model W1.4. Use getMeanFunctions for a full list." ... – shea Apr 20 '19 at 16:04
  • ... And it's hard to tell by looking at `HTE1` documentation, I don't know what is supposed to be the output. If I just run `HTE1()` there is nothing returned. Since that's what is being fed into the `fct` attribute of the `drm()`, I think there is a problem with using `HTE1()` in that attribute. Maybe check the sample code that you got that line from? If that is indeed the code, you might want to email the authors and get some clarification about `HTE1()` and its use in `drm( ... , fct)`, since `HTE1()` seems to be their custom function. – shea Apr 20 '19 at 16:08

1 Answers1

0

I found the same error using the function drm() from the drc() package using

install_github("OnofriAndreaPG/drcSeedGerm")

after reading through : https://www.statforbiology.com/2022/stat_drcte_6-ht1step/

the solution is use function drmte() from the drcte() package by doing

install_github("OnofriAndreaPG/drcte")

instead of using drm() as given in the appendix of the Onofri et al 2018 paper

this solved the error and analysis at the moment (13/10/2022) all the best Arne

  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Oct 18 '22 at 01:05
  • As you solved the same problem, go ahead and post a full reproducible R example, it will be very valuable! – Ric Oct 19 '22 at 01:46
  • Is this more a workaround than a solution? – Roasty247 Oct 19 '22 at 15:58