lotze / COMPoissonReg

COMPoissonReg R package
GNU General Public License v2.0
9 stars 4 forks source link

formula.nu processing #5

Closed andrewraim closed 3 years ago

andrewraim commented 5 years ago

There is an issue with formula processing. Here is a small example to illustrate.

y <- rcmp(250, lambda = 10, nu = 0.95)

# Doesn't work
out <- glm.cmp(y ~ 1)
out <- glm.cmp(y ~ 1, formula.nu = ~ 1)

# Workaround
out <- glm.cmp(y ~ 1, formula.nu = y ~ 1)

In the first two cases, The nu formula is missing the length of the data.

andrewraim commented 3 years ago

Throw an error if S or W matrix have zero rows, which indicates that there isn't enough context from the data about what their dimension should be. Give a descriptive message about using the data argument to resolve the situation. Also added formulas.R to internal-tests folder to check the behavior.