Trouble Accessing Corrected Data from CHOPIT Model in R Using 'anchors' Package

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?

{anchors} appears to be abandonware. It's almost 10 years old, I can't find it in CRAN archives, the URL is a subdomain that no longer has a DNS address, so there's not much I can say other than to check help(anchors) and look at the documents to see if there is a predict function. I'm guessing not.

for(fn in methods("predict"))
  try({
    f <- eval(substitute(getAnywhere(fn)$objs[[1]], list(fn = fn)))
    cat(fn, ":\n\t", deparse(args(f)), "\n")
  }, silent = TRUE)
#> predict.ar :
#>   function (object, newdata, n.ahead = 1L, se.fit = TRUE, ...)  NULL 
#> predict.Arima :
#>   function (object, n.ahead = 1L, newxreg = NULL, se.fit = TRUE,      ...)  NULL 
#> predict.arima0 :
#>   function (object, n.ahead = 1L, newxreg = NULL, se.fit = TRUE,      ...)  NULL 
#> predict.glm :
#>   function (object, newdata = NULL, type = c("link", "response",      "terms"), se.fit = FALSE, dispersion = NULL, terms = NULL,      na.action = na.pass, ...)  NULL 
#> predict.HoltWinters :
#>   function (object, n.ahead = 1L, prediction.interval = FALSE,      level = 0.95, ...)  NULL 
#> predict.lm :
#>   function (object, newdata, se.fit = FALSE, scale = NULL, df = Inf,      interval = c("none", "confidence", "prediction"), level = 0.95,      type = c("response", "terms"), terms = NULL, na.action = na.pass,      pred.var = res.var/weights, weights = 1, rankdeficient = c("warnif",          "simple", "non-estim", "NA", "NAwarn"), tol = 1e-06,      verbose = FALSE, ...)  NULL 
#> predict.loess :
#>   function (object, newdata = NULL, se = FALSE, na.action = na.pass,      ...)  NULL 
#> predict.mlm :
#>   function (object, newdata, se.fit = FALSE, na.action = na.pass,      ...)  NULL 
#> predict.nls :
#>   function (object, newdata, se.fit = FALSE, scale = NULL, df = Inf,      interval = c("none", "confidence", "prediction"), level = 0.95,      ...)  NULL 
#> predict.poly :
#>   function (object, newdata, ...)  NULL 
#> predict.ppr :
#>   function (object, newdata, ...)  NULL 
#> predict.prcomp :
#>   function (object, newdata, ...)  NULL 
#> predict.princomp :
#>   function (object, newdata, ...)  NULL 
#> predict.smooth.spline :
#>   function (object, x, deriv = 0, ...)  NULL 
#> predict.smooth.spline.fit :
#>   function (object, x, deriv = 0, ...)  NULL 
#> predict.StructTS :
#>   function (object, n.ahead = 1L, se.fit = TRUE, ...)  NULL

Created on 2023-10-31 with reprex v2.0.2

predict()is a "generic," meaning that it is a template that can be "dispatched" from from various objects. I don't see anything resembling what you're dealing with.

Aside from trying to track down the author, I don't see a way forward.