Precision of the forecast in R – Revision of battery exchange code

I have followed the instructions in this document of the StMoMo package to fit Lee Carter to the mortality data of Canada.

The next step in my project is to measure the accuracy of the forecast of the Lee Carter model when it fits this Canadian data.

To do this, I tried to use the precision () but I found an error since my Lee Carter setting is class "fitStMoMo" and not "prognostic" class or a time series.

Is there an alternative forecast accuracy function that you can use on the "fitStMoMo" objects that will calculate the Mean error, the mean square error, the average absolute error, the average percentage error, the average absolute percentage error, and the average error scaled absolute for me?

Reprex

Reprex was created using EWMaleData as used in the StMoMo document to mark the error specifically:

library ("StMoMo")
library ("demography")
library ("forecast")

constLC <- function (ax, bx, kt, b0x, gc, wxt, ages) {
c1 <- average (kt[1, ], na.rm = TRUE)
c2 <- sum (bx)[, 1], na.rm = TRUE)
list (ax = ax + c1 * bx, bx = bx / c2, kt = c2 * (kt - c1))
}
LC <- StMoMo (link = "logit", staticAgeFun = TRUE, periodAgeFun = "NP",
constFun = constLC)
LC <- lc(link = "logit")
LC$gnmFormula
#> [1]    "D / E ~ -1 + displacement (o) + factor (x) + Mult (factor (x), factor (t), inst = 1)"

EWMaleData
#> Mortality data for England and Wales
#> Series: man
#> Years: 1961 - 2011
#> Ages: 0 - 100
#> Exhibition: central

EWMaleIniData <- central2initial (EWMaleData)
ages.fit <- 55:89
wxt <- genWeightMat (ages = ages.fit, years = EWMaleIniData $ years,
clip = 3)
LCfit <- fit(LC, data = EWMaleIniData, ages.fit = ages.fit, wxt = wxt)
#> StMoMo: the following cohorts have been zero-weighted:
#> 1872 1873 1874 1954 1955 1956
#> StMoMo: Start fitting with gnm
#> Initializing
#> Executing startup iterations ..
#> Executing main iterations .....
#> Done
#> StMoMo: Finish the adjustment with GNM

LC for <- forecast(LCfit, h = 50)
class(LCfit)
#> [1]    "fitStMoMo"
class (LCfor)
#> [1] "for StMoMo"
accuracy (LCfit)
#> Error in precision.default (LCfit): The first argument must be a forecast object
#> or a series of time.
accuracy (LCfor)
#> Error in precision.default (LCfor): The first argument must be a forecast object
#> or a series of time.