ncn-foreigners / singleRcapture

Repository for single source capture-recapture models
https://ncn-foreigners.github.io/singleRcapture/
Other
4 stars 1 forks source link

error when `weights` is a vector for `ztnegbin` #23

Closed BERENZ closed 2 years ago

BERENZ commented 2 years ago

This works well

m1 <- estimate_popsize(formula = TOTAL_SUB ~ .,
                            data = farmsubmission,
                            pop.var = "analytic",
                            model = "ztgeom",
                            method = "mle", 
                            weights = rep.int(1, nrow(farmsubmission)))

but if I replace ztgeom (or ztpoison) with ztnegbin I get an error

m2 <- estimate_popsize(formula = TOTAL_SUB ~ .,
                            data = farmsubmission,
                            pop.var = "analytic",
                            model = "ztnegbin",
                            method = "mle", 
                            weights = rep.int(1, nrow(farmsubmission)))
Error in hessian(coefficients) : 
dims [product 4] do not match the length of object [12036]

which is connected with using scalar weights in ztnegbin().

Kertoo commented 2 years ago

solved by #33