Context: I am currently working with the 'anchors' package in R and have fitted a CHOPIT model using the 'chopit' function. Here's the context of my work:
- a dataset called 'freedom' from anchors package.
- I used the 'chopit' function to fit the CHOPIT model to the data.
Issue: I am encountering an error when attempting to use the 'predict' function with the CHOPIT model. The error message is as follows:
Error in UseMethod("predict") :
"predict" is not applicable for objects of class "anchors.chopit"
Code Snippet:
Code to fit the CHOPIT model
fo <- list(self = self ~ sex + age + educ + factor(country) ,
- vign = cbind(vign1,vign2,vign3,vign4,vign5,vign6) ~ 1 ,
- tau= ~ sex + age + educ + factor(country)
- )
out<- chopit( fo, data=freedom)
Attempt to use 'predict' function
predicted_data <- predict(out,data=freedom)
Question: How can I resolve the error related to the "predict" function when working with a CHOPIT model in the 'anchors' package? Are there alternative methods to obtain predicted values from the CHOPIT model?