OnofriAndreaPG / drcte

Time-to-event methods for agriculture
0 stars 0 forks source link

Censored data (end=NA) is not running #4

Closed pabloalau closed 7 months ago

pabloalau commented 8 months ago

Please help me with the following problem with "drcte". I would be very grateful for any help in this regard. Regards

1) data: trat24C180, germination of 50 seeds in 10 capsules, stored for 180 days at 8°C,. 2) on average 9% of the seeds in the 10 capsules germinated. 3) The number of germinated seeds at each of 6 time intervals was recorded. 4) "NA" was placed at the right end of the last interval. 5) The number of seeds not germinated in that last interval was recorded. image

Problem 1: The last interval ending in "NA" gives an error.

mod24C180 <- drmte(counts ~ start + end, curveid = trat, fct = KDE(),data = trat24C180) Error in matrix(0, n, k, dimnames = list(1:n, intname)) : length of 'dimnames' [1] not equal to array extent

Problem2: Leaving the value of the last interval empty, when importing the file in R, "NA" appears automatically. So the script runs, but in the graph, the germination reaches the value probability = 1, when the real germination rate is 0.09. image

OnofriAndreaPG commented 7 months ago

Hello, in contrast to the Surv() object in the survival package, in drcte (as in drc) the right end for the last interval has to be ‘Inf’, while NA or blank are not supported. Please, replace NA with Inf Thanks! Andrea

On 31 Jan 2024, at 17:09, pabloalau @.***> wrote:

Please help me with the following problem with "drcte". I would be very grateful for any help in this regard. Regards

data: trat24C180, germination of 50 seeds in 10 capsules, stored for 180 days at 8°C,. on average 9% of the seeds in the 10 capsules germinated. The number of germinated seeds at each of 6 time intervals was recorded. "NA" was placed at the right end of the last interval. The number of seeds not germinated in that last interval was recorded. image.png (view on web) https://github.com/OnofriAndreaPG/drcte/assets/158306745/feb1f834-7bc8-403f-ac2c-235169531985 Problem 1: The last interval ending in "NA" gives an error.

mod24C180 <- drmte(counts ~ start + end, curveid = trat, fct = KDE(),data = trat24C180) Error in matrix(0, n, k, dimnames = list(1:n, intname)) : length of 'dimnames' [1] not equal to array extent

Problem2: Leaving the value of the last interval empty, when importing the file in R, "NA" appears automatically. So the script runs, but in the graph, the germination reaches the value probability = 1, when the real germination rate is 0.09. image.png (view on web) https://github.com/OnofriAndreaPG/drcte/assets/158306745/b41de4ba-e2c1-4d9a-94d7-b5f9007826f2 — Reply to this email directly, view it on GitHub https://github.com/OnofriAndreaPG/drcte/issues/4, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIXJNIWD3A4FNTGEX5G63HDYRJUEFAVCNFSM6AAAAABCTKUNDCVHI2DSMVQWIX3LMV43ASLTON2WKOZSGEYTANBVGIZTMMY. You are receiving this because you are subscribed to this thread.

pabloalau commented 7 months ago

Thank you Dr. Onofri. I had already tried with "Inf" but the same error occurred. Now I realized that when I put text in the column, it was automatically assigned as a character and not as numericr. So I changed the variable type tu numeric and now the function worked and I got the cumulative probability curves. Thanks very much...