b-steve / acre

Acoustic spatial capture-recapture models
GNU General Public License v3.0
3 stars 1 forks source link

Model objects created by `demo_fit()` do not have class `acre_tmb` #3

Closed b-steve closed 1 year ago

b-steve commented 1 year ago

Model objects created with demo_fit() don't get the acre_tmb class, which means S3 methods aren't correctly applied:

> fit <- demo_fit("ihd")
> class(fit)
[1] "list"
> summary(fit)
            Length Class     Mode
read_input   4     -none-    list
read_output  6     acre_data list
dat_model    5     -none-    list
fit         37     acre_tmb  list

However everything works fine when the model is fitted with fit.acre() directly:

> myfit <- fit.acre(data, detfn = "hhn", par_extend_model = list(D = ~ noise))
> summary(myfit)
Detection function: Hazard halfnormal 
Number of sessions: 1 
Information types: NULL
Confidence interval method: Wald 

 Parameters: 
              Estimate Std. Error    lower   upper
sigma          5.20064    0.56201  4.20796  6.4275
lambda0        1.69718    0.24629  1.27704  2.2555
D.(Intercept)  8.53379    1.74430  5.11503 11.9525
D.noise       -0.03527    0.17716 -0.38250  0.3120

 Extended parameters link functions: 
D : log 
b-steve commented 1 year ago

The output is correct as it is. The component fit does have the correct class, so the user can do something like this:

demo.output <- demo_fit("ihd")
summary(demo.output$fit)