Skip to content

ecx() function errors with some model types when hormesis_def = "max" #1

@aylapear

Description

@aylapear

When trying to run the ecx() function with the argument hormesis_def = "max" it was noticed that an error is produced with certain model types.

data <- data.frame(
  x = c(1.05, 1.0, 0.95, 0.9, 0.8, 0.6, 0.5, 0.5, 0.9, 0.7, 0.6),
  y = c(0.1, 0.5, 0.6, 0.75, 0.8, 0.85, .94, 0.9, 0.67, 0.99, 0.95)
)

plot(data$x, data$y)


set.seed(333)
bnec_model_1 <-
  bayesnec::bnec(
    y ~ crf(x, model = "nechorme"), 
    data = data,
    open_progress = FALSE
  )

bnec_model_2 <-
  bayesnec::bnec(
    y ~ crf(x, model = "nec3param"), 
    data = data,
    open_progress = FALSE
  )

bnec_model_3 <-
  bayesnec::bnec(
    y ~ crf(x, model = "nec4param"), 
    data = data,
    open_progress = FALSE
  )

ecx(bnec_model_1, hormesis_def = "max")
ecx(bnec_model_2, hormesis_def = "max")
ecx(bnec_model_3, hormesis_def = "max")

When ecx() is run on bnec_model_1 and bnec_model_3 it produces this error:

Error in stats::approxfun(seq_along(x), x) : 
  need at least two non-NA values to interpolate

It runs fine on bnec_model_2.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions