0

I want to calculate a AUC from a data sample with values from day 1 to day 15. My data looks like this:

AUC <- structure(list(day = c(1L, 2L, 3L, 4L, 5L, 6L, 7L, 14L, 15L,16L), Leukos = structure(c(1L, 9L, 10L, 1L, 1L, 7L, 14L, 5L,3L, 2L), .Label = c("", "0,05", "0,1", "0,13", "0,15", "0,17","0,23", "0,25", "0,26", "0,29", "2", "3", "4", "5"), class = "factor"),X = c(NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), X.1 = c(NA,NA, NA, NA, NA, NA, NA, NA, NA, NA), X.2 = c(NA, NA, NA,NA, NA, NA, NA, NA, NA, NA), X.3 = c(NA, NA, NA, NA, NA,NA, NA, NA, NA, NA), X.4 = c(NA, NA, NA, NA, NA, NA, NA,NA, NA, NA), X.5 = c(NA, NA, NA, NA, NA, NA, NA, NA, NA,NA), X.6 = c(NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), X.7 = c(NA,NA, NA, NA, NA, NA, NA, NA, NA, NA), X.8 = c(NA, NA, NA,NA, NA, NA, NA, NA, NA, NA), X.9 = c(NA, NA, NA, NA, NA,NA, NA, NA, NA, NA), X.10 = c(NA, NA, NA, NA, NA, NA, NA,NA, NA, NA), X.11 = c(NA, NA, NA, NA, NA, NA, NA, NA, NA,NA), X.12 = c(NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), X.13 = c(NA,NA, NA, NA, NA, NA, NA, NA, NA, NA), X.14 = c(NA, NA, NA,NA, NA, NA, NA, NA, NA, NA), X.15 = c(NA, NA, NA, NA, NA,NA, NA, NA, NA, NA), ID = c(1L, 1L, 1L, 1L, NA, NA, NA, NA,NA, NA), Tag = c(1L, 2L, 3L, 4L, 5L, 6L, 7L, 14L, 15L, NA), Leukos.1 = c(10L, 8L, 7L, 6L, NA, NA, NA, NA, NA, NA),X.16 = c(NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), X.17 = c(NA,NA, NA, NA, NA, NA, NA, NA, NA, NA), ID.1 = c(NA, NA, NA,NA, NA, NA, NA, NA, NA, NA), Tag2 = c(NA, NA, NA, NA, NA,NA, NA, NA, NA, NA), Leukos2 = c(NA, NA, NA, NA, NA, NA,NA, NA, NA, NA)), row.names = c(1L, 2L, 3L, 4L, 5L, 6L, 7L,14L, 15L, 16L), class = "data.frame")

I want to calculate the AUC from day 1 to 15 with the "DescTools" package.

AUC(day, Leukos, from=1, to=15, method="spline")")

Sometimes data on day 1 or 15 are missing, thats why I use the spline method. In order to get better results when data on day 15 is messing, I also added day 16, because sometimes there is data on day 15.

When I leave day 16 blank, I get the result =92.27736.

When I enter 0,05 on day 16 and use the same code AUC(day, Leukos, from=1, to=15, method="spline")") I get the result =103.876.

I don't understand why this happens. I tell him only to calculate the AUC from day 1 to 15, so it shouldn't make a difference when I enter a value on day 16.

Does anyone know why this happens?

  • 1
    It's easier to help you if you include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input and desired output that can be used to test and verify possible solutions. Do not post pictures of data because we cannot copy/paste that into R for testing. – MrFlick Jul 01 '20 at 16:30
  • Thank you. I edited my post and copied my data with "devtools". Is it ok like this? – Alexander-P Jul 02 '20 at 15:58
  • Part of your problem might be that your Lukos column is a factor and not a numeric value (`class(AUC$Leukos)`). Is 0,05 meant to represent the decimal 0.05? How did you import your data? By default R expected decimals to use a period "." rather than ",". You need to let R know your data is different. – MrFlick Jul 02 '20 at 20:20
  • Thank you @MrFlick. I imported the data from a .csv file. But you were right, Leukos was a factor and not numeric, so the results changed. But the values still change when I enter a value on day 16 or not. – Alexander-P Jul 07 '20 at 15:34

0 Answers0