Search code examples
rlogistic-regressiondrc

nplr failing, unclear why


I tried to run an nplr function:

require(nplr)

b<- data.frame("Conc" = c(0.03125, 0.046875, 0.0625, 0.09375, 0.1875),"BKA" =c(1.89970905356837, 98.2543214102345, 98.0660619544754, 98.1858634263221, 98.0489474584974))

nplr(x = b$Conc, y = b$BKA)

which failed with the error

Testing pars...
The 3-parameters model showed better performance
Error in nplr(x = b$Conc, y = b$BKA) : 
nplr failed and returned constant fitted values.
        Your data may not be appropriate for such model. 
In addition: Warning message:
In nlm(f = .sce, p = .initPars(x, y, 5), x = x, yobs 
= y, .weight,  :
  NA/Inf replaced by maximum positive value

Does anyone have any ideas for why it's giving this error?


Solution

  • Because nplr expects the response values to be between 0 and 1, you can rescale the y value by dividing by 100 and the error is gone, e.g.:

    require(nplr)
    require(dplyr)
    
    b<- data.frame("Conc" = c(0.03125, 0.046875, 0.0625, 0.09375, 0.1875),"BKA" =c(1.89970905356837, 98.2543214102345, 98.0660619544754, 98.1858634263221, 98.0489474584974))
    
    b <- 
        b %>% 
        mutate(BKA = BKA/100)
    
    nplr(x = b$Conc, y = b$BKA)