I have this error when I want to visualize splines logistic regression with ns
:
data <- read.table("e:/data_logistic.txt", header = TRUE)
dd <- datadist(data)
options(datadist = "dd")
model <- lrm(formula = P_A ~ ns(HEIGHT, 4), data = data, x = TRUE, y = TRUE)
p1 <- ggplot(Predict(model, HEIGHT))
Error in quantile.default(x[!outside], knots) : missing values and NaN's not allowed if 'na.rm' is FALSE
When I use rcs
(from rsm package) instead of ns
(from spines package) I have not any problem. I want to use ns
method. How can I solve this problem?
Thanks.