amvillegas / StMoMo

Stochastic Mortality Modelling
22 stars 6 forks source link

Problem with print function for bootstrapped parametesr #29

Open amvillegas opened 4 years ago

amvillegas commented 4 years ago

i was looking into the query i got on GitHub about the "bootstrap" function in StMoMo. Check the code taken from the examples of that function (with just 5 bootstrap samples): library("StMoMo")

LCfit <- fit(lc(), data = EWMaleData)

LCResBoot <- bootstrap(LCfit, nBoot = 5, type = "residual")
plot(LCResBoot)
LCResBoot$bootParameters

but the last command to extract the bootstrapped parameters gives me the error

Error in round(x$loglik[1], 2) : 
  non-numeric argument to mathematical function

I tried different bootstrap alternatives but they all give me the same error. After debugging, it seems this is prompted by the function getMinimalFitStMoMo and by the call to "structure". The error is really related to the print method for fitStMoMo

We may need to create a new print method for the bootstrapped samples

amvillegas commented 4 years ago

Good idea about a printing function for bootstrapped objects; or maybe functions such as "coef" to extract the parameters (as in coef.fitStMoMo) and one to extract rates? Good idea about a printing function for bootstrapped objects; or maybe functions such as "coef" to extract the parameters (as in coef.fitStMoMo) and one to extract rates?