I am doing a simple change point analysis using the mcp R package, but my results still vary each time I rerun my code even after including set.seed. Appreciate any help on this! (Below is my code, thank you!)
library(rjags)
library(mcp)
model = list(y~1+x,~0+x,~0+x,~0+x,~0+x,~0+x)
set.seed(42)
fit_mcp = mcp(model, data=hosp_df)
summary(fit_mcp)
plot(fit_mcp)
newdata = data.frame(x = c(2023:2040))
prediction <- fitted(fit_mcp, newdata = newdata)